找不到新的遗物类...我什至不使用新的遗物 [英] New Relic Class Not Found ... I don't even use new relic

查看:68
本文介绍了找不到新的遗物类...我什至不使用新的遗物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我什至没有使用新的遗物,但我却遇到了错误.只是突然发生了.

I don't even use new relic and I'm getting errors for them. It just happened all of the sudden.

我正在使用最新的Android Studio版本(0.61).甚至我的master分支也有相同的错误.我的机器上还有其他项目在使用新的文物,但没有这个项目.该项目不以任何方式使用新的遗物,与其说是依赖于gradle依赖,不如说是.

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.

我尝试清除gradle缓存并重新下载所有第三方库,但没有用.

I've tried clearing out my gradle cache and re-downloading all the third party libs, didn't work.

StackTrace:

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模块:

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:

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

修改

该项目现在根据每个用户建议在build.gradle中导入New Relic.这解决了问题,但我仍在探索原因,因为似乎没有必要. 引发错误的类在Path的JobQueue库中,该库在4个月内没有更新,并且我的应用运行良好,这只是突然开始发生.在第三方库中出错的类甚至都没有使用New Relic.

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.

编辑2

优先级作业队列 lib 不使用新的遗物.我不知道堆栈跟踪为什么这么说,就像一条红鲱鱼.我听说New Relic SDK修改了Android API并给出了奇怪的错误.但是同样,我在项目中不使用新的遗物.是否有可能在另一个项目中使用NR sdk以某种方式感染了这个项目(可能是Android Studio中的错误)?

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)?

编辑3

好的,原始堆栈跟踪中的Priority Job Queue lib绝对是错误的标志.在JobQueue有机会访问它之前,我继续访问了我自己的提供程序(知道这将迫使在JobQueue lib之前创建我自己的数据库).我的逻辑是,如果Android Sqlite被New Relic感染,那么它将在我自己的OpenHelper上引起类似的错误.

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)

编辑4

我只是在没有在任何项目中安装New Relic库的机器上运行项目,并且运行良好.我认为这是有力的证据,表明New Relic正在使用其插件/库进行有趣的操作.

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.

修改5

我更新了gradle-wraper.properties文件以使用rc-1发行版,这似乎已经解决了问题.我从一个评论者建议的build.gradle中删除了新的遗物依赖项,该应用程序仍然可以正常运行.

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

我的猜测是,New Relic库被缓存在1.12-all gradle发行版中,这是导致其他项目出错的常见链接.我仍然不确定是什么使New Relic库与众不同,以便gradle认为它应该将其包含在其他项目中.鉴于不久前New Relic带有Eclipse插件的问题几乎相同,因此我认为假设Maven发行版中存在某些问题是合理的.我有一张支持票可供他们使用,我将继续进行调查并向您报告.

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.

奇怪的是,如果我删除〜/.gradle目录中的所有gradle发行版/缓存/etc,并尝试使用1.12-all版本,它仍然会抛出该新的遗留错误.唯一有效的方法是使用1.12-rc-1-all gradle发行版.

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.

推荐答案

Android Studio似乎已切换到

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.

这篇关于找不到新的遗物类...我什至不使用新的遗物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆