0

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'
}
HotFudgeSunday
  • 1,403
  • 2
  • 23
  • 29
  • Thanks @Rod_Algonquin. That's what I thought it would be, but I don't even know the libraries being used in the project that well yet. The other day I went through some of them trying to find which one is the one, but I wasn't able to find it yet. – HotFudgeSunday Jan 30 '17 at 16:51
  • @Rod_Algonquin, your answer was the one. Why don't you post it and I'll make it the correct answer? – HotFudgeSunday Jan 30 '17 at 21:14

2 Answers2

1

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.**

Rod_Algonquin
  • 26,074
  • 6
  • 52
  • 63
1

Juste add ignore warnings in proguard file:

-ignorewarnings
Houssin Boulla
  • 2,687
  • 1
  • 16
  • 22