错误:任务“:app:packageRelease"执行失败.>无法计算/../AndroidStudioProjects/../classes.jar 的哈希值

编程入门 行业动态 更新时间:2024-10-24 01:50:03
本文介绍了错误:任务“:app:packageRelease"执行失败.>无法计算/../AndroidStudioProjects/../classes.jar 的哈希值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在 Android 应用上进行发布"构建,但我不断收到以下错误:

I'm trying to do a 'release' build on an Android app and I keep on getting this error of:

无法计算/../AndroidStudioProjects/../classes.jar 的哈希

Unable to compute hash of /../AndroidStudioProjects/../classes.jar

然后,当我查看classes.jar"的目录时,该文件不存在.我是否必须使用 gradle 任务自己创建此文件?

And then when I look into that directory for 'classes.jar' the file isn't there. Do I have to create this file myself with a gradle task?

这里的 proguard 发生了一些事情,但除了无法计算哈希......"之外,它没有提供太多有用的信息.

There's something going on with proguard here but it's not giving much useful information other than 'Unable to compute hash...."

这是我的 gradle.build 文件:

Here's my gradle.build file:

apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.example" minSdkVersion 11 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { debug { buildConfigField "String", "SERVER_URL", '"10.0.2.2:3000"' } release { buildConfigField "String", "SERVER_URL", '"example"' minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debugRelease { buildConfigField "String", "SERVER_URL", '"example"' debuggable true jniDebuggable false renderscriptDebuggable false minifyEnabled false zipAlignEnabled true } } productFlavors { } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.android.support:recyclerview-v7:22.1.1' compile 'com.android.support:cardview-v7:22.1.1' compile 'com.google.android.gms:play-services-gcm:7.5.0' }

如果有人可以帮助我调试这个问题,那就太好了.

If someone could help me debug this issue that'd be great.

推荐答案

我发现问题了:

为您的项目打开 proguard-rules.pro 并将其添加到底部:

Open up the proguard-rules.pro for your project and add this to the bottom:

-dontwarn java.nio.file.Files -dontwarn java.nio.file.Path -dontwarn java.nio.file.OpenOption -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

基本上我是如何解决这个问题的,我试图在发布"模式下运行我的应用程序,但遇到了一堆类似于这个人的错误:github/square/okio/issues/144

Basically how I solved it was this I tried to run my app in 'release' mode and got a bunch of errors similar to this guy here: github/square/okio/issues/144

我几乎按照他说的做了.

I pretty much followed what he said and fixed it.

希望这可以帮助其他人生成他们的 APK!

Hope this can help others with generating their APK's!

更多推荐

错误:任务“:app:packageRelease"执行失败.>无法计算/../AndroidStudioProjects/../cla

本文发布于:2023-11-03 12:35:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555151.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   packageRelease   quot   amp   app

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!