Error:Execution failed for task #39;:app:packageRelease#39;. gt; Unable to compute hash of /../AndroidStudioProjects/../classes.jar(错误:任务“:app:packageRelease执行失败.gt;无法计算/../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", '"http://10.0.2.2:3000"'
}
release {
buildConfigField "String", "SERVER_URL", '"https://example.com"'
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debugRelease {
buildConfigField "String", "SERVER_URL", '"https://example.com"'
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
基本上我是如何解决这个问题的,我试图在发布"模式下运行我的应用程序,但遇到了一堆类似于这个人的错误:https://github.com/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: https://github.com/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/../classes.jar 的哈希值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:错误:任务“:app:packageRelease"执行失败.>无法计算/../AndroidStudioProjects/../classes.jar 的哈希值
基础教程推荐
- Java:带有char数组的println给出乱码 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 降序排序:Java Map 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01