Hi,

the error shows that the JAR file you’re exporting contain classes instrumented 
by JaCoCo. This should not be the case for exported JARs.

Please ask the Android or Gradle project how to configure you’re build 
correctly (both are not maintained by us).

Also try to follow the answers on SO. They look very reasonable to me.

Regards,
-marc


> On 27. Mar 2019, at 10:30, [email protected] wrote:
> 
> Hi,
> 
> I've created the topic in stackoverflow, but even after offering a bounty, 
> not a satisfying reply came actually, so I'm here.
> 
> The topic is there: 
> https://stackoverflow.com/questions/55301766/removing-jacoco-library-dependency-while-exporting-project-as-jar
> 
> Simply what I have and what I'm trying to do is:
> - We have an SDK project written on Android, started to use Jacoco a few 
> months ago, and after that time everytime we export the project as .jar, 
> whether we set the "testCoverageEnabled" true or not, it's causing crash on 
> the app that uses our .jar file as a library.
> 
> The crash is:
> E/AndroidRuntime: FATAL EXCEPTION: main
>    java.lang.NoClassDefFoundError: Failed resolution of: 
> Lorg/jacoco/agent/rt/internal_8ff85ea/Offline;
> 
> Which is kinda popular crash when implementing to the project, but for an sdk 
> project it is weird, as of course jacoco dependency shouldn't be in the 
> library somehow.
> 
> So is there a possibility to exclude jacoco dependencies while exporting the 
> application?
> 
> implementation is something like that: (I've tried with adding additional 
> classpath for offline solution and also with the jacoco version of 0.8.3)
> 
> gradle:
>        classpath 'org.jacoco:org.jacoco.core:0.8.1'
> 
> jacoco {
>    toolVersion = '0.8.1'
> }
> 
> //this adds robolectric tests to coverage report
> tasks.withType(Test) {
>    jacoco.includeNoLocationClasses = true
> }
> 
> task jacocoTestReport(type: JacocoReport, dependsOn: 
> ['testProductionDebugUnitTest',
>                                                      
> 'createProductionDebugCoverageReport']) {
>    group = "Reporting"
>    description = "Generate Jacoco coverage reports after running tests."
> 
>    reports {
>        xml.enabled = true
>        html.enabled = true
>        html.setDestination(new File("$project.buildDir/reports/jacoco/html"))
>    }
> 
>    def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', 
> '**/Manifest*.*', '**/*Test*.*',
>                      'android/**/*.*']
>    def debugTree = fileTree(dir: 
> "$project.buildDir/intermediates/classes/production/debug", excludes: 
> fileFilter)
>    def mainSrc = "$project.projectDir/src/main/java"
> 
>    sourceDirectories = files([mainSrc])
>    classDirectories = files([debugTree])
>    executionData = fileTree(dir: project.buildDir, includes: ['**/*.exec', 
> '**/*.ec'])
> }
> 
> Thanks in advance!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/8c523800-c5d7-4943-b5cf-51108042e8d6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/5348C578-5131-4FF4-AC3C-2E0E2106AD73%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to