Android:启用geting后无法在创建Release apk时计算哈希类 - proguard

时间:2016-02-16 08:06:39

标签: android build android-gradle build-process build.gradle

我只在项目中启用 proguard 。之后我通过使用调试apk成功运行apk。

当我尝试创建已签名的Apk 时收到错误

Error:Execution failed for task ':packageRelease'.
> Unable to compute hash of E:\Project Details\Frendy Talk\new version\Frendy\build\intermediates\classes-proguard\release\classes.jar

我的Gradle文件

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
}
}
  apply plugin: 'android'


 dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.google.android.gms:play-services-ads:7.8.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile('com.android.support:support-v4:21.0.3') {
    exclude module: 'support-v4'
}
}

 android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'


defaultConfig {
    minSdkVersion 11
    targetSdkVersion 23

}
lintOptions {
    checkReleaseBuilds false
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-project.txt'), 'proguard-rules.pro'
    }
}

dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}
}

尝试创建签名APK

Warning:org.codehaus.jackson.jaxrs.JacksonJsonProvider: can't find superclass or interface javax.ws.rs.ext.MessageBodyReader
Warning:org.codehaus.jackson.jaxrs.JacksonJsonProvider: can't find superclass or interface javax.ws.rs.ext.MessageBodyWriter
Warning:org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper: can't find superclass or interface javax.ws.rs.ext.ExceptionMapper
Warning:org.codehaus.jackson.jaxrs.JsonParseExceptionMapper: can't find superclass or interface javax.ws.rs.ext.ExceptionMapper
Warning:org.codehaus.jackson.xc.DataHandlerJsonDeserializer$1: can't find superclass or interface javax.activation.DataSource
Warning:library class org.apache.http.conn.scheme.LayeredSocketFactory extends or implements program class org.apache.http.conn.scheme.SocketFactory
Warning:org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider: can't find referenced class javax.ws.rs.ext.Provider
Warning:org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider: can't find referenced class javax.ws.rs.Consumes
Warning:org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider: can't find referenced class javax.ws.rs.Produces
Warning:org.codehaus.jackson.jaxrs.JacksonJsonProvider: can't find referenced class javax.ws.rs.core.MediaType
Warning:org.codehaus.jackson.jaxrs.JacksonJsonProvider: can't find referenced class javax.ws.rs.ext.Providers
Warning:org.codehaus.jackson.jaxrs.JacksonJsonProvider: can't find referenced class javax.ws.rs.ext.ContextResolver

我试过-dontwarn

-dontwarn android.security.**
-dontwarn android.support.**
-dontwarn okio.**

但仍然遇到同样的问题

请帮助我解决这个问题。

1 个答案:

答案 0 :(得分:0)

如果您使用Google广告,请尝试使用 proguard-rules.pro

中的一些行
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**