I already have tried all the solutions that are in internet but any of them works, this is my gradle:
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.rocketjourney"
minSdkVersion 21
targetSdkVersion 24
versionCode 68
versionName "4.41"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "com.rocketjourney.helpers.CustomTestRunner"
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
resolutionStrategy.force 'com.squareup.okio:okio:1.13.0'
resolutionStrategy.force 'com.squareup.okhttp3:okhttp:3.8.0'
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode = true
}`
repositories {
mavenCentral()
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
maven { url "https://jitpack.io" }
flatDir { dirs 'libs' }
flatDir { dirs '../aars' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') { transitive = true; }
etc...
}`
my manifest looks like this:
<application
android:name="com.rocketjourney.RJApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
In my RJApplication.class I have this code:
public class RJApplication extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
}
But my error now is this:
11-08 11:54:36.494 5743-5743/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rocketjourney, PID: 5743
java.lang.NoClassDefFoundError: Failed resolution of: Lio/fabric/sdk/android/services/common/FirebaseInfo;
at com.crashlytics.android.CrashlyticsInitProvider.onCreate(CrashlyticsInitProvider.java:22)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassNotFoundException: Didn't find class "io.fabric.sdk.android.services.common.FirebaseInfo" on path: DexPathList[[zip file "/data/app/com.rocketjourney-2/base.apk"],nativeLibraryDirectories=[/data/app/com.rocketjourney-2/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.crashlytics.android.CrashlyticsInitProvider.onCreate(CrashlyticsInitProvider.java:22)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Suppressed: java.lang.ClassNotFoundException: io.fabric.sdk.android.services.common.FirebaseInfo
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)
... 16 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Hope you guys can help me, I will appreciate it so much!
You don't need to add multidex support if your minSdkVersion is 21.
From the documentation:
Multidex support for Android 5.0 and higher
Android 5.0 (API level 21) and higher uses a runtime called ART which natively supports loading multiple DEX files from APK files. ART performs pre-compilation at app install time which scans for classesN.dex files and compiles them into a single .oat file for execution by the Android device. Therefore, if your minSdkVersion is 21 or higher, you do not need the multidex support library.
So, you need to remove compile 'com.android.support:multidex:1.0.1' from your build.gradle. Then you need to extend your RJApplication with Application. Also remove MultiDex.install(this); from your attachBaseContext().
all you need to do is set multiDexEnabled to true by adding multiDexEnabled true. Please refer to Configure your app for multidex
Related
I have implemented Firebase Analytics and Firebase Messaging after download the plugin from Google we site and successfully running the Resolvers.
The problem is after build when App is Run FIRST TIME it crashes with the following error but from 2nd time onwards the app does not crash
Here is the log
FATAL EXCEPTION: main
Process: com.lemontart.flying.robot.car.transformation, PID: 27861
java.lang.RuntimeException: Unable to instantiate service com.google.firebase.messaging.cpp.ListenerService: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.messaging.cpp.ListenerService" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/base.apk"],nativeLibraryDirectories=[/data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/lib/arm, /data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/base.apk!/lib/armeabi-v7a, /system/lib]]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3654)
at android.app.ActivityThread.access$1500(ActivityThread.java:207)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.messaging.cpp.ListenerService" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/base.apk"],nativeLibraryDirectories=[/data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/lib/arm, /data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/base.apk!/lib/armeabi-v7a, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:169)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:103)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3649)
at android.app.ActivityThread.access$1500(ActivityThread.java:207)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/FirebaseMessagingService;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 11 more
Caused by: java.lang.ClassNotFoundException: com.google.firebase.messaging.FirebaseMessagingService
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 14 more
Caused by: java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in base.apk)
... 14 more
2019-05-17 12:55:18.960 27861-27861/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.lemontart.flying.robot.car.transformation, PID: 27861
java.lang.Error: FATAL EXCEPTION [main]
Unity version : 2018.3.14f1
Device model : OnePlus ONEPLUS A5000
Device fingerprint: OnePlus/OnePlus5/OnePlus5:9/PKQ1.180716.001/1904191514:user/release-keys
Caused by: java.lang.RuntimeException: Unable to instantiate service com.google.firebase.messaging.cpp.ListenerService: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.messaging.cpp.ListenerService" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/base.apk"],nativeLibraryDirectories=[/data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/lib/arm, /data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/base.apk!/lib/armeabi-v7a, /system/lib]]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3654)
at android.app.ActivityThread.access$1500(ActivityThread.java:207)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.messaging.cpp.ListenerService" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/base.apk"],nativeLibraryDirectories=[/data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/lib/arm, /data/app/com.lemontart.flying.robot.car.transformation-EVwlnR7Mxf4TO-7_HvK44w==/base.apk!/lib/armeabi-v7a, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:169)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:103)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3649)
at android.app.ActivityThread.access$1500(ActivityThread.java:207)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/messaging/FirebaseMessagingService;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
I an see there are all the jars and aars present it the project, still I am not able to figure our the problem.
Here is my gradle file
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
**BUILD_SCRIPT_DEPS**}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
// Android Resolver Repos Start
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
maven {
url "https://maven.google.com/" // Assets/Consoliads/Editor/ConsoliAdsDependencies.xml:7
}
maven {
url "file:////Volumes/JawadData/Unity%20Projects/Consoli%204.6.2%20Unity%202018/Assets/Firebase/m2repository" // Assets/Firebase/Editor/AnalyticsDependencies.xml:22, Assets/Firebase/Editor/AppDependencies.xml:22
}
mavenLocal()
jcenter()
mavenCentral()
}
}
// Android Resolver Repos End
apply plugin: 'com.android.application'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
**DEPS**}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
multiDexEnabled true
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
}**SIGN**
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
useProguard **PROGUARD_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
useProguard **PROGUARD_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
}
}**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**
I need to fix this issue, please help it will be highly appreciated.
Thanks
Few days ago I faced the same issue, And it was resolved by just updating The all firebase libraries to their latest version. It seems that their could be version conflict between the dependencies.
You can find the latest versions list of the Firebase libraries here
Try adding this line to your gradle:
implementation 'com.google.firebase:firebase-messaging:+'
I think it should to the end of the document, if not try in other places like this:
dependencies {
implementation 'com.google.firebase:firebase-messaging:+'
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
**DEPS**}
Or here:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
implementation 'com.google.firebase:firebase-messaging:+'
**BUILD_SCRIPT_DEPS**}
}
I am adding a Google Maps Activity to my app which is connected to a Parse server. I've simply added the maps activity and created the relevant API key and in an attempt to run the app I get the following:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.parse.starter, PID: 14204
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6285)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.parse.starter-pGR71qLVNb0LE-PnOSAJaA==/base.apk"],nativeLibraryDirectories=[/data/app/com.parse.starter-pGR71qLVNb0LE-PnOSAJaA==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6285)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
I believe the error is within the gradle scripts as they are highlighted red. Thus, they are as follows:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
ext {
compileSdkVersion = 22
buildToolsVersion = "23.0.1"
minSdkVersion = 14
targetSdkVersion = 23
}
The other gradle file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.parse.starter"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile 'com.parse:parse-android:1.13.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:multidex:1.0.0'
}
I have tried updating the dependency version as I am getting the red error line under
compile 'com.android.support:appcompat-v7:23.4.0'
As well as the other dependencies however the error still remains. I am very new to Android development so I have little idea to what's going on in these files.
EDIT: As soon as I comment out:
implementation 'com.google.android.gms:play-services-maps:15.0.1'
The program runs without error, but obviously, google maps is not working. Are the dependency versions incompatible with the gradle version?
You have different versions of
com.google.android.gms:play-services:9.4.0
com.google.android.gms:play-services-maps:15.0.1
Fix it and it should work.
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.
I was working with some libraries so I had to edit Gradle settings. Since my app wasn't working, I restored it with Local history in Android studio but It still doesn't work. Errors returned are reported here
05-04 23:26:34.953 28017-28017/? I/art: Late-enabling -Xcheck:jni
05-04 23:26:35.217 28017-28017/com.quintabi.facchini.myshop W/System: ClassLoader referenced unknown path: /data/app/com.quintabi.facchini.myshop-2/lib/arm
05-04 23:26:35.233 28017-28017/com.quintabi.facchini.myshop I/InstantRun: starting instant run server: is main process
05-04 23:26:35.333 28017-28017/com.quintabi.facchini.myshop W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
05-04 23:26:35.465 28017-28017/com.quintabi.facchini.myshop D/AndroidRuntime: Shutting down VM
--------- beginning of crash
05-04 23:26:35.466 28017-28017/com.quintabi.facchini.myshop E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.quintabi.facchini.myshop, PID: 28017
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.quintabi.facchini.myshop/com.quintabi.facchini.myshop.index}: android.view.InflateException: Binary XML file line #11: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: android.view.InflateException: Binary XML file line #11: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.constraint.ConstraintLayout" on path: DexPathList[[zip file "/data/app/com.quintabi.facchini.myshop-2/base.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.quintabi.facchini.myshop-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.quintabi.facchini.myshop-2/lib/arm, /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 android.view.LayoutInflater.createView(LayoutInflater.java:609)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:964)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:994)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.quintabi.facchini.myshop.index.onCreate(index.java:25)
at android.app.Activity.performCreate(Activity.java:6672)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
05-04 23:26:35.467 28017-28017/com.quintabi.facchini.myshop E/AndroidRuntime: at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Build.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
}
Build.gradle(module):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.quintabi.facchini.myshop"
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'
}
}
productFlavors {
}
}
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:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
Settings.gradle is just
include ':app'
You may have updated to AndroidX support library and the layout is referencing the old ConstraintLayout version. So you have to update the android.support.constraint.ConstraintLayout tags to androidx.constraintlayout.widget.ConstraintLayout in your layout XML.
Changes you have made earlier corrupted your Gradle File (the module one).
It should look like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "***" /*Your package name*/
minSdkVersion 15
targetSdkVersion 25
versionCode 5
versionName "1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
//Your Dependencies
//Don't forget to add dependency of constraint-layout
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
Add dependency for constraint-layout.
See Code
NOTE : compile has become obsolete and replaced with 'implementation'
keyword so replace 'compile' with 'implementation'
so the code will be
dependencies {
//Your Dependencies
//Don't forget to add dependency of constraint-layout
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
}
UPDATE: If you have upgraded to AndroidX now. Then you need to use androidx.constraintlayout.widget.ConstraintLayout instead of android.support.constraint.ConstraintLayout
use androidx.constraintlayout.widget.ConstraintLayout replace android.support.constraint.ConstraintLayout, then it worked
If you updated your project to Androidx
Then Change this dependency.
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
to
implementation 'androidx.constraintlayout.widget.ConstraintLayout:1.0.0'
This will work.
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.