when i run the app from android studio it runs fine in simulator and device.
but when i share the debug / release version of apk it got crashed when user taps on a app icon.
following the error that i can see in logs
03-11 09:16:12.654 25384-25384/com.microtechnicianapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.microtechnicianapp, PID: 25384
java.lang.RuntimeException: Unable to instantiate application com.microtechnicianapp.App: java.lang.ClassNotFoundException: Didn't find class "com.microtechnicianapp.App" on path: DexPathList[[zip file "/data/app/com.microtechnicianapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.microtechnicianapp-1/lib/x86, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.microtechnicianapp.App" on path: DexPathList[[zip file "/data/app/com.microtechnicianapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.microtechnicianapp-1/lib/x86, /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.newApplication(Instrumentation.java:979)
at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Suppressed: java.lang.ClassNotFoundException: com.microtechnicianapp.App
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
have read lot of threads but nothing works for me since morning.
have tried lot of things in gradle
apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' apply plugin: 'realm-android' android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.microtechnicianapp"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries false
} } repositories {
maven {
url "http://dl.bintray.com/lukaville/maven"
} }
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:25.0.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.bluelinelabs:logansquare:1.3.6'
compile 'com.github.aurae.retrofit2:converter-logansquare:1.4.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.google.android.gms:play-services-location:9.8.0'
compile 'com.github.gcacace:signature-pad:1.2.0'
compile 'com.github.davidpizarro:autolabelui:1.0.1'
compile 'com.nbsp:library:1.1'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
compile 'com.google.zxing:core:3.2.1'
testCompile 'junit:junit:4.12'
apt 'com.bluelinelabs:logansquare-compiler:1.3.6'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.mikhaellopez:circularprogressbar:1.1.1'
compile 'com.android.support:multidex:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
I am using android studio 2.3 hence gradle version is gradle-3.3-all.zip
I faced the same issue today, I have currently downgraded my gradle version and the generated debug apk works just fine, Feel like it might be an issue with the gradle version, will Update on this answer if i find with the actual issue.
But currently downgrading gradle from 2.3.0 to 2.2.0 seems to fix the issue.
I had the same crash with the debug apk of one of my apps. The release version (signed with release key) worked.
My app uses multidex.
I ended up disabling Instant Run in Android Studio (File -> Settings -> Build -> Instant Run) and after a rebuild the debug apk worked as well!
Found this solution here:
https://codentrick.com/cant-run-app-on-device-when-it-installed-from-debug-apk-file/
Related
I am using
pub.devrel:easygoogle:0.2.5
and
com.google.firebase:firebase-core:16.0.1
I am making a simple notification app which sends notification from FCM.
I am following this but at runtime i am getting error
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzx;
at com.google.android.gms.measurement.internal.zzt.zzaU(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
at com.google.firebase.analytics.connector.AnalyticsConnectorImpl.getInstance(Unknown Source)
at com.google.firebase.analytics.connector.internal.zzb.create(Unknown Source)
at com.google.firebase.components.zzh.zza(SourceFile:28)
at com.google.firebase.components.zzi.get(Unknown Source)
at com.google.firebase.components.zzh.get(SourceFile:39)
at com.google.firebase.components.ComponentContainer$$CC.get(Unknown Source)
at com.google.firebase.components.zzd.get(SourceFile)
at com.google.firebase.components.zzd.zza(SourceFile:68)
at com.google.firebase.FirebaseApp.zze(SourceFile:703)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzx" on path: DexPathList[[zip file "/data/app/com.apneareamein.autostartapp-1/base.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.apneareamein.autostartapp-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.apneareamein.autostartapp-1/lib/x86, /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 com.google.android.gms.measurement.internal.zzt.zzaU(Unknown Source)
... 30 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
gradle file -
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.myapp.autostart"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support:support-v4:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
testCompile 'junit:junit:4.12'
compile 'pub.devrel:easygoogle:0.2.5'
compile 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
I have added build gradle file for more details. i extended EasyMessageService for Notifications.
if any more details is required please let me know.
How can it be resolved?
Thanks in advance.
I had also like this problem. I had an old version google and other services such as google service 1.5.0-beta2 Wanted to run on android 10 devices and gave me an error.
Didn't find class "com.google.android.gms.common.internal.zzx"
Then I updated all libraries to the latest version. Then worked.
I am trying to do some experiments with Instant Apps Documentation: Android Instant Apps
Native Android apps, without the installation. I have followed steps which are covered on official docs. I have created emulator Nexus 5X to test instant apps features.
So, I have created two features in my project, which is much similar just kinda of demo to see how instant apps works. It was working well on one feature, now after when I created one more feature, now I have two features which in turns crashing my application.
05-24 12:07:12.259 12020-12028/? E/art: Failed writing handshake bytes (-1 of 14): Broken pipe
05-24 12:07:15.952 12020-12020/com.williams.instantappdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.williams.instantappdemo, PID: 12020
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.williams.instantappdemo/com.williams.instantappdemo.feature.MainActivity}: java.lang.ClassNotFoundException: could not find com.williams.instantappdemo.feature.MainActivity in any atom class loader or parent class loader
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: could not find com.williams.instantappdemo.feature.MainActivity in any atom class loader or parent class loader
at com.google.android.instantapps.supervisor.loader.WhAppClassLoader.loadClass(WhAppClassLoader.java:100)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.williams.instantappdemo.feature.MainActivity" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib, /vendor/lib, /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.instantapps.supervisor.loader.WhAppClassLoader.loadClass(WhAppClassLoader.java:85)
... 11 more
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.williams.instantappdemo.feature.MainActivity" on path: DexPathList[[zip file "/data/user/0/com.google.android.instantapps.supervisor/files/atom-cache/com.williams.instantappdemo/atom-download--base-1495607829279/base.jar"],nativeLibraryDirectories=[/data/user/0/com.google.android.instantapps.supervisor/files/native-lib/com.williams.instantappdemo, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at com.google.android.instantapps.supervisor.loader.DexFirstClassLoader.doLoadClass(DexFirstClassLoader.java:50)
at com.google.android.instantapps.supervisor.loader.WhAppClassLoader.loadClass(WhAppClassLoader.java:92)
... 11 more
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.williams.instantappdemo.feature.MainActivity" on path: DexPathList[[zip file "/data/user/0/com.google.android.instantapps.supervisor/files/atom-cache/com.williams.instantappdemo/atom-download--feature-1495607829279/feature.jar"],nativeLibraryDirectories=[/data/user/0/com.google.android.instantapps.supervisor/files/native-lib/com.williams.instantappdemo, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at com.google.android.instantapps.supervisor.loader.DexFirstClassLoader.doLoadClass(DexFirstClassLoader.java:50)
at com.google.android.instantapps.supervisor.loader.WhAppClassLoader.loadClass(WhAppClassLoader.java:92)
... 11 more
Here is build.gradle of feature module:
apply plugin: 'com.android.feature'
android {
compileSdkVersion 25
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':base')
testCompile 'junit:junit:4.12'
}
Here is build.gradle for feature2:
apply plugin: 'com.android.feature'
android {
compileSdkVersion 25
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':base')
testCompile 'junit:junit:4.12'
}
Here is the build.gradle for base module:
apply plugin: 'com.android.feature'
android {
compileSdkVersion 25
buildToolsVersion rootProject.buildToolsVersion
baseFeature true
defaultConfig {
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
feature project(':feature')
compile 'com.android.support:appcompat-v7:25.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
feature project(":feature1")
}
Here is the build.gradle of app module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId "com.nagarro.instantappdemo"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':feature')
implementation project(':feature1')
implementation project(':base')
}
Can anyone suggest what I am doing wrong ?
It looks like the actual activity package doesn't match what you have in your manifest file of the feature that contains MainActivity. It's a common error when refactoring activities into new packages and not using relative paths for activities in the manifest. Fully qualify the path to be absolutely sure
<activity android:name="com.williams.instantappdemo.feature.MainActivity"/>
Inspect the the apk file (build/outputs/apks) using Apk Analyzer to see if it has com.williams.instantappdemo.feature.MainActivity in that exact package.
You can also use the Merged Manifest view to inspect your final manifest (app module) to verify everything is in order.
Also, add application project(":app") to the base feature module so that it uses applicationId defined in your app module to package your app/instant app
Update:
Using the techniques described above, I investigated the merged manifests and found an issue. The build plugin ignored the numbers in the module name (feature1) so both features ended up having the same name. This caused a bunch of issues including the ActivityNotFound error. Renaming the feature1 module to featureOne resolved the issue.
We're looking to implement our AWS API Gateway generated Android SDK in our app.
When we try to build our client class, we get the following error:
java.lang.NoClassDefFoundError: Failed resolution of:Lcom/amazonaws/util/json/DateDeserializer;
Here's how we create our client instance:
ApiClientFactory factory = new ApiClientFactory();
final CigarSocialClient client = factory.build(CigarSocialClient.class);
We have been searching for a solution but haven't found anything yet. The best solution seems to ditch the generated sdk and invoke our api gateway via web requests.
Any help is appreciated!
UPDATE:
We're using the following aws tutorial
Here is our build.gradle file for the app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "com.example"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'app/libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+'
}
And here is the stack trace:
D/Error: ERR: stack=java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amazonaws/util/json/DateDeserializer;
at com.amazonaws.mobileconnectors.apigateway.ApiClientHandler.(ApiClientHandler.java:59)
at com.amazonaws.mobileconnectors.apigateway.ApiClientFactory.getHandler(ApiClientFactory.java:145)
at com.amazonaws.mobileconnectors.apigateway.ApiClientFactory.build(ApiClientFactory.java:123)
at com.example.API.testApiGatwaySdk(API.java:125)
at com.example.ListFragment$override.onCreateView(ListFragment.java:60)
at com.example.ListFragment$override.access$dispatch(ListFragment.java)
at com.example.ListFragment.onCreateView(ListFragment.java:0)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2080)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1272)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2149)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:600)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
at android.app.Activity.performStart(Activity.java:6929)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4974)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
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.amazonaws.util.json.DateDeserializer" on path: DexPathList[[dex file "/data/data/com.example/files/instant-run/dex/slice-support-annotations-24.2.0_f4e9ad562a860d98fa5881a52f2737573a46b23e-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_d08c5958e93c18231cddf69dc14d83b8ae6d3fa3-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_ce51fbf88aa3b5412a363fc449e8164899b38118-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_982f26845e74cf0a28b29b365
You are using a version of aws-android-sdk-core that is very old and not compatible with the altest clients generated by API gateway. Please update the sdk to the latest.
i got simmilar post but nothing working
i have android studio 2.3.1
gradle version 2.3.1
appcompat-v7:25.3.1
I create a new project by android studio(one that is automatically created by Android Studio(Hello Word)). I haven't write any thing in it.
When i install app using usb via android studio it works perfectly
but same app if i open it from it's icon ,i got these errors
One more i noticed that size of apk is 500-600kb ,early it used to be around for hello world(default by android studio) Apk 2.3Mb
FATAL EXCEPTION: main
Process: in.codebucket.check, PID: 32397
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{in.codebucket.check/in.codebucket.check.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "in.codebucket.check.MainActivity" on path: DexPathList[[zip file "/data/app/in.codebucket.check-1/base.apk"],nativeLibraryDirectories=[/data/app/in.codebucket.check-1/lib/x86, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "in.codebucket.check.MainActivity" on path: DexPathList[[zip file "/data/app/in.codebucket.check-1/base.apk"],nativeLibraryDirectories=[/data/app/in.codebucket.check-1/lib/x86, /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:1067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: in.codebucket.check.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)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
My xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="in.codebucket.check.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
My MainActivity
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}}
my Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.codebucket.check">
<application
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
gradle(Module:App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "in.codebucket.check"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}}}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
gradle(Project)
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Got the solution ,it is happening because of instant run,
Just disable it
Goto :
Android Studio --> File --> Setting --> Build, execution, deploy --> Instant run.
No need to disable instant run, just remove the app from device/emulator and clean the project and install it again.
For me the problem was that the Gradle dependencies wen't matching. Here's what solved it for me:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.and.myApp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-fexceptions"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'jp.wasabeef:blurry:2.1.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//noinspection GradleCompatible
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
}
For me, it is after I add the code to use getFusedLocationProviderClient, I get crashes
process: no.onmyway133.myapp, PID: 10538
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 com.google.android.gms.location.LocationServices.getFusedLocationProviderClient(Unknown Source)
at no.onmyway133.myapp.maps.MapsActivity.onCreate(MapsActivity.kt:22)
The problem is the warning in build.gradle, it warns that both should use the same version, otherwise there will be potential for runtime crashes.
So the fix is to specify the same version
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation "com.google.android.gms:play-services-location:15.0.1"
I have an android project in android studio. One of the modules is a library using android annotations. The other is an application which uses the library. Through much tweaking and googling I've managed to get the library project to generate the "" files. However, when I run the application it's not including the files, which I can see because it immdiately crashes when it can't find the Application "" class.
Library build.gradle
apply plugin: 'com.android.library'
apply plugin: 'android-apt'
def AAVersion = '3.0.1'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
configurations {
apt
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'com.hps.mobuyle.core'
library "true"
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
sourceSets {
main {
jniLibs.srcDir 'libs'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:appcompat-v7:23.1.0'
// android annotations
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
}
Application build.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.0.1'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
configurations {
apt
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'com.hps.mobuyle.core'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.hps.mobuyle.restaurant"
minSdkVersion 16
targetSdkVersion 23
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
// android annotations
apt "org.androidannotations:androidannotations" + ":$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile project(':libraryProject')
}
Project settings.gradle
include ':libraryProject'
include ':applicationProject'
Full error output
10-24 13:54:41.890 17670-17670/? E/Zygote: v2
10-24 13:54:41.890 17670-17670/? E/Zygote: accessInfo : 0
10-24 13:54:41.980 17670-17670/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hps.mobuyle.restaurant, PID: 17670
java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.hps.mobuyle.core.MPApplication_
at android.app.LoadedApk.makeApplication(LoadedApk.java:676)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6289)
at android.app.ActivityThread.access$1800(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.hps.mobuyle.core.MPApplication_
at com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:220)
at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:239)
at android.app.Application.attach(Application.java:211)
at android.app.Instrumentation.newApplication(Instrumentation.java:1020)
at android.app.Instrumentation.newApplication(Instrumentation.java:1004)
at android.app.LoadedApk.makeApplication(LoadedApk.java:666)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6289)
at android.app.ActivityThread.access$1800(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.ClassNotFoundException: com.hps.mobuyle.core.MPApplication_
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:209)
at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:239)
at android.app.Application.attach(Application.java:211)
at android.app.Instrumentation.newApplication(Instrumentation.java:1020)
at android.app.Instrumentation.newApplication(Instrumentation.java:1004)
at android.app.LoadedApk.makeApplication(LoadedApk.java:666)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6289)
at android.app.ActivityThread.access$1800(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.hps.mobuyle.core.MPApplication_" on path: DexPathList[[zip file "/data/app/com.hps.mobuyle.restaurant-2/base.apk"],nativeLibraryDirectories=[/data/app/com.hps.mobuyle.restaurant-2/lib/arm64, /vendor/lib64, /system/lib64]]
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 java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:209)
at com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:239)
at android.app.Application.attach(Application.java:211)
at android.app.Instrumentation.newApplication(Instrumentation.java:1020)
at android.app.Instrumentation.newApplication(Instrumentation.java:1004)
at android.app.LoadedApk.makeApplication(LoadedApk.java:666)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6289)
at android.app.ActivityThread.access$1800(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.hps.mobuyle.core.MPApplication_" on path: DexPathList[[dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-support-annotations-23.1.0_510f17cdc40968bee04a55acc3a74b072e08e08e-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-slf4j-api-1.7.10_57fc178fc2dace08d430739b21b0d50456c561f2-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-logback-android-core-1.1.1-3_79a748caea787f82e8fa3c69f01e9a3885b7ec32-classes.dex", dex file "/data/data/com.hps.mobuyle.restaurant/files/instant-run/dex/slice-logback-android-classic-1.1.1-3_c1b46ea01a968
10-24 13:54:42.010 3432-17684/? E/android.os.Debug: ro.product_ship = true
10-24 13:54:42.010 3432-17684/? E/android.os.Debug: ro.debug_level = 0x4f4c
10-24 13:54:42.010 3432-17684/? E/android.os.Debug: sys.mobilecare.preload = false
Build warnings
Warning:The following options were not recognized by any processor: '[androidManifestFile, resourcePackageName]'
After looking at your library build.gradle, i found one possible problem. You should always pass strings to the annotation processing options, true may not work here, "true" should work.
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'com.hps.mobuyle.core'
library "true"
}
}
I checked out the stripped down project on GitHub.
The main problem is that the project has an unconventional layout, however the different project locations are not configured properly. This is why Gradle does not know about the sources at all, and does not include the compiled classes in the APK.
This is what is needed to configure this project layout:
Set the manifest file location:
manifest.srcFile 'app/src/main/AndroidManifest.xml'
Add Java source folders:
java.srcDirs += 'app/src/main/java'
Configure the JNI folders: jniLibs.srcDirs += 'app/libs'
Add local dependency jars: compile fileTree(dir: 'app/libs', include: ['*.jar']) (note these are under the app folder
I also updated the version of the android-apt plugin and i also removed the not needed android.applicationVariants.each block, which was the way the configure annotation processing before the plugin. Now it is done by the plugin itself.
I also fixed the AA annotation processing parameters in the app project, because it wrongly pointed to the lib project package name:
resourcePackageName 'com.hps.mobuyle.restaurant'
The fill set of changes can be found in this commit.