解决Gradle Android Studio

时间:2018-01-16 22:35:27

标签: android android-studio

对所有人都好,提前我希望你对我有最好的理解,因为我刚开始使用android stuido下载版本2.3.3,因为版本3.0.1给了我很多问题,有人告诉我下载2.3.3,当我创建一个新项目时,这些错误出现在我身上,他们为我的英语道歉,因为我不懂英语而且我正在使用翻译器呵呵

  

错误:(37,17)无法解决:junit:junit:4.12在文件中显示   在“项目结构”对话框中显示

     

错误:无法解析:com.squareup:javawriter:2.2.1打开文件   在“项目结构”对话框中显示

     

错误:无法解决:javax.inject:javax.inject:1打开文件   在“项目结构”对话框中显示

     

错误:无法解决:javax.annotation:javax.annotation-api:1.2打开文件   在“项目结构”对话框中显示

     

错误:无法解决:com.google.code.findbugs:jsr305:2.0.1打开文件   在“项目结构”对话框中显示

     

错误:无法解析:org.hamcrest:hamcrest-integration:1.3打开文件   在“项目结构”对话框中显示

     

错误:无法解析:com.squareup:javawriter:2.1.1打开文件   在“项目结构”对话框中显示

这是我的gradle的配置我不知道你能帮助我多少

apply plugin: 'maven'
buildscript {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
     }

     dependencies {
         classpath 'com.android.tools.build:gradle:2.3.3'

         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
         }
     }

     allprojects {
         repositories {
             maven {
                 url 'https://maven.google.com'
             }
             jcenter()
             maven { 'url http://central.maven.org/maven2/' }
             // maven { url 
                 "https://oss.sonatype.org/content/repositories/snapshots/"
             }
         }
     }

这里是其他配置

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "27.0.1"
    defaultConfig {
        applicationId "com.example.cdk.myapplication"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner  
        android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
                'proguard-rules.pro'
            }
        }
    }

    dependencies {
     /* compile fileTree(dir: 'libs', include: ['*.jar'])
    compile group: 'com.squareup', name: 'javawriter', version: '2.2.1'
    compile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
    compile group: 'org.hamcrest', name: 'hamcrest-integration', version: '1.3'
    compile group: 'com.google.code.findbugs', name: 'jsr305', version: '2.0.1'
    compile group: 'javax.inject', name: 'javax.inject', version: '1'
    compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.2'
    compile group: 'junit', name: 'junit', version: '4.12' */

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
    {
        exclude group: 'com.android.support', module: 'support-annotations' 
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

请记住我讨论的第一个依赖项是因为我认为我错过了那些文件,但即便如此我修复了这个问题,所以我评论不要删除它们,如果它是下载服务器我还有尝试一个。许多人说这是连接,但我的下载速度是1200 kbts / sec。在gradle配置中,取消选中脱机工作模式并选中推荐选项。我以前尝试过本地模式并下载了最新版本,但我生成了更多错误。请帮助我,我尽量明确,以便他们考虑到我所做的一切,请帮助我提前谢谢

在西班牙语的stackoverflow论坛中有人告诉我更新到3.0.1版本以便更新,现在我收到了这一系列的错误,如果您继续使用2.3.3版本或3.0版本,我不知道您推荐什么。 1真的请求他们帮助,因为我真的很喜欢这个世界,我甚至可以开始创建我自己的应用程序

AS 3.0.1向我展示的错误

  

错误:无法解析':app @ debug / compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:26.0.0-beta1。   打开文件
显示细节

     

错误:无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:26.0.0-beta1。   打开文件
显示细节

     

错误:无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析junit:junit:4.12。   打开文件
显示细节

     

错误:无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析com.squareup:javawriter:2.1.1。   打开文件
显示细节

     

错误:无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析javax.inject:javax.inject:1。   打开文件
显示细节

     

错误:无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析org.hamcrest:hamcrest-library:1.3。   打开文件
显示细节

     

错误:无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析com.google.code.findbugs:jsr305:2.0.1。   打开文件
显示细节

     

错误:无法解析':app @ releaseUnitTest / compileClasspath'的依赖关系:无法解析junit:junit:4.12。   打开文件
显示细节

     

错误:无法解析':app @ releaseUnitTest / compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:26.0.0-beta1。   打开文件
显示细节

这里是AS 3.0.1的gradle配置

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.cdk.myapplication"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
        "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
                'proguard-rules.pro'
            }
        }
    }

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

    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

我认为我是最明确和最具说明力的,我可以帮助我或让我离开这个循环,或者告诉我你没有为此做过哈哈xD

0 个答案:

没有答案