newrelic / newrelic-android-agent

SDK to enable instrumentation of Android mobile apps in New Relic
Apache License 2.0
13 stars 11 forks source link

Can't build project when exclude bcprov-jdk15to18 library #189

Closed ilya-savinkov closed 4 months ago

ilya-savinkov commented 5 months ago

Description

I excluded bcprov-jdk15to18 library, because I had duplicated classes between bcprov-jdk15to18 and bcprov-jdk18on libraries in my project. After that I can't make release build, because it is failed with exception from proguard.

Steps to Reproduce

1) Include library with bcprov-jdk15to18 dependency like stripe.

implementation("com.stripe:stripe-android:20.39.0")

2) Inclide library with bcprov-jdk18on dependency like sumsub.

implementation("com.sumsub.sns:idensic-mobile-sdk:1.29.0")

3) Exclude bcprov-jdk15to18 library

android {
    configurations {
        all {
            exclude(group = "org.bouncycastle", module = "bcprov-jdk15to18")
        }
    }
}

4) Make release build with R8

Expected Behavior

You can make release build with R8

Relevant Logs / Console output

* What went wrong:
Execution failed for task ':app:minifyStageGlobalReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete, origin:
        app/build/intermediates/classes/stageGlobalRelease/ALL/
        newrelicTransformClassesForStageGlobalRelease/classes.jar:org
        /bouncycastle/asn1/bsi/BSIObjectIdentifiers.class

Your Environment

Newrelic version is 7.3.0

cthomas-newrelic commented 5 months ago

@ilya-savinkov Thank you for your submission. We are currently researching this issue, and trying to get a patch out as soon as possible. The crux of the problem is manifest merging during instrumentation.

cthomas-newrelic commented 5 months ago

@ilya-savinkov Have you verified that, with this Gradle configuration exclusion, the build is successful without the NR agent?

ilya-savinkov commented 5 months ago

@cthomas-newrelic Sure, if I remove newrelic plugin, build is built successfully

thiago-youx commented 5 months ago

I'm also having this issue when using NR version 7.2.1 or higher, version 7.2.0 still works.

My problem is with the "org.bouncycastle:bcpkix-jdk15on" dependency.

* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete, origin: /home/thiago.you/AndroidStudioProjects/rentcars/app/build/intermediates/classes/release/ALL/newrelicTransformClassesForRelease/classes.jar:org/bouncycastle/LICENSE.class

[...]

Caused by: [CIRCULAR REFERENCE: com.android.tools.r8.internal.vc: Invalid empty classfile]

I can build the project when using this dependency version:

implementation 'org.bouncycastle:bcpkix-jdk15on:1.52'

Any version from this lib different from 1.52 breaks the build with NR.

cthomas-newrelic commented 5 months ago

@ilya-savinkov If you are comfortable building the agent, we have a branch that should address this issue.

PositiveThinksNegative commented 5 months ago

I'm having the same issue here