ClassNotFoundException: Didn't find class "android.support.constraint.ConstraintLayout" on path - android

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.

Related

Unity-Android-App Crashes when Run First Time but From Second Time it Works Fine

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**}
}

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq; when adding Google Maps to Android app

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.

java.lang.RuntimeException: Unable to instantiate application on installation [duplicate]

This question already has answers here:
Instant Run throw DexIndexOverflowException
(3 answers)
Closed 5 years ago.
I am facing weird problem. When I install app via USB on phone, it works. But, when I transfer apk and install manually on mobile then it throws below error.
java.lang.RuntimeException: Unable to instantiate application com.xx.merchant.application.MerchantApplication: java.lang.ClassNotFoundException: Didn't find class "com.xx.merchant.application.MerchantApplication" on path: DexPathList[[zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/base.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_7_apk.apk"],nativeLibraryDirectories=[/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/base.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_7_apk.apk!/lib/x86, /system/lib, /system/vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:948)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5764)
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:6540)
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.xx.merchant.application.MerchantApplication" on path: DexPathList[[zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/base.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_7_apk.apk"],nativeLibraryDirectories=[/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/base.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_7_apk.apk!/lib/x86, /system/lib, /system/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 android.app.Instrumentation.newApplication(Instrumentation.java:1086)
at android.app.LoadedApk.makeApplication(LoadedApk.java:942)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5764) 
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:6540) 
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) 
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/multidex/MultiDexApplication;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 12 more
09-21 16:33:04.565 14026-14026/? E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/base.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_7_apk.apk"],nativeLibraryDirectories=[/data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/base.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.xx.merchant-U_VFCFO7rdRHN5OC21N8pg==/split_lib_slice_7_apk.apk!/lib/x86, /system/lib, /system/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)
... 15 more
My gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId 'com.xx.merchant'
minSdkVersion 17
targetSdkVersion 26
versionCode 7
versionName "1.0.7"
// Enabling multidex support.
multiDexEnabled true
}
signingConfigs {
release {
storeFile file('../keystore/xx.keystore')
storePassword 'xxx'
keyAlias "xxx"
keyPassword 'xxx'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.release
minifyEnabled false
}
}
productFlavors {
production {
applicationId "com.xx.merchant"
minSdkVersion 17
targetSdkVersion 26
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.android.support:support-v13:26.+'
compile 'com.android.support:design:26.+'
}
apply plugin: 'com.google.gms.google-services'
Adds dependency to your gradle file
compile 'com.android.support:multidex:1.0.1'
also add MultiDex.install on your Application class
public class YouApplication extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

NoClassDefFoundError on android emualtors when enable instant run

This has been an issues for me for a while. I think it is related to APK split feature introduced in the latest Android Studio version.
05-22 09:22:21.274 3451-3451/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: android.zeroarst.lab.sharedelement, PID: 3451
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{android.zeroarst.lab.sharedelement/android.zeroarst.lab.sharedelement.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "android.zeroarst.lab.sharedelement.MainActivity" on path: DexPathList[[zip file "/data/app/android.zeroarst.lab.sharedelement-2/base.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_dependencies_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_0_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_1_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_2_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_3_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_4_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_5_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_6_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_7_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_8_apk.apk", zip file "/data/app/android.zeroarst.lab.sharedelement-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/android.zeroarst.lab.sharedelement-2/lib/x86_64, /system/lib64, /vendor/lib64]]
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)
There are more but they are all the same exceptions.
If I disabled instant run then everything is just fine.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "android.zeroarst.lab.sharedelement"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
}

How to use Android Annotations in a library (Android Studio)?

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.

Categories

Resources