I don't even use new relic and I'm getting errors for them. It just happened all of the sudden.
I'm using the latest Android Studio build (0.61). Even my master branch has the same error. There are other projects on my machine that use new relic, but not this one. This project does not use new relic in any way, not so much as a wayward gradle dependency.
I've tried clearing out my gradle cache and re-downloading all the third party libs, didn't work.
StackTrace:
06-15 01:05:54.872 20117-20117/com.waxwings.happyhour.staging D/HappyHourApplication﹕ CREATE TABLE job_holder (_id integer primary key autoincrement , `priority` integer, `group_id` text, `run_count` integer, `base_job` byte, `created_ns` long, `delay_until_ns` long, `running_session_id` long, `requires_network` integer );
06-15 01:05:54.874 20117-20117/com.waxwings.happyhour.staging D/AndroidRuntime﹕ Shutting down VM
06-15 01:05:54.877 20117-20117/com.waxwings.happyhour.staging E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.waxwings.happyhour.staging, PID: 20117
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/newrelic/agent/android/instrumentation/SQLiteInstrumentation;
at com.path.android.jobqueue.persistentQueue.sqlite.DbOpenHelper.onCreate(DbOpenHelper.java:42)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
at com.path.android.jobqueue.persistentQueue.sqlite.SqliteJobQueue.<init>(SqliteJobQueue.java:42)
at com.path.android.jobqueue.JobManager$DefaultQueueFactory.createPersistentQueue(JobManager.java:594)
at com.path.android.jobqueue.JobManager.<init>(JobManager.java:77)
at com.waxwings.happyhour.HappyHourApplication.configureJobManager(HappyHourApplication.java:84)
at com.waxwings.happyhour.HappyHourApplication.onCreate(HappyHourApplication.java:38)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1030)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425)
at android.app.ActivityThread.access$1500(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.newrelic.agent.android.instrumentation.SQLiteInstrumentation" on path: DexPathList[[zip file "/data/app/com.waxwings.happyhour.staging-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.waxwings.happyhour.staging-1, /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.path.android.jobqueue.persistentQueue.sqlite.DbOpenHelper.onCreate(DbOpenHelper.java:42)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
at com.path.android.jobqueue.persistentQueue.sqlite.SqliteJobQueue.<init>(SqliteJobQueue.java:42)
at com.path.android.jobqueue.JobManager$DefaultQueueFactory.createPersistentQueue(JobManager.java:594)
at com.path.android.jobqueue.JobManager.<init>(JobManager.java:77)
at com.waxwings.happyhour.HappyHourApplication.configureJobManager(HappyHourApplication.java:84)
at com.waxwings.happyhour.HappyHourApplication.onCreate(HappyHourApplication.java:38)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1030)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425)
at android.app.ActivityThread.access$1500(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
Suppressed: java.lang.ClassNotFoundException: com.newrelic.agent.android.instrumentation.SQLiteInstrumentation
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)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Class "Lcom/newrelic/agent/android/instrumentation/SQLiteInstrumentation;" not found
... 23 more
build.gradle for module:
apply plugin: 'android'
apply plugin: 'newrelic'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
useOldManifestMerger true
productFlavors {
staging {
applicationId "com.waxwings.happyhour.staging"
}
production {
applicationId "com.waxwings.happyhour"
}
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile 'com.path:android-priority-jobqueue:1.1.2'
compile "com.android.support:support-v4:19.1.0"
compile 'com.google.android.gms:play-services:4.4.52'
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/wearable-preview-support.jar')
compile group: 'com.squareup.okhttp', name: 'okhttp', version: '1.5.3'
compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
compile 'com.jakewharton:butterknife:5.0.1'
compile 'com.squareup.retrofit:retrofit:1.5.1'
compile 'com.squareup:otto:+'
compile 'com.squareup.phrase:phrase:+'
compile 'com.newrelic.agent.android:android-agent:3.402.0'
// Mockito dependencies
androidTestCompile "org.mockito:mockito-core:1.9.5"
androidTestCompile files(
'libs/dexmaker-1.0.jar',
'libs/dexmaker-mockito-1.0.jar')
androidTestCompile ('com.squareup:fest-android:1.0.8'){
exclude group:'com.android.support', module: 'support-v4'
}
androidTestCompile 'com.squareup.spoon:spoon-client:1.1.1'
androidTestCompile('junit:junit:4.11') {
exclude module: 'hamcrest-core'
}
androidTestCompile('com.jakewharton.espresso:espresso:1.1-r3') {
exclude group: 'org.hamcrest:hamcrest-core:1.1'
exclude group: 'org.hamcrest:hamcrest-library:1.1'
exclude group: 'org.hamcrest', module: 'hamcrest-integration'
exclude group:'com.android.support', module: 'support-v4'
}
androidTestCompile ('com.jakewharton.espresso:espresso-support-v4:1.1-r3'){
exclude group:'com.android.support', module: 'support-v4'
}
}
build.gradle for project:
buildscript {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/comnewrelic-1153'
}
maven {
url 'https://oss.sonatype.org/content/repositories/comnewrelic-1154'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
classpath 'com.newrelic.agent.android:agent-gradle-plugin:3.402.0'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/comnewrelic-1153'
}
}
}
Edit
The project now imports New Relic in the build.gradle per a user suggestions. This fixed the issue but I'm still exploring why, as it doesn't seem like it should be necessary.
The class throwing the error is in Path's JobQueue lib, the library hasn't been updated in 4 months, and my app has been running fine, this just started happening suddenly. The class that is erroring in the 3rd party lib doesn't even use New Relic.
Edit 2
The priority job queue lib does not use new relic. I have no clue why the stack trace says it does, seems like a red herring. I've heard the New Relic SDK modifies the Android API and gives weird errors. But again, I don't use new relic in my project. Is it possible using the NR sdk in another project somehow infected this one (maybe a bug in Android Studio)?
Edit 3
OK, the Priority Job Queue lib in the original stack trace is definitely a false flag. I went ahead and accessed my own Provider before the JobQueue had a chance to access its (knowing this would force the creation of my own DB ahead of the JobQueue lib). My logic was that if Android Sqlite was being infected by New Relic then it would cause a similar error on my own OpenHelper, it did.
06-15 15:29:39.848 1368-1368/com.waxwings.happyhour.staging W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa4d81b20)
06-15 15:29:39.848 1368-1368/com.waxwings.happyhour.staging E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.waxwings.happyhour.staging, PID: 1368
java.lang.NoClassDefFoundError: com.newrelic.agent.android.instrumentation.SQLiteInstrumentation
at com.waxwings.happyhour.services.HHOpenHelper.onCreate(HHOpenHelper.java:56)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
at com.waxwings.happyhour.services.HappyHourProvider.query(HappyHourProvider.java:121)
at android.content.ContentProvider.query(ContentProvider.java:857)
at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
at android.content.ContentResolver.query(ContentResolver.java:461)
at android.content.ContentResolver.query(ContentResolver.java:404)
at com.waxwings.happyhour.HappyHourApplication.onCreate(HappyHourApplication.java:39)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Edit 4
I just ran the project on a machine that has never had a New Relic library installed in any project and it ran fine. I think this is pretty strong evidence that New Relic is doing something funny w/ their plugin/library.
Edit 5
I updated my gradle-wraper.properties file to use the rc-1 distribution and that seems to have fixed the problem. I removed the new relic dependencies from my build.gradle that one commenter suggested, and the app still runs fine.
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-rc-1-all.zip
My guess is that the New Relic library was being cached in the 1.12-all gradle distro and this was the common link causing other projects to error. I'm still not sure what makes the New Relic library different such that gradle thinks it should include it in other projects. Given that New Relic had an almost identical issue w/ their Eclipse plugin not too long ago, I think it's reasonable to assume there's something going on w/ their Maven distribution. I have a support ticket open with them and I will continue to investigate and report back.
The odd part is if I delete all the gradle distributions/caches/etc in ~/.gradle dir and try to use the 1.12-all distro it still throws that new relic error. The only way it will work is if I use the 1.12-rc-1-all gradle distro.
./gradlew --stop
./gradlew cleanBuildCache
./gradlew clean
works for me
It looks like Android Studio switched over to the gradle daemon for faster builds. Unfortunately, this caches parts of the New Relic agent and it's necessary to stop the daemon when you switch to a project without the agent (or a different version. You can accomplish this simply by running:
gradle --stop
You'll also want to clean your project to ensure the classes are rebuilt and dexed.
While this should get you up and running for now, we'll work on a fix for this issue right away and you can expect it in the next version of the agent.
I tried gradle --stop but it didn't work.
Delete .gradle directory and sync project again, it worked.
I faced the weird issue of NoClassDefFoundError in kitkat. but it was working fine on lollipop.
I tried all the above fix but didn't work.
Finally I come to know that its because of multidex error. I crossed 65k method.
So,I followed this tutorial from android developer site. and worked like charm
Related
guys i have two questions:
1) how to test complete app (i mean run test, not unit) on each api from minSDK version which i set up. Is it any auto process for that?
2) after publish my app i have ANR error on my app publish console (system run 4.4 Kitkat):
java.lang.RuntimeException:
at android.app.ActivityThread.installProvider(ActivityThread.java:5011)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4582)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4522)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method:0)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method:0)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:4996)
i set up avd emulator with similar config on my android studio i after compile i have below exception:
1829-2839/com.google.android.gms.persistent E/LoadManifestTask: Can't find Chimera operation impl class com.google.android.location.copresence.GcmRegistrationChimeraReceiver dropping operation
java.lang.ClassNotFoundException: Didn't find class "com.google.android.location.copresence.GcmRegistrationChimeraReceiver" on path: DexPathList[[zip file "/system/framework/com.android.media.remotedisplay.jar", zip file "/system/framework/com.android.location.provider.jar", zip file "/system/priv-app/PrebuiltGmsCore.apk", zip file "/data/data/com.google.android.gms/code_cache/secondary-dexes/PrebuiltGmsCore.apk.classes2.zip", zip file "/data/data/com.google.android.gms/code_cache/secondary-dexes/PrebuiltGmsCore.apk.classes3.zip", zip file "/data/data/com.google.android.gms/code_cache/secondary-dexes/PrebuiltGmsCore.apk.classes4.zip", zip file "/data/data/com.google.android.gms/code_cache/secondary-dexes/PrebuiltGmsCore.apk.classes5.zip"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at bws.<init>(:com.google.android.gms:799)
at bwt.run(:com.google.android.gms:2049)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
[ 05-25 03:04:16.195 1623: 1638 D/ ]
HostConnection::get() New Host Connection established 0xb9183a30, tid 1638
Any Idea what cuse this problem?
My app work fine on Lollipop and Nugat.
I paste also my gradle:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId 'com.fff.hhh'
minSdkVersion 15
targetSdkVersion 25
versionCode 8
versionName '4.0'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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'
compile 'com.google.android.gms:play-services:10.2.6'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
As described official docs:
You are strongly encouraged to use the GoogleApiClient class to
access Google Play services features. This approach allows you to
attach an OnConnectionFailedListener object to your client. To
detect if the device has the appropriate version of the Google Play
services APK, implement the onConnectionFailed() callback method. If
the connection fails due to a missing or out-of-date version of the
Google Play APK, the callback receives an error code such as
SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED, or
SERVICE_DISABLED. ... Another approach is to use the
isGooglePlayServicesAvailable() method. You get a reference to the
singleton object that provides this method using
GoogleApiAvailability.getInstance(). You might call this method in
the onResume() method of the main activity. If the result code is
SUCCESS, then the Google Play services APK is up-to-date and you can
continue to make a connection.
Please make sure you're following these rules.
To test the app against the particular version :
1. Write espresso test
2. run those tests on the device with desired api level
To solve the gcm problem Add
apply plugin: 'com.google.gms.google-services'
at the end of your build.gradle you have pasted above.
I recently needed to use Google GCM in my project. From its website it is said:
Firebase Cloud Messaging (FCM) is the new version of GCM. It inherits
the reliable and scalable GCM infrastructure, plus new features! See
the FAQ to learn more. If you are integrating messaging in a new app,
start with FCM. GCM users are strongly recommended to upgrade to FCM,
in order to benefit from new FCM features today and in the future.
In order to setup a new Firebase application, I've followed the instructions provided at the official website and did the following:
Created a new Firebase app in the web console and got my json from there - after providing the correct package of my app;
At the top level project's gradle file, I've added classpath 'com.google.gms:google-services:3.0.0' in the dependency section;
At my module's gradle file, I've added: compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0' and in the last line of it, I've added: apply plugin: 'com.google.gms.google-services';
Full Gradle files are provided below:
Top level gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module's gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "br.com.gogame"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
...
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
...
}
apply plugin: 'com.google.gms.google-services'
When I start my app I get this stacktrace:
05-23 14:04:55.109 13368-13368/br.com.gogame I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzqq$zzd>
05-23 14:04:55.109 13368-13368/br.com.gogame I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzqq$zzd>
05-23 14:04:55.110 13368-13368/br.com.gogame I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzqq$zzc>
05-23 14:04:55.110 13368-13368/br.com.gogame I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzqq$zzc>
05-23 14:04:55.126 13368-13368/br.com.gogame E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.NoSuchMethodError: No static method zzy(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzx; or its super classes (declaration of 'com.google.android.gms.common.internal.zzx' appears in /data/app/br.com.gogame-2/base.apk:classes26.dex)
at com.google.android.gms.measurement.internal.zzt.zzaU(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-23 14:04:55.131 13368-13368/br.com.gogame I/FirebaseInitProvider: FirebaseApp initialization successful
05-23 14:04:55.133 13368-13368/br.com.gogame E/AndroidRuntime: FATAL EXCEPTION: main
Process: br.com.gogame, PID: 13368
java.lang.NoSuchMethodError: No static method zzy(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzx; or its super classes (declaration of 'com.google.android.gms.common.internal.zzx' appears in /data/app/br.com.gogame-2/base.apk:classes26.dex)
at com.google.android.gms.measurement.internal.zzt.zzaU(Unknown Source)
at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Any help solving this problem will be very appreciated!
Regards
Well, after struggle a lot I found what was causing my problem. Basically I had two libraries modules - that happened to be of my own - each one of them importing different versions of com.android.support:appcompat-v7.* and google play services. Made all of them import the same version and problem is gone.
I met the same error, solved by upgrade firebase-core:
dependencies {
compile 'com.google.firebase:firebase-core:9.0.2'
}
Care to see that all the dependencies should have same version
dependencies {
implementation 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 'com.android.support:appcompat-v7:25.2.0'
implementation 'com.android.support:design:25.2.0'
implementation 'com.android.support:support-v4:25.2.0'
implementation 'com.google.firebase:firebase-auth:10.0.1'
implementation 'com.android.support:cardview-v7:25.2.0'
implementation 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
}
I faced the Same Issue, but after some r & d and I came to known the problem was in Gradle i.e,
compile "com.android.support:support-v4:+"
then I just removed the + and replaced actual version ie,
compile "com.android.support:support-v4:23.1.0"
then it started working
For me a completely unrelated import caused this error
compile 'com.aurelhubert:ahbottomnavigation:1.3.3'
When I removed it everything was fine
In my case, the problem occurs because i had put "apply plugin: 'com.google.gms.google-services'" inside the dependencies of the modules build.grandle insteand of putting it at the end of the file.
I had the same issue, fixed by upgrading to play-services-auth:10.0.1:
dependencies {
......
//implementation 'com.google.android.gms:play-services-auth:9.0.0'
implementation 'com.google.android.gms:play-services-auth:10.0.1'
....
}
You can check the dependencies with gradle command
./gradlew app:dependencies
As Edgar said ensure that all the dependency libraries has same version.
If not then you can exclude that dependency using
compile('your dependency') {
exclude group: 'lib to be removed'
}
And add that dependency yourself.
add compile 'com.google.android.gms:play-services:9.0.0' into your app level build.gradle file
Me, after struggle all night because my dependencies' version are the same. After adding Firebase Analytics, when I edited the code and run to my device my app crashed with Rejecting re-init on previously-failed class com.google.android.gms... I have to clean project and run again, then it worked fine but will be crashed again if I edit the code.
My problem was caused by "useProguard false" from following this guide https://developer.android.com/studio/build/shrink-code.html
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
but I disabled Instant Run so remove "useProguard false" fixed my problem.
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
More complete answer for newbies. #Edgar is correct, Thanks!
Error: "Firebase API initialization failure" can be found in logcat of Android Monitor is due to incompatible library version. And it can be any libraries that you compile your app with in Project perspective: go to: Your-app-directory/app/build.gradle
In my case I have to match these 2 module version and that solved this error message:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.1'
I attached here the screen shot so you can see all of it.
In My case i forgot to add this with in App Level build
implementation 'com.google.firebase:firebase-messaging:9.6.0'
So i got the FireBase firebase-api-initialization-failure
I have an android application which depends on some android libraries I have built on my own.
If I build the application with the library dependencies specified in the build.gradle then I get the following exception.
-6694/com.mycompany.myproject D/AndroidRuntime: Shutting down VM
05-10 18:47:55.986 6694-6694/com.mycompany.myproject E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycompany.myproject, PID: 6694
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_773e439/Offline;
at com.mycompany.ui.components.ListArrayAdapter.$jacocoInit(ListArrayAdapter.java)
at com.mycompany.ui.components.ListArrayAdapter.<init>(ListArrayAdapter.java)
at com.mycompany.myproject.NationalityFragment.onCreateView(NationalityFragment.java:47)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:602)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)
at android.app.Activity.performStart(Activity.java:5953)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
If I remove the dependencies and instead copy the concerned classes from the libraries and run the application, it runs perfectly fine.
Also I have other dependencies like junit and app-compat and those don't seem to cause this issue. Any ideas what might be causing this issue?
I have tried specifying the jacoco plugin to the following version
and it still doesn't seem to work.
I have tried removing jacoco dependencies from the libraries : no
effect.
My main build.gradle looks like this :
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
subprojects {
project.ext.set('compileSdkVersion', 23)
project.ext.set('buildToolsVersion', '23.0.3')
project.ext.set('minSdkVersion', 19)
project.ext.set('targetSdkVersion', 23)
project.ext.set('versionCode', 1)
project.ext.set('versionName', '1.0-SNAPSHOT')
project.ext.set('javaVersion', JavaVersion.VERSION_1_7)
group 'com.mycompany.myproject'
version = project.ext.get('versionName')
repositories {
mavenLocal()
mavenCentral()
}
}
I got this error after updating Android Studio. I found out that switching off Instant Run in Settings fixed it.
According to here, you'll need to jacocoagent.jar put on the classpath. In other words, you'll need to compile the same version of jacocoagent.jar in gradle.
First check the version code here(In your situation is version0.7.4.201502262128) and then download jars from here.
Put jacocoagent.jar in libs folder then add compile fileTree(dir: 'libs', include: ['jacocoagent.jar']) in your app's build.gradle.
bijang is correct. You need to add the jacocoagent.jar. Rather than including the jar directly, pull it down from maven. The version of the jacocoagent has to match the version of the jacocoplugin since the Offline.class package has a commmit hash. Here are my dependencies:
compile 'org.jacoco:jacoco-maven-plugin:0.7.9'
compile 'org.jacoco:org.jacoco.agent:0.7.9:runtime'
For Jacoco 0.8.7 i added the following to the app/build.gradle to resolve the issue
implementation 'org.jacoco:org.jacoco.agent:0.8.7'
I'm migrating my android app from Parse android sdk 1.8.1 to 1.13.0. So i can point my app to my hosted Parse server but when i replace the old Parse-1.8.1 to new Parse-1.13.0 library and update the server details in the app. App crash as soon as i run it.
When app crash it shows me below error message in log
03-31 13:55:37.196 2247-2247/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.name.appname, PID: 2247
java.lang.NoClassDefFoundError: bolts.TaskCompletionSource
at com.parse.ParseTaskUtils.callbackOnMainThreadAsync(ParseTaskUtils.java:100)
at com.parse.ParseTaskUtils.callbackOnMainThreadAsync(ParseTaskUtils.java:87)
at com.parse.ParseQuery.findInBackground(ParseQuery.java:1211)
at com.ccna.practicequiz.QuizApplication.onCreate(QuizApplication.java:80)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Dependencies
dependencies {
compile files('libs/Parse-1.13.0.jar')
compile files('libs/bolts-android-1.1.4.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
}
Changes in the app to point app to hosted server
//Parse.initialize(this, "<key>", "<key>");
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("appid")
.clientKey("<random key>")
.server("http://192.168.1.177:1337/parse/") // '/' important after 'parse'
.build());
App is working fine if i use the old Parse-1.8.1 library.I already tried cleaning jar by doing 'gradlew clean jarRelease' and 'gradlew clean testDebug' files still no luck
You might need to update your JAR files, but why use JAR files when you could just grab the dependencies with Gradle?
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
Also, Play Services is currently 8.4.0 and unless you actually need all the Play Services, then it is recommended to just pick the dependencies you really use.
You have to upgrade bolts-android-1.1.4.jar to the latest version: 1.4.0
I have a multi module Android project. Some input data for the environment:
Android Studio 1.0.1
Gradle 2.2.1 (Gradle Wrapper)
Java 1.7.0_71
Android Gradle Plugin: 1.0.1
compileSdkVersion = 21
buildToolsVersion = '21.1.2'
minSdkVersion = 14
targetSdkVersion = 21
When I run the project from Android Studio. The application compiles and executes properly on the device (for all build variants). But when I try to assemble the app from the terminal with ./gradlew clean assembleDebug or any other build variant (I have 4: debug, alpha, beta, release) the build succeeds but when I try to run it the app crashes with a java.lang.NoClassDefFoundError for any of the classes defined in a module project.
I've excluded ProGuard as a suspect because it's run only on the release varian. But the issue is consistent for all builds.
Also I checked that modules don't contain repetitive dependencies.
EDIT
One posible Stack trace:
9553-9553/my.package.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: my.package.app, PID: 9553
java.lang.NoClassDefFoundError: my.package.module1.Go
at my.package.app.MyApplication.onCreate(MyApplication.java:59)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4729)
at android.app.ActivityThread.access$1600(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
As you see class Go is part of package my.package.module1 which is defined in a sub module :module1 (See build script source).
Part of the gradle build:
buildscript {
repositories {
mavenCentral()
}
dependencies{
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
android {
// ...
// Compile and tools version
defaultConfig {
// Target sdk and so on
applicationId 'my.package.app'
// ...
// Other stuff regarding version
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release { // ... }
alpha { // ... }
beta { // ... }
debug { // ... }
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
// ...
// Standatrt dependencies like support lib and others
compile project(':module1')
compile project(':module2')
compile project(':module3')
// Other moduels
}
After playing around with the build scripts and comparing the way AS assembles a build with the terminal one I've stumbled into the next differences:
When AS cleans the project it also executes generate<BuildVarian>Sources and generate<BuildVarian>TestSources for all module projects (this is scheduled in such a way that it's always executed before running the actual assemble command)
When running ./gradlew clean assembleDebug from the terminal it seams that gradle doesn't fetch the exported sub module arrs on time. Could be a bug in Gradle 2.2 (2.2.1) or the Android Gradle Plugin - I don't recall having such issues with previous versions
When running ./gradlew clean generateDebugSources generateDebugTestSources assembleDebug the issue is still in place - May be also related to the bug.
Temp solution
Execute the the following commands sequentially:
# ./gradlew clean generate<BuildVariant>Sources generate<BuildVariant>TestSources
# ... task output
# ...
# ./gradlew assemble<BuildVariant>
This way the output apk is assembled with all module projects
Longterm solution
Fired an issue ticket here