Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New Relic Class Not Found ... I don't even use new relic

Tags:

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.

like image 346
Aaron Avatar asked Jun 15 '14 05:06

Aaron


1 Answers

./gradlew --stop ./gradlew cleanBuildCache ./gradlew clean 

works for me

like image 99
sunwei Avatar answered Oct 19 '22 03:10

sunwei