Proguard问题:java.lang.RuntimeException ProGuardTransform [英] Proguard issue: java.lang.RuntimeException ProGuardTransform

查看:229
本文介绍了Proguard问题:java.lang.RuntimeException ProGuardTransform的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图解决这个问题.我有点Android菜鸟,我可以处理代码,但是当涉及到配置问题时,我有点迷路了.我已经继承了这个项目,还没有找到解决方案.

构建APK时,我遇到了模糊的保护问题.如果我从Gradle配置中针对发布版本的版本删除了proguard和minifyEnabled,则APK可以正常运行,尽管它的大小比应有的大小大了10 mb.

release {
    debuggable false
    //minifyEnabled true
    //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    signingConfig signingConfigs.release
    zipAlignEnabled true
    multiDexEnabled true
}

更多背景信息,该项目大约两年没有更新,现在我已经将一些工具更新到最新版本(Gradle,Android Studio,Android 7).

我收到的警告之一是关于弃用.那能引起这个保障问题吗?我已经研究了一些过时的问题,但这些问题我无法快速解决,因此,除非有人确定这会导致我采取某种解决方案,否则我暂时将其跳过.

如果您需要更多信息,请告诉我,但是我想这里已经有很多了.我没有发布proguard文件,因为我尝试使用minifyEnabled设置并注释掉proguardFiles getDefaultProguardFile...,但仍然发生错误.我可能是错的,但是我认为这会在没有配置文件的情况下运行proguard.无论如何,请告诉我您是否也需要.

以下错误消息.

注意:

1-不知道okio.Okio问题的出处,因为找不到该库的痕迹,并且我多次清理了build文件夹.它必须是项目依赖项之一的一部分!

2-***表示我删除了一些文字,以保留我工作的公司的名称.

Error:11:11:26.628 [ERROR] [system.err] Note: Some input files use or override a deprecated API.
11:11:26.628 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.
11:11:30.516 [ERROR] [system.err] Note: Some input files use or override a deprecated API.
11:11:30.516 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.
11:11:30.516 [ERROR] [system.err] Note: Some input files use unchecked or unsafe operations.
11:11:30.516 [ERROR] [system.err] Note: Recompile with -Xlint:unchecked for details.
11:11:35.088 [ERROR] [system.err] Note: /Users/***/Development/***/***-android/***/src/main/java/com/***/***/activities/***MainActivity.java uses or overrides a deprecated API.
11:11:35.088 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.
11:11:37.322 [ERROR] [system.err] Note: there were 11 duplicate class definitions.
11:11:37.322 [ERROR] [system.err]       (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
11:11:38.451 [ERROR] [system.err] Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
11:11:38.451 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Files
11:11:38.451 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Files
11:11:38.451 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Files
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Path
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Path
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Path
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Path
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
11:11:45.207 [ERROR] [system.err] Warning: there were 14 unresolved references to classes or interfaces.
11:11:45.207 [ERROR] [system.err]          You may need to add missing library jars or update their versions.
11:11:45.207 [ERROR] [system.err]          If your code works fine without the missing classes, you can suppress
11:11:45.207 [ERROR] [system.err]          the warnings with '-dontwarn' options.
11:11:45.207 [ERROR] [system.err]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] 
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] 
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':***:transformClassesAndResourcesWithProguardForStagingRelease'.
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] > Job failed, see logs for details
11:11:45.228 [ERROR] [org.gradle.BuildExceptionReporter] 
11:11:45.228 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
11:11:45.228 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':***:transformClassesAndResourcesWithProguardForStagingRelease'.
11:11:45.228 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.RuntimeException: Job failed, see logs for details
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.ProGuardTransform.transform(ProGuardTransform.java:196)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:178)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:174)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    ... 14 more
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: Please correct the above warnings first.
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at proguard.Initializer.execute(Initializer.java:473)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at proguard.ProGuard.initialize(ProGuard.java:233)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at proguard.ProGuard.execute(ProGuard.java:98)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:54)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:254)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:63)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:173)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.tasks.Job.runTask(Job.java:49)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter] 

Gradle的配置文件.

顶级应用配置

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

allprojects {
    repositories {
        mavenCentral()
        maven { url '// For some reason this only works when in the top level build.gradle!' }
        maven { url 'http://files.couchbase.com/maven2' }
        flatDir { dirs '../***/libs' }
    }
}
```

## App project config
```
apply plugin: 'com.android.application'

dependencies {
    compile project(':***')
}

android {

    buildToolsVersion "23.0.3"
    compileSdkVersion 25

    defaultConfig {
        applicationId "com.***.***"

        // Code is compatible with Android 5 onwards.  There are all kinds of issues on KitKat.
        minSdkVersion 20

        // targetSdkVersion is 22 so that Dangerous permissions are granted when app is installed
        targetSdkVersion 25
        versionCode 29
        versionName "3.3.1"
    }

    signingConfigs {
        release
    }

    buildTypes {
        debug {
            debuggable true
        }
        release {
            debuggable false
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.release
            zipAlignEnabled true
            multiDexEnabled true
        }
    }

    productFlavors {
        development
        production
        staging
    }

    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
    }
}

// Load the signing config from release.properties
def props = new Properties()
props.load(new FileInputStream(rootProject.file("release.properties")))
android.signingConfigs.release.storeFile rootProject.file(props.keyStore)
android.signingConfigs.release.storePassword props.keyStorePassword
android.signingConfigs.release.keyAlias props.keyAlias
android.signingConfigs.release.keyPassword props.keyAliasPassword

库配置(此库是我们的库)

apply plugin: 'com.android.library'

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    // bug reports
    compile 'com.bugsnag:bugsnag-android:+'
    compile fileTree(include: '**/*.jar', dir: 'libs')
    // Used for the tour. Pulls in support-v4.
    compile project(':viewpagerindicator')
    // Used for the FragmentPagerAdapter used in the tour
    compile 'com.android.support:support-v13:25.1.0'

    // Couchbase
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.couchbase.lite:couchbase-lite-android:1.3.1'

    compile 'com.fasterxml.jackson.core:jackson-databind:2.3.4'
    compile 'com.github.tony19:logback-android-classic:1.1.1-4'
    // Used for maps
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.zxing:core:3.1.0'
    compile 'com.mobsandgeeks:android-saripaar:1.0.3'
    compile('com.spothero.volley:volley-jackson-extension:1.0.1') {
        exclude group: 'com.fasterxml.jackson.core'
    }
    compile 'joda-time:joda-time:2.6'
    compile 'org.roboguice:roboguice:2.0'
    compile('org.simpleframework:simple-xml:2.7.1') {
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'xpp3', module: 'xpp3'
    }
    compile 'org.slf4j:slf4j-api:1.7.7'
    compile 'io.card:android-sdk:5.3.0'
    compile(name:'ScanditBarcodeScanner', ext:'aar')
}

android {
    buildToolsVersion "23.0.3"
    compileSdkVersion 25
    defaultConfig {
        // Code is compatible with Android 5 onwards.  There are all kinds of issues on KitKat.
        minSdkVersion 20

        // targetSdkVersion is 22 so that Dangerous permissions are granted when app is installed
        targetSdkVersion 25
        versionCode 29
        versionName "3.3.1"
    }

    // workaround for "duplicate files during packaging of APK" issue
    // see https://groups.google.com/d/msg/adt-dev/bl5Rc4Szpzg/wC8cylTWuIEJ
    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }

    useLibrary 'org.apache.http.legacy'
}

解决方案

No idea where the okio.Okio它是gradle中一个依赖项使用的ionio库,可能是com.spothero.volley:volley-jackson-extension,因为这是使用okHttp的齐射的扩展.

要删除此警告,可以将其添加到您的proguard中:-dontwarn okio.**

Been trying to figure out this issue. I'm a bit of an Android noob, I can handle code but when it comes to configuration issues I'm a bit lost. I've inherited this project and haven't found a solution yet.

I'm getting a vague proguard issue when building the APK. If I remove proguard and minifyEnabled from the Gradle config for the release build variant, the APK builds fine, although it's larger than it should be by 10 mb.

release {
    debuggable false
    //minifyEnabled true
    //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    signingConfig signingConfigs.release
    zipAlignEnabled true
    multiDexEnabled true
}

Some more background, this project hasn't been updated for about two years, and now I've updated some tools to the latest (Gradle, Android Studio, Android 7).

One of the warnings I'm getting is about deprecations. Would that be able to cause this proguard issue? I've looked at some of the deprecation issues and they're not something I can fix fast, so I am skipping that for now, unless someone is sure this will lead me to some sort of solution.

If you need more information let me know, but there's a lot here already, I think. I'm not posting the proguard file because I've tried using the minifyEnabled setting and commenting out proguardFiles getDefaultProguardFile... and the error still occurred. I might be wrong, but I assume this runs proguard without the config file. Anyway, let me know if you need that too.

Error messages below.

Notes:

1 - No idea where the okio.Okio issue is coming from, since I can't find a trace of that library and I did clean the build folder several times. It must be part of one of the project dependencies !?

2 - *** means I've removed some text to keep the name of the company I work for annonymous.

Error:11:11:26.628 [ERROR] [system.err] Note: Some input files use or override a deprecated API.
11:11:26.628 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.
11:11:30.516 [ERROR] [system.err] Note: Some input files use or override a deprecated API.
11:11:30.516 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.
11:11:30.516 [ERROR] [system.err] Note: Some input files use unchecked or unsafe operations.
11:11:30.516 [ERROR] [system.err] Note: Recompile with -Xlint:unchecked for details.
11:11:35.088 [ERROR] [system.err] Note: /Users/***/Development/***/***-android/***/src/main/java/com/***/***/activities/***MainActivity.java uses or overrides a deprecated API.
11:11:35.088 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.
11:11:37.322 [ERROR] [system.err] Note: there were 11 duplicate class definitions.
11:11:37.322 [ERROR] [system.err]       (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
11:11:38.451 [ERROR] [system.err] Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
11:11:38.451 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Files
11:11:38.451 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Files
11:11:38.451 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Files
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Path
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Path
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Path
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.Path
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
11:11:38.452 [ERROR] [system.err] Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
11:11:45.207 [ERROR] [system.err] Warning: there were 14 unresolved references to classes or interfaces.
11:11:45.207 [ERROR] [system.err]          You may need to add missing library jars or update their versions.
11:11:45.207 [ERROR] [system.err]          If your code works fine without the missing classes, you can suppress
11:11:45.207 [ERROR] [system.err]          the warnings with '-dontwarn' options.
11:11:45.207 [ERROR] [system.err]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] 
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] 
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':***:transformClassesAndResourcesWithProguardForStagingRelease'.
11:11:45.227 [ERROR] [org.gradle.BuildExceptionReporter] > Job failed, see logs for details
11:11:45.228 [ERROR] [org.gradle.BuildExceptionReporter] 
11:11:45.228 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
11:11:45.228 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':***:transformClassesAndResourcesWithProguardForStagingRelease'.
11:11:45.228 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
11:11:45.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.RuntimeException: Job failed, see logs for details
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.ProGuardTransform.transform(ProGuardTransform.java:196)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:178)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:174)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
11:11:45.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    ... 14 more
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: Please correct the above warnings first.
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at proguard.Initializer.execute(Initializer.java:473)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at proguard.ProGuard.initialize(ProGuard.java:233)
11:11:45.231 [ERROR] [org.gradle.BuildExceptionReporter]    at proguard.ProGuard.execute(ProGuard.java:98)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:54)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:254)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:63)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:173)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.tasks.Job.runTask(Job.java:49)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223)
11:11:45.232 [ERROR] [org.gradle.BuildExceptionReporter] 

Config files for Gradle.

Top Level App config

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

allprojects {
    repositories {
        mavenCentral()
        maven { url '// For some reason this only works when in the top level build.gradle!' }
        maven { url 'http://files.couchbase.com/maven2' }
        flatDir { dirs '../***/libs' }
    }
}
```

## App project config
```
apply plugin: 'com.android.application'

dependencies {
    compile project(':***')
}

android {

    buildToolsVersion "23.0.3"
    compileSdkVersion 25

    defaultConfig {
        applicationId "com.***.***"

        // Code is compatible with Android 5 onwards.  There are all kinds of issues on KitKat.
        minSdkVersion 20

        // targetSdkVersion is 22 so that Dangerous permissions are granted when app is installed
        targetSdkVersion 25
        versionCode 29
        versionName "3.3.1"
    }

    signingConfigs {
        release
    }

    buildTypes {
        debug {
            debuggable true
        }
        release {
            debuggable false
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.release
            zipAlignEnabled true
            multiDexEnabled true
        }
    }

    productFlavors {
        development
        production
        staging
    }

    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
    }
}

// Load the signing config from release.properties
def props = new Properties()
props.load(new FileInputStream(rootProject.file("release.properties")))
android.signingConfigs.release.storeFile rootProject.file(props.keyStore)
android.signingConfigs.release.storePassword props.keyStorePassword
android.signingConfigs.release.keyAlias props.keyAlias
android.signingConfigs.release.keyPassword props.keyAliasPassword

Library config (this library is ours)

apply plugin: 'com.android.library'

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    // bug reports
    compile 'com.bugsnag:bugsnag-android:+'
    compile fileTree(include: '**/*.jar', dir: 'libs')
    // Used for the tour. Pulls in support-v4.
    compile project(':viewpagerindicator')
    // Used for the FragmentPagerAdapter used in the tour
    compile 'com.android.support:support-v13:25.1.0'

    // Couchbase
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.couchbase.lite:couchbase-lite-android:1.3.1'

    compile 'com.fasterxml.jackson.core:jackson-databind:2.3.4'
    compile 'com.github.tony19:logback-android-classic:1.1.1-4'
    // Used for maps
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.zxing:core:3.1.0'
    compile 'com.mobsandgeeks:android-saripaar:1.0.3'
    compile('com.spothero.volley:volley-jackson-extension:1.0.1') {
        exclude group: 'com.fasterxml.jackson.core'
    }
    compile 'joda-time:joda-time:2.6'
    compile 'org.roboguice:roboguice:2.0'
    compile('org.simpleframework:simple-xml:2.7.1') {
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'xpp3', module: 'xpp3'
    }
    compile 'org.slf4j:slf4j-api:1.7.7'
    compile 'io.card:android-sdk:5.3.0'
    compile(name:'ScanditBarcodeScanner', ext:'aar')
}

android {
    buildToolsVersion "23.0.3"
    compileSdkVersion 25
    defaultConfig {
        // Code is compatible with Android 5 onwards.  There are all kinds of issues on KitKat.
        minSdkVersion 20

        // targetSdkVersion is 22 so that Dangerous permissions are granted when app is installed
        targetSdkVersion 25
        versionCode 29
        versionName "3.3.1"
    }

    // workaround for "duplicate files during packaging of APK" issue
    // see https://groups.google.com/d/msg/adt-dev/bl5Rc4Szpzg/wC8cylTWuIEJ
    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }

    useLibrary 'org.apache.http.legacy'
}

解决方案

No idea where the okio.Okio It is a io and nio library used by one of the dependency in your gradle, It could be com.spothero.volley:volley-jackson-extension since this is an extension of volley where it uses okHttp.

To remove this warning you can add this in your proguard: -dontwarn okio.**

这篇关于Proguard问题:java.lang.RuntimeException ProGuardTransform的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆