In Android 9 (API 28) my App crashes when creating a new AmazonSNSClient (in API 26 I don't get any errors):
AmazonSNSClient pushClient = new AmazonSNSClient(credentialsProvider);
My LogCat says:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory;
at com.amazonaws.AmazonWebServiceClient.<clinit>(AmazonWebServiceClient.java:55)
at myapp.service.AWSMessagingService.createEndpoint(AWSMessagingService.java:170)
at myapp.service.AWSMessagingService.registerWithSNS(AWSMessagingService.java:103)
at myapp.service.PushNotificationService.sendRegistrationToAWS(PushNotificationService.java:109)
at myapp.service.PushNotificationService.onNewToken(PushNotificationService.java:105)
at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:86)
at com.google.firebase.iid.zzg.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.logging.LogFactory" on path: DexPathList[[zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/base.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_dependencies_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_resources_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_0_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_1_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_2_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_3_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_4_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_5_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_6_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_7_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_8_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/base.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_dependencies_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_resources_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_0_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_5_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_6_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_7_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_8_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/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.amazonaws.AmazonWebServiceClient.<clinit>(AmazonWebServiceClient.java:55)
at myapp.service.AWSMessagingService.createEndpoint(AWSMessagingService.java:170)
at myapp.service.AWSMessagingService.registerWithSNS(AWSMessagingService.java:103)
at myapp.service.PushNotificationService.sendRegistrationToAWS(PushNotificationService.java:109)
at myapp.service.PushNotificationService.onNewToken(PushNotificationService.java:105)
at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:86)
at com.google.firebase.iid.zzg.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
2018-12-17 09:25:07.483 10291-10344/myapp E/AndroidRuntime: Suppressed: java.io.IOException: No original dex files found for dex location /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
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)
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 found out that I can avoid the error if I don't exclude "commons-logging" from "com.amazonaws:aws-android-sdk-sns" in my build.gradle, so I replaced:
implementation 'com.amazonaws:aws-android-sdk-sns:2.2.0', {
exclude module: 'commons-logging'
}
with:
implementation 'com.amazonaws:aws-android-sdk-sns:2.2.0'
The app works fine now but I can't build a signed APK because I get
the error "DuplicatePlatformClasses: Duplicate Platform Classes" and
my Lint Report says:
commons-logging defines classes that conflict with classes now
provided by Android. Solutions include finding newer versions or
alternative libraries that don't have the same problem (for example,
for httpclient use HttpUrlConnection or okhttp instead), or
repackaging the library using something like jarjar. There are a
number of libraries that duplicate not just functionality of the
Android platform but using the exact same class names as the ones
provided in Android -- for example the apache http classes. This can
lead to unexpected crashes.
To solve this, you need to either find a newer version of the library
which no longer has this problem, or to repackage the library (and all
of its dependencies) using something like the jarjar tool, or finally,
rewriting the code to use different APIs (for example, for http code,
consider using HttpUrlConnection or a library like okhttp). Note: This
issue has an associated quickfix operation in Android Studio and
IntelliJ IDEA. To suppress this error, use the issue id
"DuplicatePlatformClasses" as explained in the Suppressing Warnings
and Errors section.
So I ran "gradlew app:dependencies > dependencies.txt" in the terminal in my project folder and found out that "com.amazonaws:aws-android-sdk-sns:2.2.0" uses "commons-logging:commons-logging:1.1.1" but I can also find "commons-logging:commons-logging:1.2" which is "provided by Android" I guess?
So why does "com.amazonaws:aws-android-sdk-sns:2.2.0" not use "commons-logging:commons-logging:1.2" if I exclude "commons-logging:commons-logging:1.1.1" and how can I fix this issue?
I could solve the error by updating "com.amazonaws:aws-android-sdk-sns:2.2.0" to a newer version (in my case "com.amazonaws:aws-android-sdk-sns:2.9.1").
The NoClassDefFoundError in Android 9 is also tracked in this issue:
https://github.com/aws-amplify/aws-sdk-android/issues/476
Related
I cant solve this bug for many days. It happens only when I connect firebase realtime database.
Process: com.bae.dialogflowbot, PID: 4982
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/~~RkMsTUa-PZYOQLsQ7fP8Uw==/com.bae.dialogflowbot-m8QxV2lnB1WTxOUZJ-hy0w==/base.apk"],nativeLibraryDirectories=[/data/app/~~RkMsTUa-PZYOQLsQ7fP8Uw==/com.bae.dialogflowbot-m8QxV2lnB1WTxOUZJ-hy0w==/lib/x86, /system/lib, /system_ext/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:7244)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
**Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[**[zip file "/data/app/~~RkMsTUa-PZYOQLsQ7fP8Uw==/com.bae.dialogflowbot-m8QxV2lnB1WTxOUZJ-hy0w==/base.apk"],nativeLibraryDirectories=[/data/app/~~RkMsTUa-PZYOQLsQ7fP8Uw==/com.bae.dialogflowbot-m8QxV2lnB1WTxOUZJ-hy0w==/lib/x86, /system/lib, /system_ext/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
I tried this and it seemed to work. Go to your gradle and comment out this line:
implementation platform('com.google.firebase:firebase-bom:29.0.3')
Use this one:
implementation platform('com.google.firebase:firebase-bom:27.0.0')
I had FMS working on one project and tried to fold it back into another, but got the same error. After a bunch of unsuccessful searches, I tried making changes to each setting to mirror the first project and this one seemed to work.
I got this error when we run apk file of our application. In build.gradle we set multidex and compile multidex is existed in Gradle file . We changed the version of Firebase versions to above and below but that's did not work for us . This is our full log in Run console :
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ir.parsinteam.ojoobe, PID: 5141
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
at com.google.android.gms.location.LocationServices.<clinit>(Unknown Source)
at ir.adad.client.LocationMethods.callAndroidLocationService(LocationMethods.java:101)
at ir.adad.client.LocationMethods.<init>(LocationMethods.java:40)
at ir.adad.client.LocationMethods.getInstance(LocationMethods.java:45)
at ir.adad.client.AdadScript.urlParameters(AdadScript.java:390)
at ir.adad.client.AdadScript.downloadClient(AdadScript.java:148)
at ir.adad.client.AdadScript.initializeInternal(AdadScript.java:134)
at ir.adad.client.AdadScript.initializeClient(AdadScript.java:110)
at ir.adad.client.Adad.initialize(Adad.java:22)
at ir.parsinteam.ojoobe.activities.MainActivity.onCreate(MainActivity.java:62)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
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:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/ir.parsinteam.ojoobe-2/base.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_dependencies_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_0_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_1_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_2_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_3_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_4_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_5_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_6_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_7_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_8_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/ir.parsinteam.ojoobe-2/lib/x86, /data/app/ir.parsinteam.ojoobe-2/base.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_dependencies_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_0_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_1_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_2_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_3_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_4_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_5_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_6_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_7_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_8_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_9_apk.apk!/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 com.google.android.gms.location.LocationServices.<clinit>(Unknown Source)
at ir.adad.client.LocationMethods.callAndroidLocationService(LocationMethods.java:101)
at ir.adad.client.LocationMethods.<init>(LocationMethods.java:40)
at ir.adad.client.LocationMethods.getInstance(LocationMethods.java:45)
at ir.adad.client.AdadScript.urlParameters(AdadScript.java:390)
at ir.adad.client.AdadScript.downloadClient(AdadScript.java:148)
at ir.adad.client.AdadScript.initializeInternal(AdadScript.java:134)
at ir.adad.client.AdadScript.initializeClient(AdadScript.java:110)
at ir.adad.client.Adad.initialize(Adad.java:22)
at ir.parsinteam.ojoobe.activities.MainActivity.onCreate(MainActivity.java:62)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
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:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Application terminated.
In your build.gradle, upgrade play-services-gcm and play-services-location to 15.0.1:
com.google.android.gms:play-services-gcm:15.0.1
com.google.android.gms:play-services-location:15.0.1
This is happen when we try to authenticate user with some authenticate service like AccountKit FirebaseAuth and those service depends on play-services-auth So, Add
implementation 'com.google.android.gms:play-services-auth:16.0.0'
on your build.gradle dependencies
I fixed this issue. Please follow below code.
Added following to android/build.gradle
allprojects {
repositories {
//start here
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.google.android.gms') {
details.useVersion '12.0.1'
}
if (requested.group == 'com.google.firebase') {
details.useVersion '12.0.1'
}
}
}
//end
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Well, I am using Account Kit from Facebook. After I adding play-services-auth problem is resolved.
implementation 'com.facebook.android:account-kit-sdk:4.39.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
I was using a react native package
react-native-facebook-account-kit
resolved by adding
implementation 'com.google.android.gms:play-services-auth:16.0.1'
For me i tried adding implementation 'com.google.android.gms:play-services-auth:18.0.0'
didnot work for me..
But after adding the below dependency it worked for me.
implementation 'com.android.support:multidex:1.0.3'
I was having this issue when i enabled proguard, when i'm disabling it I don't get the crash. I fixed it by adding following dependencies in my app level gradle. I have used FCM, Firebase Analytics and google location in my app. So I had to add the following, if u r not using anything then skip it.
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.firebase:firebase-messaging:20.2.0'
implementation 'com.google.firebase:firebase-analytics:17.4.3'
Also add the following in your proguard rules file.
-dontshrink
-dontoptimize
-dontwarn
-dontpreverify
I have got a problem when running my app on Android 4.4 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?
Thanks !!!
I had an identical problem, I think, and it turned out that the .apk on the device was corrupted. Maybe by an internal flash storage (hardware) problem?
This is what I did:
Turn on Developer Settings on the device (by tapping the Build Number seven times in the About screen of Settings).
From the Developer Settings menu that appeared, turn on USB Debugging.
Connect to a PC with adb installed.
Find the path of the existing Google Play Services apk on the device, with adb shell pm path com.google.android.gms
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).
Check if the apk is broken, by changing its extension to .zip, and doing a zip integrity test. In my case it said classes2.dex bad CRC.
Download a good apk from somewhere trusted. 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). 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.
Install the downloaded apk with adb install -r <downloaded file>.
Reboot the device.
That's it. Everything worked after this.
I am try to create a simple hello world app for android. I created a new android project, with blank activity, the first thing I see is:
Error:(1, 0) Plugin is too old, please update to a more recent
version, or set ANDROID_DAILY_OVERRIDE environment variable to
"df94d6841b68f9e80ddebea52ebc092b1d66cb93" Fix plugin version and sync projectOpen
File
This I fixed after changing gradle wrapper properties to https://services.gradle.org/distributions/gradle-2.11-all.zip (it was 2.8 earlier)
Then I changed com.android.tools.build:gradle:2.0.0-alpha2 to beta2.
Atleast the gradle sync worked, so I decided to run the project. It compiled, pushed the apk to my device, followed by this crash :
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.poketpixels.gcmfinal.MainActivity" on path: DexPathList[[zip file
"/data/app/com.poketpixels.gcmfinal-1/base.apk"],nativeLibraryDirectories=[/vendor/lib,
/system/lib]]
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2259)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2420)
at android.app.ActivityThread.access$900(ActivityThread.java:154)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5294)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Suppressed: java.lang.ClassNotFoundException:
com.poketpixels.gcmfinal.MainActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the
boot class loader; no stack available
Why are there gradle version conflicts just after I create a fresh
project.
Why are there app crashes too ?
First disconnect from a network before starting your android studio. After it's started you can now connect back to a network and update your sdk's.
Then take a cup of coffee.
I'm using Unity5, JDK 1.8 and I'm building for min android sdk = 10 and max = 22.
I can do a development build without any problems but when I'm trying to create an .apk file for the Google Play Store I get an error.
Error log:
CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
F:/Java/JDK\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="F:/Android/SDK\tools" -Dfile.encoding=UTF8 -jar "F:/Programs/Unity5/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
stderr[
UNEXPECTED TOP-LEVEL EXCEPTION:
java.util.zip.ZipException: zip file is empty
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:220)
at java.util.zip.ZipFile.<init>(ZipFile.java:150)
at java.util.zip.ZipFile.<init>(ZipFile.java:164)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at SDKMain.main(SDKMain.java:129)
1 error; aborting
]
And then a lot of lines that go like "processnig [path to .class file]".
I've tried switching to JDK 1.7 but to no avail.
I think I've eliminated the possibility of the multiple plugin error as there are no duplicate .jar's.
Any ideas what's causing this?
Solved!
For some reason the classes.jar file in the Unity program folder was corrupted, I replaced it with the one I had in my Android Studio project and now it works.
try this instead.
In my projects there were two androidAppCompact files were there 1.0.6 and 1.0.7. I deleted 1.0.6 and now its working fine