Failed resolution of: Lcom/google/android/gms/common/internal/zzbq; - java

I have checked previous questions on here and it seems to be conflicting dependencies however i can't seem to find the error
Error
06-23 16:41:14.542 7770-7770/net.simplifiedlearning.firebaseauth E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.simplifiedlearning.firebaseauth, PID: 7770
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.storage.FirebaseStorage.getInstance(Unknown Source:11)
at net.simplifiedlearning.firebaseauth.ProfileActivity.uploadImageToFirebaseStorage(ProfileActivity.java:250)
at net.simplifiedlearning.firebaseauth.ProfileActivity.onActivityResult(ProfileActivity.java:240)
at android.app.Activity.dispatchActivityResult(Activity.java:7235)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4335)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4382)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1654)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:251)
at android.app.ActivityThread.main(ActivityThread.java:6572)
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.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/net.simplifiedlearning.firebaseauth-kxzC1xsQNY2FvbVhXuPXPg==/base.apk"],nativeLibraryDirectories=[/data/app/net.simplifiedlearning.firebaseauth-kxzC1xsQNY2FvbVhXuPXPg==/lib/arm64, /system/lib64, /system/vendor/lib64]]
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 com.google.firebase.storage.FirebaseStorage.getInstance(Unknown Source:11) 
at net.simplifiedlearning.firebaseauth.ProfileActivity.uploadImageToFirebaseStorage(ProfileActivity.java:250) 
at net.simplifiedlearning.firebaseauth.ProfileActivity.onActivityResult(ProfileActivity.java:240) 
at android.app.Activity.dispatchActivityResult(Activity.java:7235) 
at android.app.ActivityThread.deliverResults(ActivityThread.java:4335) 
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4382) 
at android.app.ActivityThread.-wrap19(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1654) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:251) 
at android.app.ActivityThread.main(ActivityThread.java:6572) 
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) 
Build.gradle Module:app
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "net.simplifiedlearning.firebaseauth"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.android.support:support-vector-drawable:27.1.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.android.support:appcompat-v7:26.1.1'
implementation 'com.android.support:design:26.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
//maps
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-ads:15.0.1'
//personal firebase database
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
implementation 'com.android.support:multidex:1.0.3'
api 'com.google.firebase:firebase-messaging:17.0.0'
}
//apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
And here's my build.gradle Project: appname:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The build is successful however it crashes when i try to select an image for my profile which is linked to firebase.

Not sure if it will work, but try adding following to your gradle.properties-file:
googlePlayServicesVersion=11.0.4
Worked for me when I had the same error.

Related

unable to add Firebse to my android studio

I am trying to add firebase to my app and followed every step as told in https://firebase.google.com/docs/android/setup
but as soon as a launch the app it crashes with the error
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.examplefirestore, PID: 29977
java.lang.BootstrapMethodError: Exception from call site #8 bootstrap method
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
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.ClassCastException: Bootstrap method returned null
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112) 
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1894) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45) 
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) 
I have also cross checked my gradle moudle and every thing seems to be fine, here is my gradle module
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.example.examplefirestore"
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:28.1.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-firestore'
}
Even in graple project everything seems to be ok to me i have cross checked this multiple times, this is my gradle project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.2"
classpath 'com.google.gms:google-services:4.3.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
It seems like you are missing
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
in your build.gradle (app).

java.lang.BootstrapMethodError: Exception from call site #8 bootstrap method

I am facing the following error in Android Studio:
Logcat:
java.lang.BootstrapMethodError: Exception from call site #8 bootstrap method
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
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.ClassCastException: Bootstrap method returned null
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112) 
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267) 
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1894) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45) 
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)
Build.gradle (app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.easytaxi"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation platform('com.google.firebase:firebase-bom:28.0.0')
implementation 'com.google.android.material:material:1.3.0'
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation 'com.google.firebase:firebase-auth:21.0.0'
implementation 'com.google.firebase:firebase-database:20.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.firebase:geofire-android:3.1.0'
implementation 'com.github.d-max:spots-dialog:1.1#aar'
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'
}
build.gradle (Project)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.google.gms:google-services:4.3.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add the following to your build.gradle
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

Migration to AndroidX causes java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/appcompat/app/NotificationCompat$Builder

In my android application I am using ROS. One of the dependencies that is included with that is org.ros.android_core:android_10:0.3.3. I mention this because it seems that there is a problem with one of the classes in this jar file: namely org/ros/android/NodeMainExecutorService.class.
The reason for this is that when I run my application, the following error shows up:
2019-05-08 11:10:41.980 10740-10747/? E/art: Failed sending reply to debugger: Broken pipe
2019-05-08 11:10:42.829 10740-10740/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: robot.fsrt.robotguest, PID: 10740
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/appcompat/app/NotificationCompat$Builder;
at org.ros.android.NodeMainExecutorService.onStartCommand(NodeMainExecutorService.java:214)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3326)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1582)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.app.NotificationCompat$Builder" on path: DexPathList[[zip file "/data/app/robot.fsrt.robotguest-2/base.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_dependencies_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_0_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_1_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_2_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_3_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_4_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_5_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_6_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_7_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_8_apk.apk", zip file "/data/app/robot.fsrt.robotguest-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/robot.fsrt.robotguest-2/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at org.ros.android.NodeMainExecutorService.onStartCommand(NodeMainExecutorService.java:214) 
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3326) 
at android.app.ActivityThread.-wrap21(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1582) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119)
On line NodeMainExecutorService.java:214 class NotificationCompat.Builder is being instanciated;
androidx.appcompat.app.NotificationCompat.Builder builder = new androidx.appcompat.app.NotificationCompat.Builder(this);
While the folder androidx.appcompat.app does exist(within androidx.appcompat:appcompat:1.1.0-alpha04), NotificationCompat.Builder is not in there.
Gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 28
defaultConfig {
applicationId "robot.fsrt.robotguest"
minSdkVersion 25
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion = '28.0.3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('org.ros.android_core:android_10:[0.3, 0.4)') {
exclude group: 'junit'
exclude group: 'xml-apis'
}
// e.g. official msgs
implementation 'org.ros.rosjava_messages:std_msgs:0.5.11'
implementation 'org.ros.rosjava_messages:sensor_msgs:1.12.7'
implementation 'org.ros.rosjava_messages:geometry_msgs:1.12.7'
implementation 'org.ros.rosjava_bootstrap:message_generation:0.3.3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
implementation "androidx.preference:preference:1.1.0-alpha04"
implementation "androidx.core:core:1.1.0-beta01"
implementation 'com.google.code.gson:gson:2.8.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.27.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
repositories {
mavenCentral()
}
So the problem is that androidx.appcompat.app.NotificationCompat.Builder that is defined within a ROS library org.ros.android_core:android_10:0.3.3 could not be found. How can I solve this?
EDIT: I found out that NotificationCompat is part of another extension library (androidx.core:core:1.1.0-beta01) where it is headed in package androidx.core.app instead of androidx.appcompat.app
EDIT 2: I also found out that in an older working version the class was not found either. But it did run on my device...
EDIT 3: I found out that the problem occurs when I migrate the code to AndroidX. But I am not sure yet why this issue is caused by this action.

After Android API 28 update, getting: Error while merging dex archives

I'm trying to move my Android app to API 28 (Android 9/P)
I'm getting 5 errors that I can't fix.I'm still relatively new to Android development and I think, I might not have the best updating approach.
I've already tried to clean and rebuild but the problem is still happening.
Here is my project gradle:
buildscript {
ext.kotlin_version = '1.2.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.1.0'
classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.realm:realm-gradle-plugin:5.4.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here's my application gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'
android {
lintOptions {
checkReleaseBuilds false
}
compileSdkVersion 28
defaultConfig {
applicationId "org.siku.siku"
minSdkVersion 21
targetSdkVersion 28
versionCode 118
versionName "1.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //important
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude module: 'support-annotations'
})
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0-rc01'
implementation 'androidx.core:core-ktx:1.0.0-rc01'
implementation 'androidx.exifinterface:exifinterface:1.0.0-rc01'
implementation 'androidx.vectordrawable:vectordrawable:1.0.0-rc01'
implementation 'androidx.cardview:cardview:1.0.0-rc01'
implementation 'androidx.browser:browser:1.0.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.amitshekhar.android:android-networking:1.0.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'joda-time:joda-time:2.9.9'
implementation 'info.hoang8f:android-segmented:1.0.6'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'com.facebook.android:facebook-android-sdk:4.35.0'
implementation files('libs/CircleImageView-master/gradle/wrapper/gradle-wrapper.jar')
implementation 'org.greenrobot:eventbus:3.1.1'
testImplementation 'org.mockito:mockito-core:2.8.9'
testImplementation 'junit:junit:4.12'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
google()
}
I am getting 5 errors:
1- Program type already present: android.support.customtabs.ICustomTabsCallback
2- Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
3- Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
4- Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
5- Caused by: com.android.tools.r8.utils.AbortException
I've been trying to find documentation on the matter.
Any suggestions or links to documentation would be appreciated.
Maybe have you forgotten this: implementation 'com.android.support:multidex:1.0.3' in your dependencies

Didn't find class “com.google.firebase.provider.FirebaseInitProvider, While upgrading the apk from eclipse with studio build

Logs :
B
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.nova.app.check, PID: 28293 java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.nova.app.check-2/base.apk"],nativeLibraryDirectories=[/data/app/com.nova.app.check-2/lib/x86, /system/lib, /vendor/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:5814) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.nova.app.check-2/base.apk"],nativeLibraryDirectories=[/data/app/com.nova.app.check-2/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.ActivityThread.installProvider(ActivityThread.java:5799) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
===
I have enabled the multidex in gradle, my application class is extends with the MultiDexApplication... I have implemented the support multidex library also.......
Once my application is installed successfully,The application starts to crash.
My build.gradle content
apply plugin: 'com.android.application'
android {
aaptOptions {
cruncherEnabled = false
}
lintOptions {
abortOnError false
}
repositories {
mavenCentral()
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
//buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.nova.app.check"
minSdkVersion 19
targetSdkVersion 24
multiDexEnabled true
versionCode 17
versionName "2.0.1"
vectorDrawables.useSupportLibrary = true
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = []
}
buildTypes {
debug {
//minifyEnabled true
//shrinkResources true
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
release {
//minifyEnabled true
//shrinkResources true
//runProguard false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
staging {
// Specifies a sorted list of fallback build types that the
// plugin should try to use when a dependency does not include a
// "staging" build type. You may specify as many fallbacks as you
// like, and the plugin selects the first build type that's
// available in the dependency.
matchingFallbacks = ['debug', 'qa', 'release']
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
// exclude 'META-INF/json.tld'
}
useLibrary 'org.apache.http.legacy'
dexOptions {
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/GraphView-3.0.jar')
implementation files('libs/jWebSocketClientAPI-1.0.jar')
implementation files('libs/jWebSocketCommon-1.0.jar')
implementation files('libs/jWebSocketJavaSEClient-1.0.jar')
implementation files('libs/jackson-core-asl-1.9.3.jar')
implementation files('libs/jackson-mapper-asl-1.9.3.jar')
implementation files('libs/mail.jar')
//implementation files('libs/json-taglib-0.4.1.jar')
implementation files('libs/org.apache.commons.io.jar')
implementation files('libs/org.apache.http.legacy.jar')
implementation files('libs/zip4j_1.3.1.jar')
implementation files('libs/ImageLoader.jar')
//implementation files('libs/itsrts-pptviewer.jar')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.volley:volley:1.0.0'
//noinspection GradleCompatible
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:support-annotations:27.0.3'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.1'
implementation project(path: ':androidTest')
implementation 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
//implementation 'com.google.android.gms:play-services:12.0.1'
//for qr code scanning
implementation 'com.google.android.gms:play-services-vision:12.0.1'
//implementation 'me.dm7.barcodescanner:zxing:1.9'
// migrate from eclipse
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services-places:12.0.1'
implementation files('libs/gcm-server.jar')
implementation files('libs/OneSignalSDK.jar')
//socket connection lib for remoteview
implementation 'com.github.nkzawa:socket.io-client:0.6.0'
implementation "com.squareup.okhttp3:okhttp:3.7.0"
// custom fab
implementation 'com.github.clans:fab:1.6.4'
// butter knife
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//zoom imageView library
implementation 'com.jsibbold:zoomage:1.1.0'
//pdfviewer library
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
// custom images
//implementation 'com.linsea:universalvideoview:1.1.0#aar'
//qr code scan
compile 'com.journeyapps:zxing-android-embedded:3.4.0'
//testing lib
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:+'
implementation 'com.android.support:support-annotations:28.0.0-alpha3'
}
Note : My base application is installed from the eclipse and now >i have upgraded this from the apk generated from studio. My application is a launcher application starts at the boot stage itself.
Uncheck first
Settings → Build, Execution, Deployment → Instant Run and uncheck Enable Instant Run
Then add this code into your build.gradle in module: app inside defaultConfing:
defaultConfig {
....
....
multiDexEnabled = true
}
Add this code into your build.gradle in module: app inside dependencies:
dependencies {
compile 'com.android.support:multidex:1.0.1'
.....
.....
}
Open AndroidManifest.xml and within application:
<application
android:name="android.support.multidex.MultiDexApplication"
.....
.....
</application>
or if you have your Application class, extend it from MultiDexApplication like:
public class MyApp extends MultiDexApplication {
.....
}
Hope this may help to you

Categories

Resources