我试图做一个'释放'建立在一个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的文件是不存在。我一定要创建这个文件自己有摇篮的任务?
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
我pretty的多少,随后他所说的和固定的。
I pretty much followed what he said and fixed it.
希望这可以帮助别人产生自己的APK的!
Hope this can help others with generating their APK's!