Java.lang.NoClassDefFoundError: Failed Resolution Of: Landroid/support/v4/content/LocalBroadcastManager Only On Build APK
Solution 1:
I faced similar problem.
This is because of the instant run feature is enabled. Just disable it, clean the project then build the project. Now generate release Apk. It will work.
May be Android Studio is not including all files in Apk, when we use the instant run to fasten the process.
On PC:
Android Studio --> File --> Setting --> Build, execution, deploy --> Instant run.
On Mac:
Android Studio --> Preferences --> Build, Execution, Deployment --> Instant Run.
Solution 2:
The solution that worked for me was to add the dependency
implementation "com.android.support:support-v4:<compileSdkVersion>.x.x"
in my gradle dependencies.
You can check the version according to your compileSdkVersion here.
From sdk version 29, you need to convert your project to androidx and use the new dependency
Solution 3:
I faced this issue after migrating to AndroidX.
I have added the following dependency.
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Solution 4:
This issue is because third party lib is still using v4 support lib. To fix this issue add the following in your gradle.properties
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
Post a Comment for "Java.lang.NoClassDefFoundError: Failed Resolution Of: Landroid/support/v4/content/LocalBroadcastManager Only On Build APK"