Status Update
Comments
aa...@gmail.com <aa...@gmail.com> #2
We've seen this on our project as well, this shows up in the devices log:
I/ActivityManager( 999): Start procno.finn.android.dev for added application no.finn.android.dev : pid=1686 uid=10043 gids={3003, 1015, 1028}
E/Trace ( 1686): error opening trace file: No such file or directory (2)
I/dalvikvm( 1686): Could not find method com.google.android.apps.common.testing.testrunner.ExposedInstrumentationApi.execStartActivity, referenced from method com.google.android.apps.common.testing.testrunner.GoogleInstrumentation.execStartActivity
W/dalvikvm( 1686): VFY: unable to resolve virtual method 253: Lcom/google/android/apps/common/testing/testrunner/ExposedInstrumentationApi;.execStartActivity (Landroid/content/Context;Landroid/os/IBinder;Landroid/os/IBinder;Landroid/app/Activity;Landroid/content/Intent;I)Landroid/app/Instrumentation$ActivityResult;
D/dalvikvm( 1686): VFY: replacing opcode 0x75 at 0x001d
W/dalvikvm( 1686): VFY: invoke type does not match method type of Lno/finn/android/FinnApplication;.isNewVersion
W/dalvikvm( 1686): VFY: rejecting opcode 0x6f at 0x000e
W/dalvikvm( 1686): VFY: rejected Lno/finn/android/FinnApplication;.onCreate ()V
W/dalvikvm( 1686): Verifier rejected class Lno/finn/android/FinnApplication;
W/dalvikvm( 1686): Class init failed in newInstance call (Lno/finn/android/FinnApplication;)
D/AndroidRuntime( 1686): Shutting down VM
W/dalvikvm( 1686): threadid=1: thread exiting with uncaught exception (group=0xb2f22288)
E/AndroidRuntime( 1686): FATAL EXCEPTION: main
E/AndroidRuntime( 1686): java.lang.VerifyError: no/finn/android/FinnApplication
E/AndroidRuntime( 1686): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 1686): at java.lang.Class.newInstance(Class.java:1319)
E/AndroidRuntime( 1686): at android.app.Instrumentation.newApplication(Instrumentation.java:982)
E/AndroidRuntime( 1686): at android.app.Instrumentation.newApplication(Instrumentation.java:967)
E/AndroidRuntime( 1686): at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
E/AndroidRuntime( 1686): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4124)
E/AndroidRuntime( 1686): at android.app.ActivityThread.access$1300(ActivityThread.java:130)
E/AndroidRuntime( 1686): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
E/AndroidRuntime( 1686): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1686): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1686): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 1686): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1686): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1686): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 1686): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 1686): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 999): Error in appno.finn.android.dev running instrumentation ComponentInfo{no.finn.android.dev.test/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner}:
W/ActivityManager( 999): java.lang.VerifyError
W/ActivityManager( 999): java.lang.VerifyError: no/finn/android/FinnApplication
I/ActivityManager( 999): Force stopping packageno.finn.android.dev uid=10043
I/ActivityManager( 999): Killing proc 1686:no.finn.android.dev/u0a43 : force stop
I/ActivityManager( 999): Force finishing activity ActivityRecord{b3d36a40no.finn.android.dev/no.finn.android.ui.homepage.HomeActivity }
W/ActivityManager( 999): Duplicate finish request for ActivityRecord{b3d36a40no.finn.android.dev/no.finn.android.ui.homepage.HomeActivity }
D/AndroidRuntime( 1675): Shutting down VM
I/ActivityManager( 999): Start proc
E/Trace ( 1686): error opening trace file: No such file or directory (2)
I/dalvikvm( 1686): Could not find method com.google.android.apps.common.testing.testrunner.ExposedInstrumentationApi.execStartActivity, referenced from method com.google.android.apps.common.testing.testrunner.GoogleInstrumentation.execStartActivity
W/dalvikvm( 1686): VFY: unable to resolve virtual method 253: Lcom/google/android/apps/common/testing/testrunner/ExposedInstrumentationApi;.execStartActivity (Landroid/content/Context;Landroid/os/IBinder;Landroid/os/IBinder;Landroid/app/Activity;Landroid/content/Intent;I)Landroid/app/Instrumentation$ActivityResult;
D/dalvikvm( 1686): VFY: replacing opcode 0x75 at 0x001d
W/dalvikvm( 1686): VFY: invoke type does not match method type of Lno/finn/android/FinnApplication;.isNewVersion
W/dalvikvm( 1686): VFY: rejecting opcode 0x6f at 0x000e
W/dalvikvm( 1686): VFY: rejected Lno/finn/android/FinnApplication;.onCreate ()V
W/dalvikvm( 1686): Verifier rejected class Lno/finn/android/FinnApplication;
W/dalvikvm( 1686): Class init failed in newInstance call (Lno/finn/android/FinnApplication;)
D/AndroidRuntime( 1686): Shutting down VM
W/dalvikvm( 1686): threadid=1: thread exiting with uncaught exception (group=0xb2f22288)
E/AndroidRuntime( 1686): FATAL EXCEPTION: main
E/AndroidRuntime( 1686): java.lang.VerifyError: no/finn/android/FinnApplication
E/AndroidRuntime( 1686): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 1686): at java.lang.Class.newInstance(Class.java:1319)
E/AndroidRuntime( 1686): at android.app.Instrumentation.newApplication(Instrumentation.java:982)
E/AndroidRuntime( 1686): at android.app.Instrumentation.newApplication(Instrumentation.java:967)
E/AndroidRuntime( 1686): at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
E/AndroidRuntime( 1686): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4124)
E/AndroidRuntime( 1686): at android.app.ActivityThread.access$1300(ActivityThread.java:130)
E/AndroidRuntime( 1686): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
E/AndroidRuntime( 1686): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1686): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1686): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 1686): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1686): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1686): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 1686): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 1686): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 999): Error in app
W/ActivityManager( 999): java.lang.VerifyError
W/ActivityManager( 999): java.lang.VerifyError: no/finn/android/FinnApplication
I/ActivityManager( 999): Force stopping package
I/ActivityManager( 999): Killing proc 1686:
I/ActivityManager( 999): Force finishing activity ActivityRecord{b3d36a40
W/ActivityManager( 999): Duplicate finish request for ActivityRecord{b3d36a40
D/AndroidRuntime( 1675): Shutting down VM
sh...@gmail.com <sh...@gmail.com> #3
I have this same issue and am not using dagger. We do use roboguice though.
ca...@gmail.com <ca...@gmail.com> #4
It seems that there may be an incompatibility between Dagger and Jacoco. In my project I am attempting to use the jacoco gradle plugin directly. What I am seeing is that Dagger generates java and class files with 2 consecutive dollar-signs in the name such as:
MyModule$$ModuleAdapter.java
MyModule$$ModuleAdapter.class
MyModule$$ModuleAdapter$ProvideBusProvidesAdapter
etc.
Jacoco however, seems to be looking for names with single dollar signs:
.../build/classes/debug/com/gravitymobile/haburdio/dagger/MyModule$ModuleAdapter$ProvideBusProvidesAdapter.class (No such file or directory)
MyModule$$ModuleAdapter.java
MyModule$$ModuleAdapter.class
MyModule$$ModuleAdapter$ProvideBusProvidesAdapter
etc.
Jacoco however, seems to be looking for names with single dollar signs:
.../build/classes/debug/com/gravitymobile/haburdio/dagger/MyModule$ModuleAdapter$ProvideBusProvidesAdapter.class (No such file or directory)
mi...@corp.badoo.com <mi...@corp.badoo.com> #5
Hi
I have the same issue VerifyError, and I dont use dagger, howerver I use Mockito
I found this linkhttps://code.google.com/p/powermock/issues/detail?id=355 sounds like this is an ongoing issue from 2011
I have the same issue VerifyError, and I dont use dagger, howerver I use Mockito
I found this link
ss...@gmail.com <ss...@gmail.com> #6
Well, in the PowerMock case the issue seems to originate from Javassist, but AFAIK Jacoco does not use Javassist but Objectweb ASM for bytecode manipulation. Anyway, maybe a similar fix as for Javassist can be applied to Objectweb ASM.
ch...@gmail.com <ch...@gmail.com> #7
Anyone got a work around for this? Like ignore the generated files, or navigating the fileTree and changing file names from $$ to $?
ch...@gmail.com <ch...@gmail.com> #8
I have a workaround for Robolectric + Jacoco + Dagger (http://chrisjenx.com/gradle-robolectric-jacoco-dagger/ ). Yet to try with AndroidTests.
ca...@gmail.com <ca...@gmail.com> #9
I finally had a chance to circle back to this.... Thanks for your post Chris. It works great. I made a slight enhancement to rename the files back after generating the report. This prevents needing to do a full clean after running:
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = false
html.enabled = true
}
classDirectories = fileTree(
dir: './build/classes/debug',
excludes: ['**/R.class',
'**/R$*.class',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector*.class'
])
sourceDirectories = files(coverageSourceDirs)
executionData = files('build/jacoco/testDebug.exec')
renamedFilesMap = [:]
// Hacky fix for issue:https://code.google.com/p/android/issues/detail?id=69174 .
// Rename files with '$$' before generating report, and then rename back after
doFirst {
new File('build/classes/debug').eachFileRecurse { file ->
if (file.name.contains('$$')) {
oldPath = file.path
newPath = oldPath.replace('$$', '$')
file.renameTo(newPath)
renamedFilesMap[newPath] = oldPath
}
}
}
doLast {
renamedFilesMap.each() {
newPath, oldPath ->
new File(newPath).renameTo(oldPath)
}
}
}
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = false
html.enabled = true
}
classDirectories = fileTree(
dir: './build/classes/debug',
excludes: ['**/R.class',
'**/R$*.class',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector*.class'
])
sourceDirectories = files(coverageSourceDirs)
executionData = files('build/jacoco/testDebug.exec')
renamedFilesMap = [:]
// Hacky fix for issue:
// Rename files with '$$' before generating report, and then rename back after
doFirst {
new File('build/classes/debug').eachFileRecurse { file ->
if (file.name.contains('$$')) {
oldPath = file.path
newPath = oldPath.replace('$$', '$')
file.renameTo(newPath)
renamedFilesMap[newPath] = oldPath
}
}
}
doLast {
renamedFilesMap.each() {
newPath, oldPath ->
new File(newPath).renameTo(oldPath)
}
}
}
aa...@gmail.com <aa...@gmail.com> #10
Has anyone gotten this work with tests run on device, with for example espresso?
ma...@gmail.com <ma...@gmail.com> #11
The problem seems to be mainly to do with code coverage functionality not working on Java 1.6 version or above. If you keep the Java version down to 1.5, jacoco code coverage work fine even when using espresso, dagger etc.
xa...@android.com <xa...@android.com> #12
We've identified this as a bug in dx which does not properly handle bytecode generated by jacoco's offline instrumentation.
xa...@android.com <xa...@android.com> #16
[Comment deleted]
ma...@gmail.com <ma...@gmail.com> #18
Can some one throw light as to which version of gradle addresses this issue and what the step are to get it to work correctly? Thanks
xa...@android.com <xa...@android.com> #19
The fix is not in Gradle, it is in dx which will be updated with the Android L SDK.
we...@gmail.com <we...@gmail.com> #20
Shouldn't this be available in a new version of the Build tools, and not the L Platform SDK? Or is the new Build Tools somehow tied to L?
Here's the path to dx in my environment:
android-sdk-macosx/build-tools/20/lib/dx.jar
Here's the path to dx in my environment:
android-sdk-macosx/build-tools/20/lib/dx.jar
si...@gmail.com <si...@gmail.com> #21
[Comment deleted]
re...@netmoms.de <re...@netmoms.de> #22
Will this been released tomorrow together with Android Lollipop?
m....@gmail.com <m....@gmail.com> #23
ss...@gmail.com <ss...@gmail.com> #24
I can confirm that the issue has been fixed for us with buildtools 21.
va...@gmail.com <va...@gmail.com> #25
Also fixed for us.
Description
while developing Android applications (Emulator, DDMS, Eclipse support,
ant scripts...). Use the Developer templates for issues with Android
itself.
Please describe the problem in detail, with the following information (if
applicable)
Host OS: Ubuntu 14.04
SDK tools version (available in the "About" section of the 'android' tool
UI): 22.6.3
Android Studio version: 0.5.7
Platform targeted by your project: 19
Version of the platform running in the emulator: 18
STEPS TO REPRODUCE:
0. Have project that uses Dagger and Android Gradle plugin 0.10+
1. Add 'testCoverageEnabled true' to testing build type
2. Run ./gradlew cC
EXPECTED RESULTS:
Tests should run and get a coverage report in build/reports/coverage.
OBSERVED RESULTS:
Test crashes with
Tests on Nexus_7_4.3(AVD) - 4.3 failed: Instrumentation run failed due to 'java.lang.VerifyError'
03:35:46 E/Device: Error during Sync: Remote object doesn't exist!
null
java.io.IOException: com.android.ddmlib.SyncException: Remote object doesn't exist!
at com.android.builder.testing.ConnectedDevice.pullFile(ConnectedDevice.java:114)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:158)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:42)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: com.android.ddmlib.SyncException: Remote object doesn't exist!
at com.android.ddmlib.SyncService.pullFile(SyncService.java:314)
at com.android.ddmlib.Device.pullFile(Device.java:849)
at com.android.builder.testing.ConnectedDevice.pullFile(ConnectedDevice.java:107)
... 8 more
:connectedAndroidTest FAILED
ADDITIONAL INFORMATION:
Attached sample project.