I recently updated my Android Studio to 3.1.0 and I am using Gradle 4.4.0 and ever since I have updated my IDE I have been having issues with Jacoco. I get a runtime crash, which looks like:
03-29 15:41:19.944 6629-6629/com.MyApp.pr.redesign.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.MyApp.pr.MyApp.app, PID: 6629
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_773e439/Offline;
at com.MyApp.pr.eventcollector.utils.MyApp.$jacocoInit(Unknown Source:13)
at com.MyApp.pr.eventcollector.utils.MyApp.<clinit>(Unknown Source:0)
at com.MyApp.pr.eventcollector.utils.MyApp.setLevel(Unknown Source:0)
at com.MyApp.pr.MyApp.MyApp.setupLogging(MyApp.java:175)
at com.MyApp.pr.MyApp.MyApp.onCreate(MyApp.java:77)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.jacoco.agent.rt.internal_773e439.Offline" on path: DexPathList[[zip file "/data/app/com.MyApp.pr.redesign.app-EGnUUyKeM4P-cZrCGsyoUQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.MyApp.pr.redesign.app-EGnUUyKeM4P-cZrCGsyoUQ==/lib/arm64, /data/app/com.MyApp.pr.redesign.app-EGnUUyKeM4P-cZrCGsyoUQ==/base.apk!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.MyApp.pr.eventcollector.utils.MyApp.$jacocoInit(Unknown Source:13)
at com.MyApp.pr.eventcollector.utils.MyApp.<clinit>(Unknown Source:0)
at com.MyApp.pr.eventcollector.utils.MyApp.setLevel(Unknown Source:0)
at com.MyApp.pr.MyApp.MyApp.setupLogging(MyApp.java:175)
at com.MyApp.pr.MyApp.MyApp.onCreate(MyApp.java:77)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Here is what my Gradle files look like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: 'gradle/configurations.gradle'
apply from: 'gradle/gradleLintConfig.gradle'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
}
maven {
url "https://maven.fabric.io/public"
}
}
dependencies {
// 3.0.1 (November 2017) - is a minor update to support Android Studio 3.0.1, and includes general bug fixes and performance improvements.
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
//Here is Jacoco reference
classpath 'org.jacoco:org.jacoco.core:0.8.0'
// Nebula lint is used as a lint for our Gradle scripts. It helps identify if our
// Gradle scripts have unused dependencies for example. Also, it checks for conformance
// to Gradle standards.
classpath 'com.netflix.nebula:gradle-lint-plugin:9.0.0'
//Crashlytics - Crash reporting
classpath 'io.fabric.tools:gradle:1.25.1'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
tasks.withType(JavaCompile) {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here is the app build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply from: "$project.rootDir/gradle/findbugs.gradle"
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.0'
}
...
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled false
}
debug {
versionNameSuffix="-debug"
debuggable true
/**
* Code below is commented out because it causes build issue
* when using newer version of gradle (3.1.0)
*/
testCoverageEnabled true
minifyEnabled false
}
}
}
...
dependencies {
...
}
I don't know what the issue is. I have tried to add the .jar files directly to the project with the same result. If anyone can help, I would be forever grateful!
I have same issue with gradle 4.6 and android plugin 3.1.0 when launching build from android studio / idea. However when I use gradle to build apk and deploy it with adb it works fine.
So it seems that the problem is related to IDE itself.
It does not package right jacoco version to apk.
EDIT:
I've disabled instant run and it works fine now.
I cant say my answer is the definitive problem because I can't see your dependencies in app build.gradle, but with this newest version of Gradle "compile" is no longer supported. This might be the root cause either in your build.gradle or the build.gradle of Jacoco.
Related
Project-level build.gradle
buildscript {
addRepos(repositories)
dependencies {
classpath 'com.google.gms:google-services:4.3.5'
// Crashlytic
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.0'
}
}
App-level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
dependencies {
// Crashlytic
implementation 'com.google.firebase:firebase-crashlytics:18.0.0'
}
With gradle 4.3.5 and Firebase crashlytic 2.6.0 My app stop compiling with the error below
class org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar$2 cannot be cast to class org.gradle.api.file.Directory (org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar$2 and org.gradle.api.file.Directory are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader #68be2bc2)
class org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar$2 cannot be cast to class org.gradle.api.file.Directory (org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar$2 and org.gradle.api.file.Directory are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader #68be2bc2)
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
But everything works if I change Firebase crashlytic version to 2.3.0
Do you guys have any idea why is this happen?
UPDATED ANSWER:
The reason for the compiling issue is that version of Gradle and Crashlytics Gradle plug-in is incompatible.
As described here, starting from Crashlytics Gradle plugin version 2.5.0:
The Crashlytics
Gradle plugin is compatible with Gradle v5.6.4+ and the Android Gradle
plugin v3.4.2+. Support for previous Gradle and Android Gradle plugin
versions have been removed.
So, the Solution is to use the latest Gradle and firebase-crashlytics-gradle versions. Thanks to #Mher for describing the compatible up-to-date versions here. Follow his answer for updating versions. Don't forget to change compileOptions in app level build.gradle as:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Warning: My old answer below is a workaround to fix the Gradle and Crashlytics compatibility for those who are not ready to update the Gradle version. The proper solution is to update the Gradle version. In the old answer below, the mentioned firebase-crashlytics-gradle:2.4.1 was buggy for me and it was not able to upload mapping files to the Firebase console which deobfuscates the crash reports. So, try to follow the above-updated answer instead of downgrading the Crashlytics Gradle version.
OLD ANSER FOR WHO CANNOT UPDATE THE GRADLE VERSION:
I hit the exact same issue. Seems the latest crashlytics-gradle plugin is incompatible with something. Using the lower version of crashlytics-gradle plugin helped. Instead of firebase-crashlytics-gradle:2.6.0 Try to use this version:
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
That worked for me... If that doesn't work for you, you can maybe try even lower versions. A list of versions can be found here:
https://firebase.google.com/support/release-notes/android#crashlytics_gradle_plugin_v2-0-0
When you search for "Crashlytics Gradle plugin version", you can see all released versions for Crashlytics Gradle plugin.
I also had to change compileOptions in app level build.gradle as:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
When target and source compatibility was not set to 1_8, project compiled but was crashing when trying to run the app:
--------- beginning of crash
2021-06-09 17:22:28.765 29519-29519/com.resmed.myair.cpl E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.resmed.myair.cpl, PID: 29519
java.lang.BootstrapMethodError: Exception from call site #45 bootstrap method
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NoClassDefFoundError: Invalid descriptor: minimize.
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
In my case
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
solved the error but crashlytics didn't send errors to server.
I changed versions in \android\build.gradle to
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
and in \android\gradle\wrapper\gradle-wrapper.properties to
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
and now everything works just fine.
I had to switch from:
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
to
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.0'
and then it worked. Seems like some new versions of the library aren't necessarily compatible with gradle.
Just try going down a few versions and build again.
Include:
implementation 'com.google.firebase:firebase-crashlytics'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
In your Gradle File
I have problems with admob-free plugin. I executed these command in a ionic 4 project:
ionic start myapp sidemenu
ionic capacitor add android
ionic cordova plugin add cordova-plugin-admob-free --save --variable ADMOB_APP_ID="myadmobid"
npm install #ionic-native/admob-free
Ionic capacitor sync android
ionic capacitor run android
when I test the program on my device android studio shows the next error and the app stop.
FATAL EXCEPTION: main
Process: com.danieltrevino.myapp, PID: 29617
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzur;
at com.google.android.gms.ads.BaseAdView.<init>(Unknown Source:3)
at com.google.android.gms.ads.AdView.<init>(Unknown Source:1)
at name.ratson.cordova.admob.banner.BannerExecutor$1.run(BannerExecutor.java:70)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:280)
at android.app.ActivityThread.main(ActivityThread.java:6706)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.internal.zzur
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
I read that the problem could be about google play services versions
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android/capacitor-cordova-android-plugins/build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
google()
jcenter()
mavenCentral()
flatDir{
dirs 'src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(dir: 'src/main/libs', include: ['*.jar'])
implementation 'org.apache.cordova:framework:7.0.0'
// SUB-PROJECT DEPENDENCIES START
implementation "com.google.android.gms:play-services-base:11.0.4"
implementation "com.google.android.gms:play-services-ads:11.0.4"
// SUB-PROJECT DEPENDENCIES END
}
// PLUGIN GRADLE EXTENSIONS START
apply from: "cordova.variables.gradle"
// PLUGIN GRADLE EXTENSIONS END
for (def func : cdvPluginPostBuildExtras) {
func()
}
I am following the next tutorial , do you know some solution for this?
The admob plugin has some issues due to the new ionic 4/5 version of the framework. For the ones using capacitor, there's two plugins( community plugins) that are avalaible now, they're pretty new so you might find some bugs there.
Those two plugins (at the moment of writing this, so you can find more than two) are found in the docs capacitor's documentation
The two plugins right now are:
plugin 1
plugin 2
I made an Android app that works fine when run locally and worked when installed from an internal test track but once I released it to production the public version installed from the Google Play Store crashes instantly when opened.
Stack trace from logcat:
--------- beginning of crash
2019-04-07 08:52:53.918 806-806/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.alexmojaki.quiggles, PID: 806
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.alexmojaki.quiggles/com.alexmojaki.quiggles.MainMenuActivity}: java.lang.IllegalStateException: Resource not found in classpath: kotlin/kotlin.kotlin_builtins
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: java.lang.IllegalStateException: Resource not found in classpath: kotlin/kotlin.kotlin_builtins
at kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsLoaderImpl.createBuiltInPackageFragmentProvider(BuiltInsLoaderImpl.kt:55)
at kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsLoaderImpl.createPackageFragmentProvider(BuiltInsLoaderImpl.kt:33)
at kotlin.reflect.jvm.internal.impl.builtins.KotlinBuiltIns.createBuiltInsModule(KotlinBuiltIns.java:127)
at kotlin.reflect.jvm.internal.impl.builtins.jvm.JvmBuiltIns.<init>(JvmBuiltIns.kt:43)
at kotlin.reflect.jvm.internal.impl.builtins.jvm.JvmBuiltIns.<init>(JvmBuiltIns.kt:18)
at kotlin.reflect.jvm.internal.components.RuntimeModuleData$Companion.create(RuntimeModuleData.kt:58)
at kotlin.reflect.jvm.internal.ModuleByClassLoaderKt.getOrCreateModule(moduleByClassLoader.kt:58)
at kotlin.reflect.jvm.internal.KDeclarationContainerImpl$Data$moduleData$2.invoke(KDeclarationContainerImpl.kt:37)
at kotlin.reflect.jvm.internal.KDeclarationContainerImpl$Data$moduleData$2.invoke(KDeclarationContainerImpl.kt:34)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:92)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:31)
at kotlin.reflect.jvm.internal.KDeclarationContainerImpl$Data.getModuleData(KDeclarationContainerImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:47)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:44)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:92)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:31)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getDescriptor(KClassImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl.getDescriptor(KClassImpl.kt:179)
at kotlin.reflect.jvm.internal.KClassImpl.getConstructorDescriptors(KClassImpl.kt:196)
at kotlin.reflect.jvm.internal.KClassImpl$Data$constructors$2.invoke(KClassImpl.kt:91)
at kotlin.reflect.jvm.internal.KClassImpl$Data$constructors$2.invoke(KClassImpl.kt:44)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:92)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:31)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getConstructors(KClassImpl.kt)
at kotlin.reflect.jvm.internal.KClassImpl.getConstructors(KClassImpl.kt:235)
at kotlin.reflect.jvm.ReflectJvmMapping.getKotlinFunction(ReflectJvmMapping.kt:149)
at com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector.findKotlinParameterName(KotlinModule.kt:180)
at com.fasterxml.jackson.module.kotlin.KotlinNamesAnnotationIntrospector.findImplicitPropertyName(KotlinModule.kt:106)
at com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair.findImplicitPropertyName(AnnotationIntrospectorPair.java:490)
2019-04-07 08:52:53.919 806-806/? E/AndroidRuntime: at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addCreatorParam(POJOPropertiesCollector.java:485)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addCreators(POJOPropertiesCollector.java:465)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collectAll(POJOPropertiesCollector.java:313)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getPropertyMap(POJOPropertiesCollector.java:287)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.getProperties(POJOPropertiesCollector.java:170)
at com.fasterxml.jackson.databind.introspect.BasicBeanDescription._properties(BasicBeanDescription.java:164)
at com.fasterxml.jackson.databind.introspect.BasicBeanDescription.findProperties(BasicBeanDescription.java:239)
at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._findCreatorsFromProperties(BasicDeserializerFactory.java:349)
at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._constructDefaultValueInstantiator(BasicDeserializerFactory.java:333)
at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findValueInstantiator(BasicDeserializerFactory.java:257)
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:214)
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:137)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:411)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:444)
at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:194)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:113)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:97)
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:254)
at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:68)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3077)
at com.alexmojaki.quiggles.MainMenuActivity.onCreate(MainMenuActivity.kt:140)
at com.alexmojaki.quiggles.CommonActivity.onCreate(CommonActivity.kt:47)
at android.app.Activity.performCreate(Activity.java:6942)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880)
... 9 more
Source code: https://github.com/alexmojaki/quiggles
Play store: https://play.google.com/store/apps/details?id=com.alexmojaki.quiggles
I use Android Studio to generate a signed Android App Bundle which I upload to the Play Console.
Android Studio version:
Android Studio 3.3.1
Build #AI-182.5107.16.33.5264788, built on January 29, 2019
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
Root build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.20'
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/waynejo/maven" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module app/build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.alexmojaki.quiggles"
minSdkVersion 21
targetSdkVersion 28
versionCode 5
versionName "public_2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
multiDexEnabled true
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.QuadFlask:colorpicker:0.0.13'
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8"
implementation 'com.waynejo:androidndkgif:0.3.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
implementation 'com.google.android.instantapps:instantapps:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
This has been fixed. Upgrading from com.android.tools.build:gradle:3.3.1 to 3.3.2 seems to have done it.
Alternatively it's possible that disabling proguard fixed the issue but that I didn't correctly install that version with that fix (although I think I did) or that something else changed (maybe on Google Play). I have no visibility into what's going on or easy tests to perform.
I am using android's data binding library for views in a library project
i have added the following line in my root gradle file
classpath 'com.android.databinding:dataBinder:1.0-rc1'
and have enabled the dataBinding as given below in module's gradle file
apply plugin: 'com.android.databinding'
...
...
android {
....
dataBinding {
enabled = true
}
}
i have enabled the multiDex in my library project
as well as in the host app which is using this library
but i get this stack trace of error while launching the library's activity
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/databinding/DataBinderMapper;
at android.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:31)
at sdk.ui.activities.MyActivity.onCreate(MyActivity.java:76)
at android.app.Activity.performCreate(Activity.java:6280)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1116)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2534)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2647)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1502)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5763)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.databinding.DataBinderMapper" on path: DexPathList[[zip file "/data/app/testApp.dev-1/base.apk"],nativeLibraryDirectories=[/data/app/testApp.dev-1/lib/arm64, /data/app/testApp.dev-1/base.apk!/lib/arm64-v8a, /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 android.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:31)
at sdk.ui.activities.MyActivity.onCreate(MyActivity.java:76)
at android.app.Activity.performCreate(Activity.java:6280)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1116)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2534)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2647)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1502)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5763)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)
Suppressed: java.lang.ClassNotFoundException: android.databinding.DataBinderMapper
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)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Make sure that ALL your modules that use DataBinding have it enabled. This was the reason I got that exception.
android {
....
dataBinding {
enabled = true
}
}
finally i was able to solve this issue.
It seems there was a conflict between apt version of the app and library modules.
upgraded the apt version in the app to
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
Besides adding the following to build.gradle:
android {
dataBinding {
enabled = true
}
}
I also have to add the following dependency:
dependencies {
kapt 'com.android.databinding:compiler:3.1.4'
}
Best guess. Get rid of android-apt
And if there are libraries using apt
Instead of apt 'lt.mdm.sdd:myLib:1.5.1' use
annotationProcessor 'lt.mdm.sdd:myLib:1.5.1'.
I'm not sure if this will help you, and i have no idea if library it self should be changed.
It helped me (i was using androidannotations.org older version with apt) at least.
Update
And i have no idea why you apply plugin: 'com.android.databinding'? It works without it as well.
I had the same problem after performing the migration androdx. I tried all the above methods but not resolved. I suddenly found that I used
com.android.tools.build:gradle version is 3.3. I update it to 3.5. Problem is solved.
project build.gradle:
classpath 'com.android.tools.build:gradle:3.3.0'
Update to
classpath 'com.android.tools.build:gradle:3.5.0'
Redo the migration.
classpath 'com.android.databinding:dataBinder:1.0-rc1'
apply plugin: 'com.android.databinding'
Remove that lib. from gradle.
I had the same problem, but I solved it removing
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
from the global build.gradle and removing
apply plugin: 'android-apt'
from the local build.gradle, then it worked like a charm.
It seems it was a mixed problem with Butterknife too. Pretty weird.
The new way of adding DataBinding is by adding on the build.gradle of all your modules:
android {
...
buildFeatures {
dataBinding true
}
}
Don't forget to add also the kotlin-kapt plugin at the top:
plugins {
...
id 'kotlin-kapt'
}
Get inspiration from #Bolein95 say.Because it depend on a library that does not support androidx(no setting databinding=true),Written by a colleague who has left.I copy a few necessary files from his github repo, it work!
My project is comprised of two modules, one is the application module and the other is a library module. My build processes works fine until I added two gradle plugins :
This is the root build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
// 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
}
This is a library module build.gradle:
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
resourcePrefix "looping_banner_res_"
defaultConfig {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:support-v4:24.1.0'
}
I don't think there are something wrong with the build files, but I got a error when I run gradle clean :
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
java.lang.IllegalStateException: buildToolsVersion is not specified.
at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:606)
at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:572)
at com.android.build.gradle.BasePlugin$10$1.call(BasePlugin.java:569)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:568)
at com.android.build.gradle.BasePlugin$10.execute(BasePlugin.java:565)
* Where:
Build file '/home/lic/code/private/github/looping-banner/banner/build.gradle' line: 3
Why did this issue happen and how to solve this ?
I have searched some answer, but not work for me, are there something wrong in the two plugins which I import ?
OK, after a lot searchings about this issue, I finally worked it out.
I'm using Gradle 2.14, so I need to change
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
to
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
There are a lot of differences, and here we can see more details.
I had that error until I shorten the version code length from "2017041201" to 8 characters number:
android-versionCode="20170412"
This question is old, but I found it because I was having this problem -
For some reason I got this error from Cordova/Ionic when installing a plugin.
It was fixed when I typed the command
ionic plugin add foo
instead of (leading space)
ionic plugin add foo
i have a same issue, and the problem was that have dot in android-versionCode,
like: android-versionCode="10001.1"
You are missing mavencentral() in repository dependency. Maybe that is causing the issue
repositories {
mavenCentral()
}
I get this error coz of the ANDROID_HOME getting set to /usr/local/Caskroom/android-platform-tools/latest.
I do not know why it's getting set to the above mentioned value.
But after correcting this and setting it to /Users/<user_name>/Library/Android/sdk/, the error goes away.
This worked for me
Remove android / Add android:
cordova platform rm android
cordova platform add android