Android – Gradle Build Failure


My project compiles and executes well on debug mode but when i try to generate a signed apk, errors arise. This appears on the message log:

:app:proguardRelease can't find referenced class$DialogStyle can't find referenced class$Transit can't find referenced class$ResolvedLayoutDirectionMode can't find referenced class$LayoutDirectionMode can't find referenced class$LayerType can't find referenced class$AccessibilityLiveRegion can't find referenced class$ImportantForAccessibility can't find referenced class$OverScroll can't find referenced class$EdgeGravity can't find referenced class$LockMode can't find referenced class$State
Warning:there were 11 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
Exception while processing task Please correct the above warnings first.
    at proguard.Initializer.execute(
    at proguard.ProGuard.initialize(
    at proguard.ProGuard.execute(
    at proguard.gradle.ProGuardTask.proguard(
:app:dexRelease UP-TO-DATE
:app:packageRelease FAILED
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of /home/kombo/RAL/Mpasho/app/build/intermediates/classes-proguard/release/classes.jar

I have tried every possible way of remedying this by updating my build tools, using the latest gradle version, checking all the dependencies and the error still shows up.

I am pretty sure the v4 support library is present in the project since no errors arise in debug mode.

Best Solution

I also had this issue when upgrading everything that is built related to 23 (Android Libraries, SDK etc).

This proguard configuration fixed it for me:

-dontwarn org.apache.http.**