Unable to show layout preview and InflateException after migrated to Android X - android

This morning I decided to migrate all app to Android X to use some new feature, but I got several problems, most of it in these three layout, (activity_main.xml, app_bar_main.xml, content_main.xml)
When I run the app I got this errors
2019-03-04 12:30:18.948 28112-28112/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: www.pro_cs_is.com, PID: 28112
java.lang.RuntimeException: Unable to start activity ComponentInfo{www.pro_cs_is.com/www.pro_cs_is.com.MainActivity}: android.view.InflateException: Binary XML file line #11: Binary XML file line #2: Error inflating class CoordinatorLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:173)
at android.app.ActivityThread.main(ActivityThread.java:6653)
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:821)
Caused by: android.view.InflateException: Binary XML file line #11: Binary XML file line #2: Error inflating class CoordinatorLayout
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class CoordinatorLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.CoordinatorLayout" on path: DexPathList[[zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/base.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_dependencies_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_resources_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_0_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_1_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_2_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_3_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_4_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_5_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_6_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_7_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_8_apk.apk", zip file "/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.view.LayoutInflater.createView(LayoutInflater.java:610)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:707)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:68)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:724)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:792)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:969)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:141)
at www.pro_cs_is.com.MainActivity.onCreate(MainActivity.java:67)
at android.app.Activity.performCreate(Activity.java:7098)
at android.app.Activity.performCreate(Activity.java:7089)
2019-03-04 12:30:18.949 28112-28112/? E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:173)
at android.app.ActivityThread.main(ActivityThread.java:6653)
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:821)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/www.pro_cs_is.com-MQHeR58522USvJ7r2TTHzQ==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:35)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:695)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:729)
at android.app.LoadedApk.getResources(LoadedApk.java:956)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2282)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5725)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1685)
... 6 more
build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "testApp.com"
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
exclude group: 'com.google.code.findbugs'
})
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.google.apis:google-api-services-blogger:v3-rev57-1.23.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.j256.ormlite:ormlite-android:5.1'
implementation 'com.j256.ormlite:ormlite-core:5.1'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.8#aar') {
transitive = true
}
implementation 'androidx.multidex:multidex:2.0.1'
// ViewModel and LiveData
dependencies {
def lifecycle_version = "2.0.0"
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation 'android.arch.lifecycle:extensions:1.1.1'
// optional - ReactiveStreams support for LiveData
implementation "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version"
// For Kotlin use lifecycle-reactivestreams-ktx
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$lifecycle_version"
}
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
about this error No original dex files found for dex location I tried the solution in this question1, question2 but not working

CTRL + Shift + F and found all CoordinatorLayout.
Then check if CoordinatorLayout elements has this signiture in xml files: androidx.coordinatorlayout.widget.CoordinatorLayout

Use this material design library and make sure all of your widgets are androidx
implementation 'com.google.android.material:material:1.1.0-alpha04'
The recyclerview and navigationView are not part of androidx material design it should be :- ( you are using older design version of recyclerview and NavigationView )
<androidx.recyclerview.widget.RecyclerView
.....
.....
&&
<com.google.android.material.navigation.NavigationView
.....
.....
Edit
Make sure you upgrade every widget to androidx .
The appbar widget should be
<com.google.android.material.appbar.AppBarLayout

Related

Android - Hilt issues when upgrading to Kotlin 1.6.0

Background
I wanted to update all of my dependencies before continuing with a new feature for my application. This is always a fun time. I hate coming here with posts like: "this code doesn't work" but here I am.
Problem
I narrowed the issues down to a change in my Gradle file. The app works with:
build.gradle
buildscript {
ext {
...
compose_version = '1.1.0-alpha02'
kotlin_version = '1.5.21'
hilt_version = '2.38.1'
...
build.gradle.app
...
dependencies {
...
// hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
// For Robolectric tests.
testImplementation "com.google.dagger:hilt-android-testing:2.38.1"
// ...with Kotlin.
kaptTest "com.google.dagger:hilt-android-compiler:2.38.1"
implementation("androidx.hilt:hilt-work:1.0.0")
kapt("androidx.hilt:hilt-compiler:1.0.0")
// Compose UI tests
// Test rules and transitive dependencies:
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$compose_version")
// Needed for createComposeRule, but not createAndroidComposeRule:
debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version")
implementation("androidx.room:room-runtime:$room_version")
annotationProcessor "androidx.room:room-compiler:$room_version"
kapt("androidx.room:room-compiler:$room_version")
implementation("androidx.room:room-ktx:$room_version")
...
But then I updated Kotlin and Compose (because the earlier version of compose is incompatible with Kotlin 1.6.0). I received some weird errors which I solved by converting kapt(...) dependencies to annotationProcessor(...) dependencies:
build.gradle
buildscript {
ext {
...
compose_version = '1.1.0-rc01'
kotlin_version = '1.6.0'
hilt_version = '2.38.1'
...
build.gradle.app
...
dependencies {
...
// hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
annotationProcessor "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
// For Robolectric tests.
testImplementation "com.google.dagger:hilt-android-testing:2.38.1"
// ...with Kotlin.
kaptTest "com.google.dagger:hilt-android-compiler:2.38.1"
implementation("androidx.hilt:hilt-work:1.0.0")
annotationProcessor("androidx.hilt:hilt-compiler:1.0.0")
// Compose UI tests
// Test rules and transitive dependencies:
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$compose_version")
// Needed for createComposeRule, but not createAndroidComposeRule:
debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version")
implementation("androidx.room:room-runtime:$room_version")
annotationProcessor "androidx.room:room-compiler:$room_version"
annotationProcessor("androidx.room:room-compiler:$room_version")
implementation("androidx.room:room-ktx:$room_version")
...
and then I began getting this error. Which makes me think that there is some deeper issue with Hilt. I tried multiple (newer) Hilt versions as well including the newest 2.40.5.
2021-12-29 22:33:07.479 15168-15168/com.XXX.networkdatausage E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.XXX.networkdatausage, PID: 15168
java.lang.RuntimeException: Unable to instantiate application com.XXX.networkdatausage.NetworkUsageApplication: java.lang.ClassNotFoundException: Didn't find class "com.XXX.networkdatausage.NetworkUsageApplication" on path: DexPathList[[zip file "/data/app/com.XXX.networkdatausage-03CzYbinIiu2DMSufPHnog==/base.apk"],nativeLibraryDirectories=[/data/app/com.XXX.networkdatausage-03CzYbinIiu2DMSufPHnog==/lib/arm, /system/lib, /system/vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1138)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6298)
at android.app.ActivityThread.access$1200(ActivityThread.java:242)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7179)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.XXX.NetworkUsageApplication" on path: DexPathList[[zip file "/data/app/com.XXX.networkdatausage-03CzYbinIiu2DMSufPHnog==/base.apk"],nativeLibraryDirectories=[/data/app/com.XXX.networkdatausage-03CzYbinIiu2DMSufPHnog==/lib/arm, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:52)
at android.app.Instrumentation.newApplication(Instrumentation.java:1124)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1130)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6298) 
at android.app.ActivityThread.access$1200(ActivityThread.java:242) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7179) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975) 
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/XXX/networkdatausage/Hilt_NetworkUsageApplication;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 14 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.XXX.networkdatausage.Hilt_NetworkUsageApplication" on path: DexPathList[[zip file "/data/app/com.XXX.networkdatausage-03CzYbinIiu2DMSufPHnog==/base.apk"],nativeLibraryDirectories=[/data/app/com.XXX.networkdatausage-03CzYbinIiu2DMSufPHnog==/lib/arm, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 17 more
Android Studio Version
Android Studio Arctic Fox | 2020.3.1 Patch 4
Question
What do I need to do to fix this? If you would like to see more of my Gradle files please let me know. Should I post this question somewhere else?
Edit
When I switch
annotationProcessor "com.google.dagger:hilt-android-compiler:$hilt_version"
to
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
I get this error (I couldn't include entire message so I just included the last two "caused by"):
Caused by: com.sun.tools.javac.processing.AnnotationProcessingError: java.lang.NoSuchMethodError: kotlinx.metadata.jvm.KotlinClassHeader.<init>(Ljava/lang/Integer;[I[Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:992)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:896)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1222)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1335)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1258)
... 34 more
Caused by: java.lang.NoSuchMethodError: kotlinx.metadata.jvm.KotlinClassHeader.<init>(Ljava/lang/Integer;[I[Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V
at dagger.internal.codegen.kotlin.KotlinMetadata.metadataOf(KotlinMetadata.java:202)
at dagger.internal.codegen.kotlin.KotlinMetadata.from(KotlinMetadata.java:187)
at dagger.internal.codegen.kotlin.KotlinMetadataFactory.create(KotlinMetadataFactory.java:56)
at dagger.internal.codegen.kotlin.KotlinMetadataUtil.isObjectClass(KotlinMetadataUtil.java:91)
at dagger.internal.codegen.kotlin.KotlinMetadataUtil.isObjectOrCompanionObjectClass(KotlinMetadataUtil.java:108)
at dagger.hilt.processor.internal.Processors.requiresModuleInstance(Processors.java:931)
at dagger.hilt.processor.internal.aggregateddeps.AggregatedDepsProcessor.processModule(AggregatedDepsProcessor.java:169)
at dagger.hilt.processor.internal.aggregateddeps.AggregatedDepsProcessor.processEach(AggregatedDepsProcessor.java:120)
at dagger.hilt.processor.internal.BaseProcessor.process(BaseProcessor.java:195)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt:90)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:188)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:980)
... 38 more
Solution
The issue was how I incorrectly handled the kapt errors after upgrading Kotlin.
I reverted all of my annotationProcessor(...) migrations back to kapt(...) and here was the issue:
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
was supposed to be:
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

Error when updating retrofit2 to the version 2.9.0 from 2.6.0 seems to confilct with Firebase

I am currently using Retrofit 2 and Firebase services in one project. The project is working fine but when I update Retrofit 2 Library to the new version (2.9.0), gradle synced perfectly but when running the app I get this error and the app fails. Error message: Unable to get provider com.google.firebase.perf.provider.FirebasePerfProvider:java.lang.ClassNotFoundException
My dependencies in Gradle-app looks like this:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-core:17.4.2'
implementation 'com.google.firebase:firebase-messaging:20.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' //for crashlytics
implementation 'com.google.firebase:firebase-perf:19.0.7'
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'me.dm7.barcodescanner:zxing:1.9'
Full error message:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.fm.csfm, PID: 8717
java.lang.RuntimeException: Unable to get provider com.google.firebase.perf.provider.FirebasePerfProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.perf.provider.FirebasePerfProvider" on path: DexPathList[[zip file "/data/app/com.fm.csfm-WHtOa5E0nJ2xAlJon-1HGQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.fm.csfm-WHtOa5E0nJ2xAlJon-1HGQ==/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:6288)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.perf.provider.FirebasePerfProvider" on path: DexPathList[[zip file "/data/app/com.fm.csfm-WHtOa5E0nJ2xAlJon-1HGQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.fm.csfm-WHtOa5E0nJ2xAlJon-1HGQ==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.ActivityThread.installProvider(ActivityThread.java:6273)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772) 
at android.app.ActivityThread.-wrap1(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6541) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.fm.csfm-WHtOa5E0nJ2xAlJon-1HGQ==/base.apk because: Failure to verify dex file '/data/app/com.fm.csfm-WHtOa5E0nJ2xAlJon-1HGQ==/base.apk': Bad method handle type 7
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:676)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:709)
at android.app.LoadedApk.getResources(LoadedApk.java:936)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2242)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5672)
... 8 more
Got it through!
I found that the problem was not a conflict with Firebase as I have noticed that when I update Retrofit in other projects also gives other errors. The solution was to add JAVA 8 support as follow:
In Gradle-app:
android{
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

Fragment Testing Error Using fragment-testing: Unable to instantiate instrumentation

I have an Android application I am building and would like to use the fragment-testing libraries to test some fragments in isolation. However, I am struggling to get the tests to execute:
2019-12-09 13:57:03.255 22352-22352/net.redlightning.solo E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.redlightning.solo, PID: 22352
java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{net.redlightning.solo.test/androidx.test.runner.AndroidJUnitRunner}: java.lang.ClassNotFoundException: Didn't find class "androidx.test.runner.AndroidJUnitRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/net.redlightning.solo.test-IhE3r3tw8UMYiQVbxTUcKw==/base.apk", zip file "/data/app/net.redlightning.solo-OBV060XuIVKmHuPoKbpynw==/base.apk"],nativeLibraryDirectories=[/system/lib64, /system/product/lib64]]
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6395)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
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:930)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.runner.AndroidJUnitRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/net.redlightning.solo.test-IhE3r3tw8UMYiQVbxTUcKw==/base.apk", zip file "/data/app/net.redlightning.solo-OBV060XuIVKmHuPoKbpynw==/base.apk"],nativeLibraryDirectories=[/system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6391)
at android.app.ActivityThread.access$1300(ActivityThread.java:219) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7356) 
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:930) 
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/runner/MonitoringInstrumentation;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 10 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.runner.MonitoringInstrumentation" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/net.redlightning.solo.test-IhE3r3tw8UMYiQVbxTUcKw==/base.apk", zip file "/data/app/net.redlightning.solo-OBV060XuIVKmHuPoKbpynw==/base.apk"],nativeLibraryDirectories=[/system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 13 more
Here is my app's gradle.build file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "net.redlightning.solo"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
kapt {
useBuildCache = false
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core:1.1.0'
implementation 'androidx.fragment:fragment:1.2.0-rc03'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.preference:preference:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.6.2'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-plus:17.0.0'
implementation 'com.github.deano2390:MaterialShowcaseView:1.3.4'
implementation 'com.github.zafarkhaja:java-semver:0.9.0'
implementation 'com.jcraft.jsch:com.springsource.com.jcraft.jsch:0.1.41'
implementation 'com.mixpanel.android:mixpanel-android:5.6.6'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.squareup.okio:okio:2.4.1'
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.2.2'
implementation 'io.dronefleet.mavlink:mavlink:1.1.5'
implementation 'me.grantland:autofittextview:0.2.1'
implementation 'org.mp4parser:isoparser:1.9.41'
implementation 'pl.tajchert:waitingdots:0.2.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
debugImplementation 'androidx.fragment:fragment-testing:1.2.0-rc03'
}
apply plugin: 'com.google.gms.google-services'
And here is the test class (simplified), located in androidTest:
package net.redlightning.solo.fragment
import android.content.Context
import android.location.Location
import androidx.fragment.app.testing.launchFragmentInContainer
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import junit.framework.Assert.assertNotNull
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
#RunWith(AndroidJUnit4::class)
class PlanningWidgetFragmentTest {
private var instrumentationContext: Context? = null
#Before
fun setUp() {
instrumentationContext = InstrumentationRegistry.getInstrumentation().targetContext
}
#Test
fun fetchWeatherInformationRequest() {
val location = Location("flp")
location.latitude = 43.073051
location.longitude = -89.401230
location.altitude = 266.0
location.bearing = 0.0f
val scenario = launchFragmentInContainer<PlanningWidgetFragment>()
scenario.onFragment {
val result = it.fetchWeatherInformationRequest(location)
assertNotNull(result)
}
}
I have tried with and without the #RunWith(AndroidJUnit4::class) annotation on the test class, I have tried with 1.2.0-rc03 and 1.1.0 versions of androidx.fragment:fragment-testing (and androidx.fragment:fragment so they match) in gradle, I've tried having the import be in debugImplmentation (as the docs and articles from a year ago describe), implementation, and androidTestImplementation. Nothing seems to work.
It is likely worth noting that if I remove fragment-testing from the project, and comment out the lines using it in the test (so it just builds a location it doesn't use) the test runs to completion just fine.
What is the correct setup to allow me to use androidx.fragment:fragment-testing?

After adding library show this error Didn't find class ".MainActivity" on path: DexPathList

build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.appium_new"
minSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
packagingOptions {
exclude 'lang-708-input.txt'
exclude 'java.policy'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation files('src/libs/byte-buddy-1.8.15.jar')
implementation files('src/libs/commons-exec-1.3.jar')
implementation files('src/libs/commons-lang3-3.9.jar')
implementation files('src/libs/commons-lang3-3.9-sources.jar')
implementation files('src/libs/commons-lang3-3.9-test-sources.jar')
implementation files('src/libs/commons-lang3-3.9-tests.jar')
implementation files('src/libs/guava-25.0-jre.jar')
implementation files('src/libs/java-client-7.3.0.jar')
implementation files('src/libs/okhttp-3.11.0.jar')
implementation files('src/libs/okio-1.14.0.jar')
implementation files('src/libs/selenium-server-standalone-3.141.59.jar')
}
After adding the last library i.e. implementation files('src/libs/selenium-server-standalone-3.141.59.jar') its show below error, if I remove this library then it work fine
2019-11-13 18:05:44.994 12737-12744/? E/com.appium_new: Failed to send DDMS packet REAQ to debugger (-1 of 20): Broken pipe
2019-11-13 18:05:45.587 12737-12737/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.appium_new, PID: 12737
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.appium_new/com.appium_new.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.appium_new.MainActivity" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.appium_new-0MtEr8TXu2cbQ_krT1jqPg==/base.apk"],nativeLibraryDirectories=[/data/app/com.appium_new-0MtEr8TXu2cbQ_krT1jqPg==/lib/x86, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2843)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.appium_new.MainActivity" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.appium_new-0MtEr8TXu2cbQ_krT1jqPg==/base.apk"],nativeLibraryDirectories=[/data/app/com.appium_new-0MtEr8TXu2cbQ_krT1jqPg==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:6669) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 15 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatActivity" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.appium_new-0MtEr8TXu2cbQ_krT1jqPg==/base.apk"],nativeLibraryDirectories=[/data/app/com.appium_new-0MtEr8TXu2cbQ_krT1jqPg==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 18 more
After adding library gradle haven't synced properly so it's showing the error, "Didn't find class '.MainActivity' ":
The main problem is some gradle files have same internal files like:-
implementation files('src/libs/okhttp-3.11.0.jar')
implementation files('src/libs/okio-1.14.0.jar')
or
implementation files('src/libs/commons-lang3-3.9.jar')
implementation files('src/libs/commons-lang3-3.9-sources.jar')
implementation files('src/libs/commons-lang3-3.9-tests.jar')
so it's not syncing successfully ,
Or second option is to use gradle versions like
implementation("com.squareup.okhttp3:okhttp:4.2.2")
implementation 'com.github.apache:commons-lang:LANG_3_8_1_RC1'
and put version according to your need...
The main problem is ClassNotFoundException so check on this link there have given many solution. use it and see what work with your project.

How to fix java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq

I'm having NoClassDefFoundException issue on my react-native project (on iOS it works properly) that causes my app to crash on launch.
The project was going well, and I don't mind to have changed anything that could affect my build.gradle.
Anyway this is the full stacktrace:
Process: com.managerapp, PID: 19695
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6391)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/base.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_resources_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/base.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_dependencies_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_resources_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_0_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_5_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_6_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_7_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_8_apk.apk!/lib/x86, /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_slice_9_apk.apk!/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2) 
at android.app.ActivityThread.installProvider(ActivityThread.java:6391) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853) 
at android.app.ActivityThread.access$1100(ActivityThread.java:199) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:6669) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.managerapp-_FOS3p5iYciVleWS2bBgrQ==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
05-01 15:02:01.251 19695-19695/com.managerapp E/AndroidRuntime: at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
... 8 more
The following are my build.gradle dependencies:
builde.gradle
dependencies {
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = '15.0.1'
def googlePlayServicesVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
compile project(':tipsi-stripe')
compile project(':react-native-vector-icons')
compile project(':react-native-gesture-handler')
compile project(':react-native-camera')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.android.support:support-v4:27.1.1"}
The following are the build.gradle of project I reference in my app:
react-native-camera
dependencies {
compileOnly 'com.facebook.react:react-native:+'
compileOnly 'com.facebook.infer.annotation:infer-annotation:+'
implementation "com.google.zxing:core:3.3.0"
implementation "com.drewnoakes:metadata-extractor:2.9.1"
implementation "com.google.android.gms:play-services-vision:${safeExtGet('googlePlayServicesVersion', '15.0.1')}"
implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '27.1.0')}"
implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '27.1.0')}"
implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '27.1.0')}"
}
tsipi-stripe
dependencies {
def firebaseVersion = project.hasProperty('firebaseVersion') ? project.firebaseVersion : DEFAULT_FIREBASE_MESSAGING_VERSION
def googlePlayServicesVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.facebook.react:react-native:+'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile "com.google.android.gms:play-services-wallet:15.0.1"
compile "com.google.firebase:firebase-core:11.8.0"
compile 'com.stripe:stripe-android:8.1.0'
compile 'com.github.tipsi:CreditCardEntry:1.5.0'
}
Any suggestions on how to solve the problem?
Thank you
Change this:
compile "com.google.firebase:firebase-core:11.8.0"
into this:
compile "com.google.firebase:firebase-core:16.0.8"

Categories

Resources