#android
#Android
Вопрос:
Я думаю, что Butterknife создает проблему при сборке gradle моего проекта. Это связано с multidexArchiveBuilderException.также я получаю ошибку app: transformClasseswithDexBuilderForDebug
Ошибка:
Warning:Ignoring InnerClasses attribute for an anonymous inner class
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:UsersSuyash Ekhande.gradlecachestransforms-1files-1.1butterknife-runtime-10.1.0.aarbe763a4d7356121de0276e3f3b6e563ajarsclasses.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing butterknife/Unbinder.class
Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:UsersSuyash Ekhande.gradlecachestransforms-1files-1.1butterknife-runtime-10.1.0.aarbe763a4d7356121de0276e3f3b6e563ajarsclasses.jar
Gradle: приложение
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.esuraksha.suraksharesponder"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation('commons-validator:commons-validator:1.4.1') {
exclude group: 'commons-collections', module: 'commons-collections'
}
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.firebaseui:firebase-ui-firestore:4.3.1'
implementation 'com.google.firebase:firebase-firestore:17.0.5'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
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'
}
apply plugin: 'com.google.gms.google-services'
Ответ №1:
Для Butterknife версии 9.0.0 и выше требуется Java 8, которая должна быть включена явно.
android {
...
// Configure for each module that uses butterknife.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}