![](/img/trans.png)
[英]Android volley proguard throws java.lang.RuntimeException: Stub
[英]Proguard issue: java.lang.RuntimeException ProGuardTransform
一直在想辦法解決這個問題。 我是一個 Android 菜鳥,我可以處理代碼,但是當涉及到配置問題時,我有點不知所措。 我已經繼承了這個項目,還沒有找到解決方案。
在構建 APK 時,我遇到了一個模糊的 proguard 問題。 如果我從發布構建變體的 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問題嗎? 我已經查看了一些棄用問題,但它們不是我可以快速解決的問題,所以我現在跳過它,除非有人確定這會引導我找到某種解決方案。
如果您需要更多信息,請告訴我,但我想這里已經有很多信息了。 我沒有發布 proguard 文件,因為我已經嘗試使用minifyEnabled
設置並注釋掉proguardFiles getDefaultProguardFile...
並且錯誤仍然發生。 我可能是錯的,但我認為這會在沒有配置文件的情況下運行 proguard。 無論如何,如果您也需要,請告訴我。
筆記:
1 - 不知道okio.Okio
問題是從哪里來的,因為我找不到那個庫的蹤跡,而且我確實多次清理了構建文件夾。 它必須是項目依賴項之一的一部分!?
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]
// 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
它是一個io
和nio
庫,由您的 gradle 中的一個依賴項使用,它可能是com.spothero.volley:volley-jackson-extension
因為這是使用okHttp
的 volley 的擴展。
要刪除此警告,您可以在 proguard 中添加: -dontwarn okio.**
Juste 在 proguard 文件中添加忽略警告:
-ignorewarnings
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.