报错一
ERROR: The Android Gradle plugin supports only Butterknife Gradle plugin version 9.0.0-rc2 and higher.
The following dependencies do not satisfy the required version:
root project 'SmartQuality' -> com.jakewharton:butterknife-gradle-plugin:8.5.1
Affected Modules: app
解决:升级butterknife
报错二
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
C:\Users\CSY\.gradle\caches\transforms-1\files-1.1\design-27.1.1.aar\c75ba38d21a3abc8cf6bb2609ba7459f\res\values\values.xml:96:5-202: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\CSY\.gradle\caches\transforms-1\files-1.1\design-27.1.1.aar\c75ba38d21a3abc8cf6bb2609ba7459f\res\values\values.xml:96:5-202: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.
解决:编译版本、android support design 升到28
报错三
Task :app:mergeExtDexDebug FAILED
AGPBI: {"kind":"error","text":"Static interface methods are only supported starting with Android N (--min-api 24): void butterknife.Unbinder.lambda$static$0()","sources":[{}],"tool":"D8"}
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform file 'classes.jar' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=16} using transform DexingTransform
> Error while dexing.
原因
butterknife 9.0.0-rc1 升级承了 java 8
解决:指定jdk
在build.gradle(app)中加
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
报错四
Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
AGPBI: {"kind":"error","text":"Program type already present: com.blankj.utilcode.BuildConfig","sources":[{}],"tool":"D8"}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.blankj.utilcode.BuildConfig
解决:升级utilcode
报错五
butterknife我升级的时候不小心用了10.0.0,这个问题让我我束手无策了许久
What went wrong:
Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:27:5-440:19 to override.
解决:这是因为用了10.0.0,10必须是引用androidx,androidx是不兼容android之前的其他库的,所以还是用9.0.0版本能兼容原来项目