简体   繁体   English

没找到上课“com.google.android.gms.common.app.GmsApplication”

[英]Didn't find class “com.google.android.gms.common.app.GmsApplication”

I have got a problem when running my app on Android 4.4 with Google Play Services version 100884030. I get the following error: 我在使用Google Play服务版本100884030在Android 4.4上运行我的应用时出现问题。我收到以下错误:

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: 我的Gradle设置:

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? 所以你看到了什么问题?

Thanks !!! 谢谢 !!!

I had an identical problem, I think, and it turned out that the .apk on the device was corrupted. 我认为我有一个相同的问题,结果证明设备上的.apk已损坏。 Maybe by an internal flash storage (hardware) problem? 可能是内部闪存(硬件)问题?

This is what I did: 这就是我做的:

  1. Turn on Developer Settings on the device (by tapping the Build Number seven times in the About screen of Settings). 打开设备上的“开发人员设置”(通过在“设置”的“关于”屏幕中点击内置编号七次)。
  2. From the Developer Settings menu that appeared, turn on USB Debugging. 从出现的“开发人员设置”菜单中,打开“USB调试”。
  3. Connect to a PC with adb installed. 连接到安装了adb的PC。
  4. Find the path of the existing Google Play Services apk on the device, with adb shell pm path com.google.android.gms 使用adb shell pm path com.google.android.gms在设备上查找现有Google Play Services apk的adb shell pm path com.google.android.gms
  5. Use that path to pull the existing apk from the device, to check it, with adb pull /data/app/com.google.android.gms-1/base.apk (replace the path here with what you got at point 4). 使用该路径从设备中提取现有的apk,然后使用adb pull /data/app/com.google.android.gms-1/base.apk进行检查(将此处的路径替换为您在第4点获得的路径) 。
  6. Check if the apk is broken, by changing its extension to .zip, and doing a zip integrity test. 通过将其扩展名更改为.zip并执行zip完整性测试来检查apk是否已损坏。 In my case it said classes2.dex bad CRC . 在我的情况下,它说classes2.dex bad CRC
  7. Download a good apk from somewhere trusted. 从某个受信任的地方下载一个好的apk。 Another identical device would be perfect, but I didn't have one, so I got mine from apkmirror.com (make sure you pick the right variant, there are a number of them for the same version number). 另一个相同的设备将是完美的,但我没有一个,所以我从apkmirror.com得到了我的(确保你选择了正确的变体,其中有相同的版本号)。 The one I downloaded had the same number of bytes as the one pulled from the phone, but a segment of data inside was different. 我下载的那个字节与从手机中提取的字节数相同,但内部的一段数据不同。
  8. Install the downloaded apk with adb install -r <downloaded file> . 使用adb install -r <downloaded file>安装下载的apk。
  9. Reboot the device. 重启设备。

That's it. 而已。 Everything worked after this. 一切都在这之后奏效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法实例化com.google.android.gms.common.app.GmsApplication应用程序 - Unable to instantiate application com.google.android.gms.common.app.GmsApplication ClassNotFoundException找不到类“ com.google.android.gms.common.internal.zzbq - ClassNotFoundException Didn't find class "com.google.android.gms.common.internal.zzbq 放置自动完成未找到类“ com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable” - Places AutoComplete Didn't find class “com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable” 原因:java.lang.ClassNotFoundException:找不到类“ com.google.android.gms.common.internal.zzbq” - Caused by: java.lang.ClassNotFoundException: Didn't find class “com.google.android.gms.common.internal.zzbq” 将 targetSdkVersion 提高到 28 时,在路径上找不到类“com.google.android.gms.common.R$string”:DexPathList - When raising targetSdkVersion to 28, Didn't find class "com.google.android.gms.common.R$string" on path: DexPathList 谷歌地图没有找到类“com.google.android.gms.dynamic.zza” - Google Maps Didn't find class "com.google.android.gms.dynamic.zza" 由java.lang.ClassNotFoundException引起找不到类“ com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver - Caused by java.lang.ClassNotFoundException Didn't find class "com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver java.lang.ClassNotFoundException:未找到类“com.google.android.gms.ads.MobileAdsInitProvider” - java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAdsInitProvider" ClassNotFoundException:未找到类“com.google.android.gms.ads.AdView” - ClassNotFoundException: Didn't find class “com.google.android.gms.ads.AdView” Android Google Play服务错误:在路径dexpathlist上找不到类com.google.android.gms.maps.mapfragment - Android Google Play Services error: didn't find class com.google.android.gms.maps.mapfragment on path dexpathlist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM