0

初入安卓,Android studio 可以正常使用,gradle也可以把包下下来,但是点入class文件后,点download下不了源码,各种类都试过了...已科学上网,网上说的办法也试过,好愁啊,下面是其中一个的报错,配置代码贴在图后

图片描述

以下是app内build.gradle代码

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.fragmenttest"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

以下是项目build.gradle代码

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
        google()
        jcenter()
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
2019-04-23 提问
1 个回答
1

已采纳

看你的描述,猜测你要下载的是SDK源码,实际上你已经可以看到sdk源码了,如果你是在是要下载下来,可以这样试试。

File--> Settings --> 搜索sdk --> 勾选SDK Platform面板右下角的 Show Package Details,然后选择对应版本的source

clipboard.png

下载后可以在你SDK目录的platforms下找到对应版本的源码文件夹。

另外,上面也可以在Android Studio的Tools-->SDK Manager打开SDK Platform面板。

撰写答案

推广链接