pardom-zz / ActiveAndroid

Active record style SQLite persistence for Android
http://www.activeandroid.com
4.7k stars 1.03k forks source link

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/app/AppComponentFactory #567

Open anshuldhingra25 opened 4 years ago

anshuldhingra25 commented 4 years ago

Error occuring at line ActiveAndroid.initialize(this);

Was working on very old project whose target and compile sdk version was 21, now i upgraded to 29 and move to androidX i resolved most of the things in project and working fine on some devices but stuck on below mentioned error in some of the devieces in the line ActiveAndroid.initialize(this); after searching i got many links like link1, link2, link3 but none of these links helped my problem. ActiveAndroid library causing the problem as per my understanding So please any one here in community able to help me out please let me know the solution for this. My log is:

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/app/AppComponentFactory; at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at com.activeandroid.ReflectionUtils.getParsers(ReflectionUtils.java:158) at com.activeandroid.Registry.initialize(Registry.java:100) at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:8) at com.mouchel.mobile.application.MouchelMobileApplication.onCreate(MouchelMobileApplication.java:169) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5844) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1708) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:6662) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.AppComponentFactory" on path: DexPathList[[zip file "/data/app/com.mouchel.mobile--MCfu3k3U7lgApGDfwJjeg==/base.apk"],nativeLibraryDirectories=[/data/app/com.mouchel.mobile--MCfu3k3U7lgApGDfwJjeg==/lib/arm, /data/app/com.mouchel.mobile--MCfu3k3U7lgApGDfwJjeg==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) and the gradle file is

apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: "org.sonarqube"

sonarqube { properties { property "sonar.projectName", "-----" property "sonar.projectKey", "-----" property "sonar.host.url", "-----" property "sonar.language", "-----" property "sonar.sources", "src/main/" property "sonar.login", "-----" property "sonar.password", "-----" } } buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1" } } repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 29 buildToolsVersion "28.0.3" android { useLibrary 'org.apache.http.legacy' } defaultConfig { applicationId "-----" minSdkVersion 19 targetSdkVersion 29 multiDexEnabled = true resValue "string", "google_maps_key", (project.findProperty("GOOGLE_MAPS_API_KEY") ?: "") } dexOptions { jumboMode true javaMaxHeapSize "4g" } lintOptions { checkReleaseBuilds false abortOnError false }

dependencies { implementation fileTree(include: ['.jar'], dir: 'libs') / compile files('libs/httpcore-4.3.jar')*/ implementation files('libs/ZSDK_ANDROID_API.jar') implementation files('libs/commons-net-3.3.jar') implementation files('libs/json_simple-1.1.jar') implementation files('libs/asmack-android-4.jar') implementation files('libs/zxing-2.1.jar') implementation files('libs/activeandroid-3.0.jar') implementation files('libs/gson-2.2.4.jar')

implementation files('libs/SiiAndroidSDK.jar')

//implementation 'com.google.android.gms:play-services:9.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.4'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
implementation 'com.squareup:otto:1.3.8'
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
// Recommended: Add the Firebase SDK for Google Analytics.
implementation 'com.google.firebase:firebase-analytics:17.2.2'
// Add the Firebase SDK for Crashlytics.
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
    transitive = true;
}
testImplementation 'junit:junit:4.12'

}

apply plugin: 'com.google.gms.google-services'