【发布时间】:2019-10-12 06:17:08
【问题描述】:
我只是想知道如何成功构建 gradle 插件
错误:无法解析“:app@debugAndroidTest/compileClasspath”的依赖项:无法解析androidx.core:core:1.1.0。 显示详细资料 受影响的模块:app
**
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'
}
我只是想知道如何成功构建 gradle 插件
【问题讨论】:
-
您正在将 androidX 与支持版本混合使用。只需执行以下操作将对您有所帮助。菜单栏
Refactor > Migrate to AndroidX。可能它会向您显示一些重复依赖项的警告。因此,只需删除这些重复项并再次同步即可。 -
当我创建新项目时,我也有同样的错误,使用 sdk 29 和 androidx 实现的不同 gradle 默认在使用 android 支持实现时也有同样的错误
标签: android gradle android-gradle-plugin