gpt4 book ai didi

android - java.lang.NoClassDefFoundError : Failed resolution of: Lorg/jacoco/agent/rt/internal_773e439/Offline; 错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:02:26 25 4
gpt4 key购买 nike

我有一个 android 应用程序,它依赖于我自己构建的一些 android 库。如果我使用 build.gradle 中指定的库依赖项构建应用程序,则会出现以下异常。

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

如果我删除依赖项,而是从库中复制相关类并运行应用程序,它运行得非常好。此外,我还有其他依赖项,如 junit 和 app-compat,这些似乎不会导致此问题。任何想法可能导致此问题的原因是什么?

  • 我已尝试将 jacoco 插件指定为以下版本而且它似乎仍然不起作用。
  • 我已尝试从库中删除 jacoco 依赖项:否效果。

我的主要 build.gradle 看起来像这样:

    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()
}
}

最佳答案

更新 Android Studio 后出现此错误。我发现在“设置”中关闭“即时运行”可以解决这个问题。

关于android - java.lang.NoClassDefFoundError : Failed resolution of: Lorg/jacoco/agent/rt/internal_773e439/Offline; 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37152590/

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