New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileNotFound Exception #5
Comments
Lets find it out who needs work ... Get you coverage report when you run connectedCheck (espresso tests)? When yes then dagger + jacoco works together and it should be possible with robolectric. Create a sample project setup with dagger to show us your error, then we can try out. Class not found mean most times it is missing in the classpath. Try out to play with this line What is your intention to use dagger? Maybe it would be enough to use AndroidAnnotions as your dependency injection framework. |
I'm planning to create a few sample applications in the upcoming week. I'll keep you informed. |
It's about injection which is not compatible with jacoco I guess, both Butterknife as Dagger are not compatible after testing some things. |
As it's not mentioned here, at least those projects can have coverage with excluding the generated classes: exclude: '/$.class' |
have you tried it or maybe @josomers could you try it please? current i don't plan to include dagger or butterknife until someone has a good reason for me. But I would be glad if someone found a way to get it work and share it with me. Then i will mention it in the wiki how to include dagger or butterknife and get this code under test. |
Very nice suggestion by @dpreussler! I tried and modified it a little, but this is my working solution: https://gist.github.com/josomers/9f90b017e321c54bb918 Make sure to replace 'my-project' with the name of your project. |
here is a solution without excluding the generated files http://chrisjenx.com/gradle-robolectric-jacoco-dagger/ the main part is to add following part inside
|
i use the solution with my project , task skipped. apply plugin: 'jacoco'
android {
buildTypes {
debug {
testCoverageEnabled true
}
}
jacoco {
version "0.7.1.201405082137"
}
def coverageSourceDirs = [
'src/main/java',
]
task jacocoTestReport(type: JacocoReport) {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
classDirectories = fileTree(
dir: './build/intermediates/classes/debug',
excludes: ['**/R*.class',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector*.class'
])
sourceDirectories = files(coverageSourceDirs)
executionData = files("$buildDir/jacoco/testDebug.exec")
doFirst {
new File("$buildDir/intermediates/classes/").eachFileRecurse { file ->
if (file.name.contains('$$')) {
file.renameTo(file.path.replace('$$', '$'))
}
}
}
} result: ./gradlew jacocoTestReport --stacktrace
setup
create beta
cleanPublish:/home/sunhao/Project/android/build/apks
:app:jacocoTestReport SKIPPED
BUILD SUCCESSFUL
Total time: 21.856 secs
|
Hi,
I'm trying to make my Robolectric tests work with Jacoco support, but it seems that the plugin is not compatible with Dagger as it can not find some class files with '$$' in the filename. For this reason I got a FileNotFoundException when executing the 'jacocoTestReport' task. Is this related to the 'known issue' on this page: http://tools.android.com/tech-docs/new-build-system or is this something that needs to be fixed in Dagger, Android build tools or the Jacoco plugin?
Thanks.
The text was updated successfully, but these errors were encountered: