Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 Warning:android.support.v4.app.DialogFragment: can't find referenced class android.support.v4.app.DialogFragment$DialogStyle Warning:android.support.v4.app.FragmentTransaction: can't find referenced class android.support.v4.app.FragmentTransaction$Transit Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$ResolvedLayoutDirectionMode Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$LayoutDirectionMode Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$LayerType Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$AccessibilityLiveRegion Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$ImportantForAccessibility Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$OverScroll Warning:android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$EdgeGravity Warning:android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$LockMode Warning:android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$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.          (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) Exception while processing task  java.io.IOException: Please correct the above warnings first.     at proguard.Initializer.execute(Initializer.java:473)     at proguard.ProGuard.initialize(ProGuard.java:233)     at proguard.ProGuard.execute(ProGuard.java:98)     at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)     at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)     at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)     at com.android.builder.tasks.Job.runTask(Job.java:48)     at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)     at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)     at java.lang.Thread.run(Thread.java:745) :app:dexRelease UP-TO-DATE :app:crashlyticsStoreDeobsRelease :app:crashlyticsUploadDeobsRelease :app:validateExternalOverrideSigning :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.

like image 566
Alex Kombo Avatar asked Jun 08 '15 09:06

Alex Kombo


People also ask

Why is my Gradle build failing?

If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one of your Gradle build configuration scripts. You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.

How do I debug a Gradle build?

To do that, just pick the Gradle Remote Debug configuration and then click the Debug icon on the project to be debugged. For more info, you can read the Gradle documentation. Follow us for more productivity tools & ideas for Android, Kotlin & Gradle projects.


1 Answers

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.** -dontwarn android.net.http.AndroidHttpClient -dontwarn com.google.android.gms.** -dontwarn com.android.volley.toolbox.** 

Source

like image 88
Niklas Avatar answered Sep 28 '22 04:09

Niklas