无法解决依赖Android Studio

时间:2019-10-12 06:17:08

标签: android gradle android-gradle-plugin

我只是想知道如何成功构建插件

错误无法解决对':app @ debugAndroidTest / compileClasspath'的依赖性:无法解析androidx.core:core:1.1.0。 显示详细资料 受影响的模块:应用

**

  

build.gradle:项目

**

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

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.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
}
  

build.gradle:module:app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "android.example.com"
        minSdkVersion 17
        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'
        }
    }
}


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'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout: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'

    implementation "com.android.support:support-v4:28.0.0"
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation "com.android.support:support-vector-drawable:28.0.0"
    implementation "com.android.support:recyclerview-v7:28.0.0"
    implementation "com.android.support:design:28.0.0"
    implementation "com.android.support.constraint:constraint-layout:1.1.3"
    implementation 'com.android.support:support-annotations:28.0.0'

    implementation 'com.jakewharton:butterknife:10.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'


}

我只是想知道如何成功构建插件

1 个答案:

答案 0 :(得分:0)

在Android Studio 3.2及更高版本中,您可以通过从菜单栏中选择重构>迁移到AndroidX ,将现有项目迁移到AndroidX。

refactor命令使用两个标志。默认情况下,在您的gradle.properties文件中,它们都设置为true:

android.useAndroidX=true

Android插件使用适当的AndroidX库而不是支持库。

android.enableJetifier=true

Android插件通过重写二进制文件来自动迁移现有第三方库以使用AndroidX。

此处的详细信息:https://developer.android.com/jetpack/androidx/migrate