My application is crashing out with the error Caused by: java.lang.NoSuchMethodException: f4.b.<init> [class android.bluetooth.BluetoothAdapter]
when I run it in release mode. The app works fine if run in debug mode, or even release mode when installed via Android Studio. The problem is exclusively when running a release build which has been installed via our MDM solution. The stack trace doesn’t appear to me to be particularly helpful:
FATAL EXCEPTION: main
Process: com.MYAPP, PID: 22867
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MYAPP/com.MYAPP.ui.BluetoothConnectionsActivity}: java.lang.NoSuchMethodException: f4.b.<init> [class android.bluetooth.BluetoothAdapter]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3271)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2017)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Caused by: java.lang.NoSuchMethodException: f4.b.<init> [class android.bluetooth.BluetoothAdapter]
at java.lang.Class.getConstructor0(Class.java:2332)
at java.lang.Class.getConstructor(Class.java:1728)
at f4.c.a(Unknown Source:8)
at androidx.lifecycle.v0.d(Unknown Source:0)
at h.r2.j(Unknown Source:70)
at h.r2.i(Unknown Source:12)
at com.MYAPP.ui.BluetoothConnectionsActivity.onCreate(Unknown Source:55)
at android.app.Activity.performCreate(Activity.java:7882)
at android.app.Activity.performCreate(Activity.java:7871)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1316)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3246)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2017)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
I have tried setting minifyEnabled false
and shrinkResources false
but this doesn’t seem to make any difference