When I try to update my targetSdkVersion
from 27 to 28, I get the error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.baus_systems.inventorycount, PID: 2594
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/R$string;
at com.google.android.gms.common.internal.StringResourceValueReader.<init>(Unknown Source:4)
at com.google.firebase.FirebaseOptions.fromResource(com.google.firebase:firebase-common@@19.0.0:156)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:240)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.0.0:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1922)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1897)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.0.0:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:6708)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6255)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6151)
at android.app.ActivityThread.access$1100(ActivityThread.java:208)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:205)
at android.app.ActivityThread.main(ActivityThread.java:6991)
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:884)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.R$string" on path: DexPathList[[zip file "/data/app/com.baus_systems.inventorycount-y-SEoNnBinme-b9ebwn0xg==/base.apk"],nativeLibraryDirectories=[/data/app/com.baus_systems.inventorycount-y-SEoNnBinme-b9ebwn0xg==/lib/arm, /data/app/com.baus_systems.inventorycount-y-SEoNnBinme-b9ebwn0xg==/base.apk!/lib/armeabi-v7a, /system/lib, /product/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.android.gms.common.internal.StringResourceValueReader.<init>(Unknown Source:4)
at com.google.firebase.FirebaseOptions.fromResource(com.google.firebase:firebase-common@@19.0.0:156)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:240)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.0.0:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1922)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1897)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.0.0:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:6708)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6255)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6151)
at android.app.ActivityThread.access$1100(ActivityThread.java:208)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:205)
at android.app.ActivityThread.main(ActivityThread.java:6991)
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:884)
This is the dependencies section of my build.gradle:
dependencies {
def lifecycle_version = "1.1.1"
// def multidex_version = "2.0.1"
// implementation 'androidx.multidex:multidex:2.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.annotation:annotation:1.0.2'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
testImplementation 'junit:junit:4.12'
implementation('androidx.constraintlayout:constraintlayout:1.1.3')
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'com.google.firebase:firebase-ml-vision:18.0.2'
implementation 'com.google.firebase:firebase-ml-vision-image-label-model:17.0.2'
implementation 'com.google.firebase:firebase-ml-model-interpreter:16.2.4'
implementation 'com.drewnoakes:metadata-extractor:2.11.0'
// AWS Mobile Client
implementation('com.amazonaws:aws-android-sdk-mobile-client:2.6.+@aar') { transitive = true }
// AWS Core
implementation('com.amazonaws:aws-android-sdk-core:2.3.+')
// AWS S3
implementation('com.amazonaws:aws-android-sdk-s3:2.3.+')
// AWS Cognito
implementation('com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.3.+')
implementation 'com.amazonaws:aws-android-sdk-cognitoauth:2.4.7@aar'
//AWS Lambda
implementation('com.amazonaws:aws-android-sdk-lambda:2.2.+')
implementation project(':plugin')
}
I have tried updating the firebase dependencies to the latest versions (which required updating the minSdkVersion from 15 to 16), which has no effect (and I'm not sure whether this is a viable option, as I seem to remember my coworker saying something about barcode scanning not being supported if I take these versions too high). Updating all dependencies has the app crash with no error, and I haven't yet figured out which ones are to blame; I decided I would focus on this issue as much as possible instead of inviting more trouble without reason. I've tried enabling multidex a couple different ways, as I saw that suggested somewhere; none of them seem to help. There are a few other things I've tried as well, and have lost the pages for, but nothing I've tried has helped.
Any help in resolving this error would be appreciated, as I cannot update the app in the Play Store until I can upgrade to 28.