I am using Butterknife 10.0.0 for one of my projects which involves a camerakit library. The app crashes and this is what I get from the log.
2019-02-12 00:18:21.289 20630-20630/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.seeme, PID: 20630
java.lang.BootstrapMethodError: Exception from call site #1 bootstrap method
at butterknife.internal.DebouncingOnClickListener.<clinit>(DebouncingOnClickListener.java:12)
at com.seeme.MainActivity_ViewBinding.<init>(MainActivity_ViewBinding.java:34)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at butterknife.ButterKnife.bind(ButterKnife.java:170)
at butterknife.ButterKnife.bind(ButterKnife.java:99)
at com.seeme.MainActivity.onCreate(MainActivity.java:27)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NoClassDefFoundError: Invalid descriptor: dex
038.
... 20 more
The at com.seeme.MainActivity.onCreate(MainActivity.java:27) in the MainActivity refers to this.
ButterKnife.bind(this);
Can't seem to understand why the app crashes. Any fix?
Butter Knife requires that you enable Java 8 in your builds to function as of version 9.0.0 and newer. You can learn more about how to enable this at https://developer.android.com/studio/write/java8-support.
You need to add something like
android {
compileOptions {
targetCompatibility = "8"
sourceCompatibility = "8"
}
}
to your application build.gradle.
Still does not work even with Java 8 enabled
Works perfectly for me. What version of butterknife do you use and what is the error exactly? Is it the same?
Butter Knife requires that you enable Java 8 in your builds to function as of version 9.0.0 and newer. You can learn more about how to enable this at https://developer.android.com/studio/write/java8-support.
You need to add something like
android { compileOptions { targetCompatibility = "8" sourceCompatibility = "8" } }to your application
build.gradle.
Thanks :) It works for me
Enabling Java 8 worked for me too. Does this have any restrictive implications?
It doesn't work for me too :(
I face the exact same issue. I used OnClick annotation on the Android material button. Would it be a reason? Thanks.
Does not work for me :(
Excelent, its work for me!!
Its work for me, tnx!
Most helpful comment
Butter Knife requires that you enable Java 8 in your builds to function as of version 9.0.0 and newer. You can learn more about how to enable this at https://developer.android.com/studio/write/java8-support.
You need to add something like
to your application
build.gradle.