1
在模擬器上運行的Android應用程序時,我收到以下錯誤:的Android的ClassNotFoundException,類是在APK
I/dalvikvm(2560): Failed resolving Lorg/jacoco/agent/rt/internal_e6e56f0/CoverageTransformer; interface 6277 'Ljava/lang/instrument/ClassFileTransformer;'
W/dalvikvm(2560): Link of class 'Lorg/jacoco/agent/rt/internal_e6e56f0/CoverageTransformer;' failed
W/ClassPathPackageInfoSource(2560): Cannot load class. Make sure it is in your apk. Class name: 'org.jacoco.agent.rt.internal_e6e56f0.CoverageTransformer'. Message: org.jacoco.agent.rt.internal_e6e56f0.CoverageTransformer
W/ClassPathPackageInfoSource(2560): java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_e6e56f0.CoverageTransformer
W/ClassPathPackageInfoSource(2560): at java.lang.Class.classForName(Native Method)
W/ClassPathPackageInfoSource(2560): at java.lang.Class.forName(Class.java:217)
W/ClassPathPackageInfoSource(2560): at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
W/ClassPathPackageInfoSource(2560): at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
W/ClassPathPackageInfoSource(2560): at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
W/ClassPathPackageInfoSource(2560): at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
W/ClassPathPackageInfoSource(2560): at android.test.SimpleCache.get(SimpleCache.java:31)
W/ClassPathPackageInfoSource(2560): at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
W/ClassPathPackageInfoSource(2560): at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
W/ClassPathPackageInfoSource(2560): at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
W/ClassPathPackageInfoSource(2560): at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
W/ClassPathPackageInfoSource(2560): at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
W/ClassPathPackageInfoSource(2560): at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
W/ClassPathPackageInfoSource(2560): at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
W/ClassPathPackageInfoSource(2560): at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
W/ClassPathPackageInfoSource(2560): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4142)
W/ClassPathPackageInfoSource(2560): at android.app.ActivityThread.access$1300(ActivityThread.java:130)
W/ClassPathPackageInfoSource(2560): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
W/ClassPathPackageInfoSource(2560): at android.os.Handler.dispatchMessage(Handler.java:99)
W/ClassPathPackageInfoSource(2560): at android.os.Looper.loop(Looper.java:137)
W/ClassPathPackageInfoSource(2560): at android.app.ActivityThread.main(ActivityThread.java:4745)
W/ClassPathPackageInfoSource(2560): at java.lang.reflect.Method.invokeNative(Native Method)
W/ClassPathPackageInfoSource(2560): at java.lang.reflect.Method.invoke(Method.java:511)
W/ClassPathPackageInfoSource(2560): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
W/ClassPathPackageInfoSource(2560): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
W/ClassPathPackageInfoSource(2560): at dalvik.system.NativeStart.main(Native Method)
W/ClassPathPackageInfoSource(2560): Caused by: java.lang.NoClassDefFoundError: org/jacoco/agent/rt/internal_e6e56f0/CoverageTransformer
W/ClassPathPackageInfoSource(2560): ... 26 more
W/ClassPathPackageInfoSource(2560): Caused by: java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_e6e56f0.CoverageTransformer
W/ClassPathPackageInfoSource(2560): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
W/ClassPathPackageInfoSource(2560): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
W/ClassPathPackageInfoSource(2560): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
W/ClassPathPackageInfoSource(2560): ... 26 more
顯而易見的解決方案是不被包含的依賴。然而,我在我的pom中具有maven依賴項(範圍:編譯)。我甚至去反編譯源代碼:有問題的類位於我的APK中。
謝謝。
我收到類似的錯誤,而我的APK根本沒有運行。 – 2016-06-08 19:21:59