DexGuard java.io.IOException: The same input jar

亡梦爱人 提交于 2019-12-13 02:59:20

问题


I'm facing this issue when using dexguard

> Task :app:dexguardStaging FAILED

The TaskInternal.execute() method has been deprecated and is scheduled to be removed in Gradle 5.0. There are better ways to re-use task logic, see https://docs.gradle.org/4.3/userguide/custom_tasks.html#sec:reusing_task_logic.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:dexguardStaging'.

    java.io.IOException: The same input jar [/Users/radityagumay/Library/Android/sdk/platforms/android-25/android.jar] is specified twice.

Can anyone help?

UPDATE i've fix this issue by revert to distribution gradle 3.5 previously i using 4.3,

distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

and downgrade all build from 3.0.0 to 2.3.3, remove maven google.com

classpath 'com.android.tools.build:gradle:2.3.3'

This issue happened, when i using Android Studio 3 with build gradle 3.0.0 or 3.0.1, and dexguard (7.3.11) also use (8.0.18) enable.

this maybe mismatch version latest gradle with version of dexguard.

Thanks


回答1:


Please try below code & let me know if it works for you

Do changes in your gradle like this

apply plugin: 'com.android.application'

android {

    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.example.testapp"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.1"
        multiDexEnabled true  // put this line in your gradle
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    //put below code in your gradle
    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:multidex:1.0.2'  //put this dependencies in your gradle
    // Rest of your dependencies
}

& also changes in your application file.

public class TestApplication extends MultiDexApplication {

    @Override
    public void onCreate() {
        super.onCreate();
    }
}

&

In manifest file >> in application tag >> mention below line

android:name=".TestApplication"

Hope this will work for you & if it is work then let me know.



来源:https://stackoverflow.com/questions/47471933/dexguard-java-io-ioexception-the-same-input-jar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!