Didn't find class "com.google.android.gms.common.app.GmsApplication" - java

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.

Related

How to avoid appcrashes in Android 9 with AmazonSNSClient?

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

Silent install APK programmatically

Sorry for my poor English. I want to figure out how to install (or delete) APK file silently without root programmatically.
First of all I added android:sharedUserId="android.uid.system" to manifest, and permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.INSTALL_PACKAGES"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" tools:ignore="ProtectedPermissions"/>
Code of installing and deleting
public void installApp(File file){
try {
final String command = "pm install " + file.getPath();
Process proc = Runtime.getRuntime().exec(new String[] {command });
proc.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
public void deleteApp(String appPackage){
try {
final String command = "pm uninstall " + appPackage;
Process proc = Runtime.getRuntime().exec(new String[] {command });
proc.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
And as I know I need manufacturer keys to sign my App. I didn't found keys for Android Studio emulators, so for example I downloaded an image of Android 4.4 r2 from here http://www.android-x86.org/releases/releasenote-4-4-r2 (and mount it in Oracle VM) and got keys from here https://sourceforge.net/p/android-x86/build/ci/android-x86-4.4-r2/tree/target/product/security/ .As I understood platform.x509.pem and platform.pk8 are keys what I needed.
I signed my App with signapk.jar something like this java -jar signapk.jar platform.x509.pem platform.pk8 app.apk signapp.apk.
But it doesn't work. Some of attempts ended with error:
Uninstall
07-30 04:42:46.050 1477-1477/com.jinga.jihome W/System.err: java.io.IOException: Error running exec(). Command: [pm uninstall ru.bogdanov.mom] Working Directory: null Environment: null
at java.lang.ProcessManager.exec(ProcessManager.java:211)
07-30 04:42:46.060 1477-1477/com.jinga.jihome W/System.err: at java.lang.Runtime.exec(Runtime.java:173)
at java.lang.Runtime.exec(Runtime.java:128)
at com.jinga.jihome.updater.packageInstaller.PackageInstallerHelper.deleteApp(PackageInstallerHelper.java:59)
at com.jinga.jihome.MainActivity.onCreate(MainActivity.java:102)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
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:779)
07-30 04:42:46.070 1477-1477/com.jinga.jihome W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.IOException: Permission denied
at java.lang.ProcessManager.exec(Native Method)
at java.lang.ProcessManager.exec(ProcessManager.java:209)
Install
07-30 04:42:49.420 1477-1477/com.jinga.jihome W/System.err: java.io.IOException: Error running exec(). Command: [pm install /storage/sdcard/app-debug.apk] Working Directory: null Environment: null
at java.lang.ProcessManager.exec(ProcessManager.java:211)
at java.lang.Runtime.exec(Runtime.java:173)
07-30 04:42:49.430 1477-1477/com.jinga.jihome W/System.err: at java.lang.Runtime.exec(Runtime.java:128)
at com.jinga.jihome.updater.packageInstaller.PackageInstallerHelper.installApp(PackageInstallerHelper.java:49)
at com.jinga.jihome.MainActivity$2.onSuccess(MainActivity.java:135)
at com.jinga.jihome.MainActivity$2.onSuccess(MainActivity.java:126)
at io.reactivex.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:81)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
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:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.IOException: No such file or directory
at java.lang.ProcessManager.exec(Native Method)
at java.lang.ProcessManager.exec(ProcessManager.java:209)
Some of signed apks doesn't want to install with error like App conflicts with existing package by the same nameor what my device not incompatible for this Apk, but without signing all ok.
I've tried with different images, key pairs and emulators, but not succeed, what I did wrong?
I too have an app which installs and updates apks on client devices.
It is also signed with the platform signing keys which means we have permission to install this on their players!
On Android 8.x I've had to set
android:sharedUserId="android.uid.shell"
in the to make it work. I'm using the command:
File localApk = new File("apkName.apk");
String[] Commands = {"pm", "install", "-r", localApk.getAbsolutePath()};
Runtime.getRuntime().exec(Commands);
Without the shareUserId being set I always got permission errors.
Permissions defined in app's manifest have nothing to do with shell commands. They guard the Java API.
DELETE_PACKAGES permission guards the PackageManager#deletePackage method. It's not part of the public SDK so you'll have to access it using reflection (or compile your app against unhidden android.jar).
The reflection path
You'll need to copy this interface to your project:
package android.content.pm;
interface IPackageDeleteObserver {
void packageDeleted(String packageName, int returnCode);
}
Then call the deletePackage method using reflection. Here's a sample in Kotlin:
private val deletePackageMethod = PackageManager::class.java.getDeclaredMethod(
"deletePackage",
String::class.java,
IPackageDeleteObserver::class.java,
Int::class.javaPrimitiveType
)
#RequiresPermission(Manifest.permission.DELETE_PACKAGES)
fun PackageManager.deletePackage(
packageName: String,
observer: IPackageDeleteObserver,
flags: Int
) {
deletePackageMethod.invoke(this, packageName, observer, flags)
}
You can find the flags and return codes in PackageManager source code as constants prefixed with DELETE_.
So far this is all tested and verified.
Notes: Reflection is extra work, so we do the method lookup only once. The method is hidden but public so you don't need to call setAccessible(true).
Warning: Please test this on Android 9, I can't guarantee this works with the ban on accessing hidden API. I think since your app is signed with the system signature and runs as the system user, it should have no problem.
The unhide path
If you compile against the modified android.jar you can directly reference types mentioned above.
The only problem I encountered was that gradle task mockableAndroidJar is not compatible with modified android.jar. You'll have to exclude that task from execution by adding -x mockableAndroidJar to gradle command line in the IDE.
I haven't actually tried it, I can't tell you if the IDE will let you any further.

java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.zzbo

I know this question may be duplicate but I have tried many solutions but I am unable to make my app work. It should be noted that I have enabled Multidex but still getting below error. I am creating a react native app.
FATAL EXCEPTION: main
Process: com.xxxxxx.yyyyyyyy, PID: 3978
java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.zzbo
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5049)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
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:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
If you are developing a react native application and above error came , just make sure that all of your dependencies's Gradle are using same version of firebase servces and play service base.
For example :- my app level gradle file contains
compile "com.google.android.gms:play-services-base:11.4.0"
compile "com.google.firebase:firebase-core:11.4.0"
compile "com.google.firebase:firebase-messaging:11.4.0"
compile "com.google.firebase:firebase-analytics:11.4.0"
compile "com.google.firebase:firebase-crash:11.4.0"
compile "com.google.firebase:firebase-ads:11.4.0"
and one react-native library is using
compile "com.google.android.gms:play-services-base:11.8.0"
and other one library is using
compile "com.google.android.gms:play-services-base:+"
so what i did , i changed all services version to 11.8.0.
BTW you can see gradles of all libraries or dependencies when you open your react-native-project/android folder in Android studio
I hope this will solve your issue

Android Studio with Galaxy S7 - Android 7.0

I'm trying to debug with Androd Studio 2.3.1 an app (min sdk 16, target sdk 24) with a Samsung Galaxy S7 (Android 7.0 installed), but I get the following exception and the app stops:
com.venework.app.venework E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.venework.app.venework, PID: 3556
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.venework.app.venework/com.venework.app.venework.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.venework.app.venework.MainActivity" on path: DexPathList[[zip file "/data/app/com.venework.app.venework-1/base.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_9_apk.apk"],
nativeLibraryDirectories=[/data/app/com.venework.app.venework-1/lib/arm64, /system/lib64, /vendor/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2844)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.venework.app.venework.MainActivity" on path: DexPathList[[zip file "/data/app/com.venework.app.venework-1/base.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.venework.app.venework-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.venework.app.venework-1/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
If I test with any other device everything is ok... any hint ? I have run out of options. Thank you
SOLUTION
The splash-screen image was in the wrong folder. drawable instead of drawable-xxhdpi... really a stupid problem.... with devices with low resolution displays it didn't make any difference, but with a high-res display like that of the Samsung S7 is completely another story...

Android Studio Errors moments after new project creation

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.

Categories