我正在尝试在 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 的哈希值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!