Skip to content

Issue with Proguard and AGP 7.0.2 (RxDogTag 1.0.1) #73

@mikef-dk

Description

@mikef-dk

We recently encountered a weird issue after upgrading to the Android Gradle Plugin 7.0.2. When running our release build and therefore Proguard, the application crashes right at the start of the application with an ExceptionInInitializerError when RxDogTag.install() is called.

Stacktrace:

java.lang.ExceptionInInitializerError
        at com.uber.rxdogtag.RxDogTag$Builder.install(:483)
        at com.uber.rxdogtag.RxDogTag.install(:103)
        at com.mikef.rxdogtagissue.DogTagApplication.onCreate(:12)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712)
        at android.app.ActivityThread.access$1300(ActivityThread.java:237)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' on a null object reference
        at com.uber.rxdogtag.RxDogTag$Configuration.<clinit>

After investigating this issue a little bit I found the root cause in our Proguard configuration:

-repackageclasses ''

When this is set the aforementioned issue occurs. When going back to AGP 4.2.2 there is no issue, same thing when we remove this flag. I can't tell exactly why exactly this happens and whether it is the fault of RxDogTag or the Android Gradle Plugin.
For we now we removed this Proguard flag in order to solve the issue.

I've also created a super simple sample repository in order to reproduce this issue.

Library version:
1.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions