简体   繁体   中英

Unable to instantiate application com.google.android.gms.common.app.GmsApplication

I have got a problem when running my app on Android 4.4 (on some devices) with Google Play Services version 100884030. I get the following error:

FATAL EXCEPTION: main
Process: com.google.android.gms, PID: 8678
java.lang.RuntimeException: Unable to instantiate application com.google.android.gms.common.app.GmsApplication: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.app.GmsApplication" on path: DexPathList[[zip file "/system/framework/com.android.media.remotedisplay.jar", zip file "/system/framework/com.android.location.provider.jar", zip file "/system/framework/com.google.android.ble.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4301)
    at android.app.ActivityThread.access$1500(ActivityThread.java:135)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5001)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.app.GmsApplication" on path: DexPathList[[zip file "/system/framework/com.android.media.remotedisplay.jar", zip file "/system/framework/com.android.location.provider.jar", zip file "/system/framework/com.google.android.ble.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    at android.app.Instrumentation.newApplication(Instrumentation.java:975)
    at android.app.LoadedApk.makeApplication(LoadedApk.java:502)
    ... 11 more

My Gradle settings:

compileSdkVersion 25
buildToolsVersion "25.0.2"
minSdkVersion 14 
targetSdkVersion 22
....
compile 'com.google.android.gms:play-services-analytics:10.2.1'
compile 'com.google.android.gms:play-services-ads:10.2.1'

So you see what is the problem? How can I solve it?

Thanks !!!

I had the same issue when running the app at Firebase Test Lab, but it's solved after running the tests some minutes later. So, I think that is not related with the app itself, but with the test infrastucture.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM