Android issue highlights forty-seven: Error: Execution failed for task & amp; #39;: app: packageRelease & amp; #39;.) Unable to compute hash

Source: Internet
Author: User

Android issue highlights forty-seven: Error: Execution failed for task & #39;: app: packageRelease & #39;.) Unable to compute hash

The jna-related warnings are listed above when you encounter this problem during obfuscation compiling when using the jna jar package.
You need to develop compilation rules in the proguard-rules.pro to ignore the jna-related package warnings.

-keep class com.sun.jna.** { *; }-dontwarn com.sun.jna.**

Note that if it is introduced as a module, You need to ignore it in the proguard-rules.pro file in the main app.

The original article is as follows:
All the current answers to this question are just giving the Proguard rules that worked for them, every fix will be different. first off, confirm it's a Proguard problem by checking that the classes-proguard directory is somewhere in the error message, something like this: unable to compute hash of/Users/Documents/projectX/app/build/intermediates/classes-proguard/release/classes. jar

This means it's caused by an earlier Proguard error so you need to scroll up in the Messages window or Gradle Console window and check what warnings or errors you're getting. just as an example, in my current project, Square's Picasso library is causing the error: Warning: com. squareup. picasso. okHttpDownloader: can't find referenced class com. squareup. okhttp. okHttpClient. I just added-dontwarn com. squareup. okhttp. ** to ignore the warnings, and the app still worked as normal.

A lot of the Proguard errors will be warnings about some class so just adding-dontwarn for whatever class is causing it in your project often works.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.