gpt4 book ai didi

android - 未找到新的遗物类...我什至不使用新的遗物

转载 作者:IT老高 更新时间:2023-10-28 23:02:09 24 4
gpt4 key购买 nike

我什至不使用新的遗物,而且我遇到了错误。它只是突然发生的。

我使用的是最新的 Android Studio 版本 (0.61)。甚至我的主分支也有同样的错误。我的机器上还有其他项目使用新的遗物,但不是这个。这个项目不以任何方式使用 new relic,与其说是一个任性的 gradle 依赖。

我已尝试清除我的 gradle 缓存并重新下载所有第三方库,但没有成功。

堆栈跟踪:

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:

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:

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 个月内没有更新,而我的应用程序一直运行良好,这只是突然发生的。在 3rd 方库中出错的类甚至不使用 New Relic。

编辑 2

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

编辑 3

好的,原始堆栈跟踪中的 Priority Job Queue lib 绝对是一个错误标志。在 JobQueue 有机会访问它之前,我继续访问了我自己的 Provider(知道这将强制在 JobQueue 库之前创建我自己的数据库)。我的逻辑是,如果 Android Sqlite 被 New Relic 感染,那么它会在我自己的 OpenHelper 上导致类似的错误,确实如此。

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 正在使用他们的插件/库做一些有趣的事情。

编辑 5

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

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 发行版发生了一些事情是合理的。我已经向他们开放了支持票,我将继续调查并报告。

奇怪的是,如果我删除 ~/.gradle 目录中的所有 gradle 发行版/缓存/等,并尝试使用 1.12-all 发行版,它仍然会引发新的遗物错误。唯一可行的方法是我使用 1.12-rc-1-all gradle 发行版。

最佳答案

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

为我工作

关于android - 未找到新的遗物类...我什至不使用新的遗物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24226772/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com