question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Impossible to compile with AndroidX and Jetifier with minifyEnabled and proguard disabled

See original GitHub issue

Hello, I have tried to migrate my project to AndroidX and use the jetifier to transform dependencies to use AndroidX. Unfortunately I have an error with the microsoft-authentication-library-for-android library:

Execution failed for task ':app:transformClassesWithAndroidGradleClassShrinkerForDebug'.
> SHA-256 digest error for com/microsoft/identity/client/AadAuthority.class

I have the issue only in debug builds which have the minifyEnabled true & useProguard false. And I don’t have the issue on the release builds with shrinkResources true & minifyEnabled true & useProguard true. (I use minifyEnabled true on debug builds in my project to remove unused methods to go below the 65K method limit).

I build the debug builds with ./gradlew clean :app:assembleDebug and the release ones with ./gradlew clean :app:assembleRelease.

I have created a project reproducing the error: AzureADtestAndroidX.zip

Do you have any idea on what the issue might be?

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:24 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
MathieuCalbacommented, Sep 18, 2018

@iambmelt I opened a bug on the Google issue tracker https://issuetracker.google.com/issues/115556774, and they are looking into it.

2reactions
joshfriendcommented, Mar 21, 2019

After much effort, I was able to use the current version with AndroidX:

  1. Download and unzip the jetifier standalone cli
  2. Download the msal aar file
  3. Strip the signatures from the aar and jetify it: ./bin/jetifier-standalone -stripSignatures -i msal-0.2.2.aar -o msal-0.2.2.aar
  4. Repeat this process for the common-0.0.8 aar as well
  5. In Android Studio, select File > New > New Module and choose “Import .JAR/.AAR package”
  6. Select the stripped and jetified msal-0.2.2.aar
  7. Also import common-0.0.8.aar the same way
  8. In the app’s build.gradle, include msal, common and all of their child dependencies:
dependencies {
    implementation project(':msal')
    //region MSAL dependencies
    // Have to include these manually because the msal AAR has no way to convey dependencies
    implementation project(':msidentity-common')
    implementation "androidx.browser:browser:1.0.0"
    implementation "com.google.code.gson:gson:2.8.4"
    implementation 'com.nimbusds:nimbus-jose-jwt:5.7'
    //endregion
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Shrink, obfuscate, and optimize your app - Android Developers
Learn how to shrink code in your release build to remove unused code and ... you can disable certain tasks or customize R8's...
Read more >
Proguard minifyEnabled true for debug build, not working on ...
I've tried removing minifyEnabled true in the debug build, and then the build fails also on Lollipop+, therefore proguard is working! but not...
Read more >
SHA-256 digest error with AndroidX and jetifier on microsoft ...
(I use `minifyEnabled true` on debug builds in my project to remove unused methods to go below the 65K method limit). I build...
Read more >
Firebase Compatibility with Unity 2020.1 and Later
This code used to go through every project in the build and enable AndroidX and Jetifier. Although we could perform a similar modification...
Read more >
androidx vs. android libraries - Unity Forum
In fact, it looks it is not possible to stop it from actively switching on Jetifier and if you try it (answering no),...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found