I migrated my app to AndroidX and it's crashing on launch on API level 21. My application throws this exception:
10-08 09:42:50.930 11346-11346/com.example.test E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.test, PID: 11346
java.lang.RuntimeException: Unable to get provider androidx.core.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.example.test-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.test-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5121)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4713)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4596)
at android.app.ActivityThread.access$1600(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
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:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.example.test.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.test-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:5106)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4713)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4596)
at android.app.ActivityThread.access$1600(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
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:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
And here is the provider definition in my AndroidManifest.xml file:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths" />
</provider>
On the latest API level it works fine. Any suggestions would be useful, thanks in advance.
It seems that this error came from incomplete configuration of MultiDex in your app. Here you may find the similar issue and here is an article answering it.
I suggest you to check the following (extending App class helped me):
Your Application class (App.class, for instance, if you use it) should extend from MultiDexApplication class:
public class BaseApplication extends MultiDexApplication {}
or if you don't use Application class check your manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
The documentation is outdated; use androidx.multidex for androidx:
implementation "androidx.multidex:multidex:2.0.1"
AndroidManifest.xml:
<application
android:name="androidx.multidex.MultiDexApplication">
</application>
Use the Jetifier when it still uses any com.android.support libraries:
android.enableJetifier=true
The problem is your React Native android project is not in AndroidX while react-native-image-picker is in an AndroidX environment; therefore, it is missing packages from the androidx package library.
Simple fix is adding the following lines to your ./android/gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
If you have any existing RN libraries that uses old android packages, your project won't build since they will be missing once you updated your project.
A clever tool found here deals with RN libraries that uses old android packages and brings them up to date.
npm i --save-dev jetifier
npx jetify
react-native run-android
All checked out and it's working on my end. Hope this helps anyone and please do share if it does.
Source https://github.com/react-native-community/react-native-image-picker/issues/1088#issuecomment-509755692
add below ndk lib support to your project if you have used the external library -
ndk
{
abiFilters "armeabi-v7a", "x86", "x86_64", "arm64-v8a"
}
inside the default config of your app level build.gradle file
defaultConfig
{
applicationId "org.comcast.net"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk
{
abiFilters "armeabi-v7a", "x86", "x86_64", "arm64-v8a"
}
}
it has solved my problem, hopefully it will solve at your end also.
Related
I am fairly new to android app development. Today i tried to implement a map inn my app, and cannot make it work. I even tried to make a new app with the default map activity, which crashes instantly.
This is the error I am getting:
--------- beginning of crash
2018-12-25 23:03:24.440 8401-8428/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.example.krist.maptest, PID: 8401
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at ez.b(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):3)
at ey.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):3)
at fa.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):15)
at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):6)
at ed.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):21)
at ed.run(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):8)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/00000016/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000016/MapsDynamite.apk!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at ad.loadClass(:com.google.android.gms.dynamite_dynamiteloader#14799081#14.7.99 (100400-223214910):4)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at ez.b(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):3)
at ey.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):3)
at fa.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):15)
at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):6)
at ed.a(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99 (100400-223214910):21)
at ed.run(:com.google.android.gms.dynamite_mapsdynamite#14799081#14.7.99
(100400-223214910):8)
I am running on a Pixel 3XL with the latest updates. Any ideas what the issue might be? Thanks.
I also had same issue, and it was solved pasting this line of code to 'application' element of AndroidManifest.xml.
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Hope it helped you.
Check if dependencies are set up correctly. Play services and gmaps versions should not vary.
Enable multidexing in your build.
add this line in dependencies:
implementation 'com.android.support:multidex:1.0.3' and make these changes in defaultConfig:
android {
defaultConfig {
...
multiDexEnabled true
}
...
}
And sync project.
i'm getting this class not found error on api's below 21 even though google said it supports till api 14
i have tried it on android studio 3.0 beta 6
09-19 17:12:39.273 2794-2794/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: xxxx, PID: 2794
java.lang.RuntimeException: Unable to get provider android.arch.lifecycle.LifecycleRuntimeTrojanProvider: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleRuntimeTrojanProvider" on path: DexPathList[[zip file "/data/app/xxxx-1.apk"],nativeLibraryDirectories=[/data/app-lib/xxxx-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:4793)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
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: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.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleRuntimeTrojanProvider" on path: DexPathList[[zip file "/data/app/xxxxx-1.apk"],nativeLibraryDirectories=[/data/app-lib/xxxxx-1, /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)
I've been using kotlin for development.
// architecture components
implementation "android.arch.lifecycle:runtime:$arch_version"
implementation "android.arch.lifecycle:extensions:$arch_version"
kapt "android.arch.lifecycle:compiler:$arch_version"
arch version is the latest one ext.arch_version = '1.0.0-alpha9-1'
building tool -> ext.buildToolsVersion = '26.0.1'
i have checked the other solutions says disable minify and proguard i have already tested them
debug {
// applicationIdSuffix '.debug' // Remove to fix Robolectric problem
versionNameSuffix '-DEBUG'
debuggable true
minifyEnabled false
useProguard false
multiDexEnabled true
Disabling Instant Run worked for me. (Settings -> Build, Execution, Deployment -> Instant Run -> uncheck "Enable Instant Run")
I was having the same problem, my app wouldn't run in api 19 devices (4.4) and it was a Dex problem.
I followed google documentation on multidex to solve it
1 - in app gradle, inside defaultConfig enable multidex
defaultConfig{
....
multiDexEnabled true
}
2 - to support multidex in other versions, add this dependency to your app gradle
compile 'com.android.support:multidex:1.0.1'
3 - if you have a class that extends Application, make it extend MultiDexApplication
if you don't, add this to your manifest file inside application tag
android:name="android.support.multidex.MultiDexApplication"
that's it. worked for me
After Android Studio 2.3 update (and gradle update) if I have instant run activated, and I install app from Android Studio through run or generate signed apk it works fine.
If I manually install the debug apk it immediately crashes on opening, with ClassNotFoundException.
Note: if I remove the reference to the file provider, the class not found becomes the main activity. This issue is with the debug apk that getting generated in Build-->Output-->apk folder. If you run app directly it always run fine.
Without instant run there is no crash. With previous versions of Android Studio there was not crash either.
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/com.vfirst.ifbagro-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.vfirst.ifbagro-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:4993)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4596)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4536)
at android.app.ActivityThread.access$1300(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5214)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.vfirst.ifbagro-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.vfirst.ifbagro-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.ActivityThread.installProvider(ActivityThread.java:4978)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4596)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4536)
at android.app.ActivityThread.access$1300(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5214)
at java.lang.reflect.Method.invokeNative(Native Method)
I had the same error and I solved it with MultiDex
add build.gradle multiDexEnabled "true".
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
described on this link : https://developer.android.com/studio/build/multidex.html
Try this :
android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
this code into your manifest :
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
If you use custom application class, use this code :
public class YouApplication extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
and then for manifest :
<application
...
android:name="YOUR_PACKAGE.YouApplication">
...
</application>
I hope help you my friend
As for me I tried the following : Try to check if your phone's Auto-start Manager allows your app to auto-start. By allowing your app to auto-start I think will help in fixing the Instant-run Problem. Hope's this helps.
Unable to get provider com.google.firebase.provider.FirebaseInitProvider: to run the project due to this error . How do I go about it? Please help.
10-08 15:05:05.957 17562-17562/com.coretec.msacco E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.coretec.msacco, PID: 17562
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/com.coretec.msacco-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.coretec.msacco-2, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5055)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4626)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566)
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:5336)
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:828)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.coretec.msacco-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.coretec.msacco-2, /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.ActivityThread.installProvider(ActivityThread.java:5040)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4626)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566)
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:5336)
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:828)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
at dalvik.system.NativeStart.main(Native Method)
Avoid using play-services as whole in your gradle file.
compile 'com.google.android.gms:play-services:9.8.0'
instead use specific ones
compile 'com.google.android.gms:play-services-location:9.8.0'
Configure your app for multidex
Modify the module-level build.gradle file to enable multidex and add the multidex library as a dependency, as shown here:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
...
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
}
Depending on whether you override the Application class, perform one of the following:
If you do not override the Application class, edit your manifest file to set android:name in the tag as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="androidx.multidex.MultiDexApplication" >
...
</application>
</manifest>
If you do override the Application class, change it to extend MultiDexApplication (if possible) as follows:
public class MyApplication extends MultiDexApplication { ... }
Or if you do override the Application class but it's not possible to change the base class, then you can instead override the attachBaseContext() method and callMultiDex.install(this) to enable multidex:
> public class MyApplication extends SomeOtherApplication { #Override
> protected void attachBaseContext(Context base) {
> super.attachBaseContext(base);
> MultiDex.install(this); } }
Caution: Do not execute MultiDex.install() or any other code through reflection or JNI before MultiDex.install() is complete. Multidex tracing will not follow those calls, causing ClassNotFoundException or verify errors due to a bad class partition between DEX files.
source
I updated my Android Studio to version 2.0. But I had a problem, I don't know why?
The important error info:
Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.IllegalStateException: java.lang.ClassNotFoundException: com.eallcn.rentagent.MyDebugEallApplication
I searched a long time, But I didn't find the right answer
you can see the link
At the same time when I click File->Project structure
It shows this error:
Is there any problem somewhere in the libs? When gradle build the program the libs didn't load completely for current program. Is there any problem with Android Studio version 2.0?
When I use Android studio 1.4.0 to build and run the program. It works fine for me! But when I use the Android Studio 2.0, the problem shows up!
Why? Could you help me, please?
Here is detailed error log:
11-28 11:57:00.489 19890-19890/com.eallcn.rentagent.debug
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.eallcn.rentagent.debug, PID: 19890 java.lang.RuntimeException: Unable to instantiate application
com.android.tools.fd.runtime.BootstrapApplication:
java.lang.IllegalStateException: java.lang.ClassNotFoundException:
com.eallcn.rentagent.MyDebugEallApplication
at android.app.LoadedApk.makeApplication(LoadedApk.java:537) at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)
at android.app.ActivityThread.access$1800(ActivityThread.java:139)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5314)
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:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException:
java.lang.ClassNotFoundException:
com.eallcn.rentagent.MyDebugEallApplication
at
com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:167)
at
com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:179)
at android.app.Application.attach(Application.java:194)
at
android.app.Instrumentation.newApplication(Instrumentation.java:992)
at
android.app.Instrumentation.newApplication(Instrumentation.java:976)
at android.app.LoadedApk.makeApplication(LoadedApk.java:532)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)
at android.app.ActivityThread.access$1800(ActivityThread.java:139)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5314)
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:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException:
com.eallcn.rentagent.MyDebugEallApplication
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at java.lang.Class.forName(Class.java:216)
at
com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:155)
at
com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:179)
at android.app.Application.attach(Application.java:194)
at
android.app.Instrumentation.newApplication(Instrumentation.java:992)
at
android.app.Instrumentation.newApplication(Instrumentation.java:976)
at android.app.LoadedApk.makeApplication(LoadedApk.java:532)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)
at android.app.ActivityThread.access$1800(ActivityThread.java:139)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5314)
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:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError:
com/eallcn/rentagent/MyDebugEallApplication
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at java.lang.Class.forName(Class.java:216)
at
com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:155)
at
com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:179)
at android.app.Application.attach(Application.java:194)
at
android.app.Instrumentation.newApplication(Instrumentation.java:992)
at
android.app.Instrumentation.newApplication(Instrumentation.java:976)
at android.app.LoadedApk.makeApplication(LoadedApk.java:532)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)
at android.app.ActivityThread.access$1800(ActivityThread.java:139)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5314)
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:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.eallcn.rentagent.MyDebugEallApplication" on path:
DexPathList[[zip file
"/data/app/com.eallcn.rentagent.debug-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.eallcn.rentagent.debug-1,
/vendor/lib, /system/lib, /data/datalib]]
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 java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at java.lang.Class.forName(Class.java:216)
at
com.android.tools.fd.runtime.BootstrapApplication.createRealApplication(BootstrapApplication.java:155)
at
com.android.tools.fd.runtime.BootstrapApplication.attachBaseContext(BootstrapApplication.java:179)
at android.app.Application.attach(Application.java:194)
at
android.app.Instrumentation.newApplication(Instrumentation.java:992)
at
android.app.Instrumentation.newApplication(Instrumentation.java:976)
at android.app.LoadedApk.makeApplication(LoadedApk.java:532)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4586)
at android.app.ActivityThread.access$1800(ActivityThread.java:139)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5314)
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:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
Disable the Instant Run option in Android Studio. Instructions are in the Android Studio Instant Run documentation.
Instant Run tries to do hot swapping of your code; this causes the application class to be moved.
To disable Instant Run Go to File --> Settings--> Build,Execution,Deployment -->Instant Run ---> uncheck "Enable instant run"
I had the same error after trying to use the 2.0.
I solved it by reverting some gradle changes:
1/3:
Changing:
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
By:
classpath 'com.android.tools.build:gradle:1.2.3'
2/3:
Changing:
buildToolsVersion '23.0.2'
By:
buildToolsVersion "21.1.2"
3/3: (in <project folder>/.idea/gradle.xml)
And:
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.8" />
By:
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.4" />
I don't know what line is exactly the origin of the error, but with this three changes it was solved.
Hope that it helps you :)
I had the same error.
I solved it by cleaning the project ( Build > Clean Project )
Just go to Android Studio menu - Build --> Rebuild Project.
I was able to get rid of this error by updating gradle-wrapper.properties to gradle-2.14.1-all, and cleaning/rebuilding the project. Then it ran fine. No other changes were needed (as those suggested in the above answer)...
Changing to
classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
fixed issue
I also got this error with Android 2.0 in stable channel.
What I did?
- I had an older version of the app already installed on the device (which was built using older version of the Studio) which I was trying to replace by running the newer app on device.
I just uninstalled the older version completely before running the new app and the trick worked.
Just for those who want to update classPath with latest gradle plugin version, Where to find latest plugin version?
Check in http://tools.android.com/tech-docs/new-build-system and update your classPath. Latest one at current is
classpath 'com.android.tools.build:gradle:2.0.0'.
Always try to build with latest plugin version.
If you don't want to disable Instant Run, just do a project clean and rerun.
Change classpath 'com.android.tools.build:gradle:2.1.2' to classpath 'com.android.tools.build:gradle:2.1.0' fixes my problem.
I also faced the same problem and i solved it. In my case it was due to a mistake in global class ( Throughout Application context class ) , my mistake was in AndroidManifest.xml i have declared the Application class VolleyHelper as :-
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true" android:name=".VolleyHelper"
android:theme="#style/AppTheme">
but in VolleyHelper.java i don't have a Default constructor . So i added default constructor in VolleyHelper.java ( Application Class ) .
you can also add this into your gradle to prevent making dex on debug
debug {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
In some Android devices with versions before OS 5.0 we get the error message:
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.android.tools.fd.runtime.BootstrapApplication
We must disable "Instant Run".
Go to File > Settings > Built, Execution, Deployment > Instant Run
Then disable the option Enable Instant Run to hot swap code.
I just needed to reboot my device. Tried everything else first unfortunately so wasted hours.
If you are sharing your app then another solution is
go to Android Studio --> Build --> Build APK
A pop up will come with APK generated successfully. Show in Explorer will get you to the generated apk folder.
This error will happen when you add a blank activity with .java file. So to solve this error 1st you have to Build the project again. Then run it. Solved
Thank You.
No need to disable "instant run".
go to project's root using File Explorer
Finish Android Studio(AS)
delete(relocate somewhere) ".gradle" 's folder content
(to clean some cashs and old artifacts)
in res folder clean off all inappropriate files
launch the AS again
in module's build.gradle set buildTypes { debug {minifyEnabled true to false
(that looks like an error was in my proguard file)
Sync, compile and run the app again.
I just update Android Studio to the last version (2.0 Beta 5). It changes itself to classpath 'com.android.tools.build:gradle:2.0.0-beta5' and works like a charm.