If i do not add butterknife to my project, it is ok to run my program on phones.
When i followed it like this:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:23.4.0'
testCompile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
there is no question to compile, however,when i try to run on phone , Android Studio give me an error:
`Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;`
That's all.
Thank you.
This is a build system problem, not a problem with ButterKnife. Consider forcing all support libraries to the same version with something like:
configurations.all {
resolutionStrategy {
eachDependency { details ->
// Force all of the primary support libraries to use the same version.
if (details.requested.group == 'com.android.support') {
details.useVersion versions.supportLibrary
}
}
}
}
I had this because different versions of same library, taht helped me:
implementation "android.arch.lifecycle:extensions:1.1.0"
I resolved all of my dex issues by adding this into project.properties
cordova.system.library.7=com.android.support:appcompat-v7:27.1.0
Most helpful comment
This is a build system problem, not a problem with ButterKnife. Consider forcing all support libraries to the same version with something like: