Android 在发布模式下生成时生成失败

Android 在发布模式下生成时生成失败,android,gradle,build,Android,Gradle,Build,我正在尝试生成签名生成,但它显示以下错误: Warning:there were 87 unresolved references to classes or interfaces. You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress

我正在尝试生成签名生成,但它显示以下错误:

Warning:there were 87 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 2 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Exception while processing task 
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:473)
    at proguard.ProGuard.initialize(ProGuard.java:233)
    at proguard.ProGuard.execute(ProGuard.java:98)
    at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
    at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
    at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
    at com.android.builder.tasks.Job.runTask(Job.java:48)
    at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
    at java.lang.Thread.run(Thread.java:745)
:app:dexRelease
:app:crashlyticsStoreDeobsRelease
:app:crashlyticsUploadDeobsRelease
:app:validateExternalOverrideSigning
:app:packageRelease FAILED
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of D:\Project\AppLocker\app\build\intermediates\classes-proguard\release\classes.jar
Information:BUILD FAILED
Information:Total time: 5.629 secs
Information:1 error
Information:62 warnings
Information:See complete output in console
我尝试了重建/清理构建选项,但每次都会遇到相同的错误

我的项目具有以下依赖项:

compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:preference-v7:23.1.1'
    compile 'com.android.support:preference-v14:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:palette-v7:23.1.1'
    compile 'com.cocosw:bottomsheet:1.+@aar'
    compile 'com.github.paolorotolo:appintro:3.2.+'
    compile 'com.pnikosis:materialish-progress:1.7'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }

请建议如何解决上述问题。谢谢。

看起来ProGuard可能正在剥离构建所依赖的类。尝试在禁用ProGuard(minifyEnabled false)的情况下进行发布构建,看看是否有效。如果这样做有效,那么您需要配置ProGuard规则,使其不会删除代码所依赖的类型。

尝试向gradle添加PackageOptions,尝试清理项目,删除build文件夹,然后再次重建,指定gradle中使用的所有jar文件

  apply plugin: 'com.android.application'

 android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
    applicationId "com.package"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 6
    versionName "2.0.1"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
}
 }

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'

}

我通过在proguard规则文件的顶部添加
-ignorewarnings
解决了这个问题。

没有proguard,它工作正常。但在使用proguard时面临问题。您有哪些依赖项?请看这里的一个为Android应用程序配置proguard规则的示例:(repo还包含许多针对典型Android依赖项的规则)更新了我的问题。请看一看。尝试创建项目的新副本。我面临着同样的问题,我必须创建一个新的项目副本。增加gradle文件中的版本号如果这样做,不要使用proguard,它不是解决方案