Proguard不会使用重复的类构建项目

时间:2016-01-14 11:05:17

标签: android proguard

我对特定设备有一种风味。对于这个设备,我有.jar文件,它有自定义的android sdk(对于这个设备。它包含一些我必须使用的自定义类)。它工作正常,直到我开始使用proguard。当我用proguard构建项目时,我收到了这个:

...
Note: there were 1504 duplicate class definitions.
...
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:proguardAppProguard'.
> java.io.IOException: Please correct the above warnings first.

我发现添加一个字符串:

-ignorewarnings

到proguard-android.txt修复了这个问题,但它看起来像是一个糟糕的解决方案。有人面对这个(或类似的)问题吗?

修改

的build.gradle:

 buildscript {
     repositories {
         jcenter()
         maven { url 'https://maven.fabric.io/public' }
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:1.2.2'
         // The Fabric Gradle plugin uses an open ended version to      react
         // quickly to Android tooling updates
         classpath 'io.fabric.tools:gradle:1.+'
         classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
     }
 }

 apply plugin: 'com.android.application'
 apply plugin: 'io.fabric'
 apply plugin: 'android-apt'

 repositories {
     jcenter()
     maven { url 'https://maven.fabric.io/public' }
     flatDir {
         dirs 'libs'
     }
 }

 apply plugin: 'idea'

 idea {
     module {
         downloadJavadoc = true
         downloadSources = true
     }
 }

 configurations {
     provided
 }

 sourceSets {
     main {
         compileClasspath += configurations.provided
         runtimeClasspath += configurations.provided
     }
 }

 def computeVersionName() {
     return "r_1.0"
 }

 android {
     compileSdkVersion 23
     buildToolsVersion "21.1.1"


defaultConfig {
    applicationId "com.app"
    multiDexEnabled true
    String buildSuf = System.getenv("BUILD_NUMBER");
    ext.defaultName = project.archivesBaseName;
    if (buildSuf != null) {
        def vers = Integer.parseInt(buildSuf)
        println "VERCODE = ${vers}"
        versionCode vers
    } else {
        versionCode 1000
    }
    minSdkVersion 16
    targetSdkVersion 21
}

productFlavors {
    app {
        applicationId "com.app"
        versionName  computeVersionName()
    }
}

lintOptions {
    checkReleaseBuilds false
    // Or, if you prefer, you can continue to check for errors in release builds,
    // but continue the build even when errors are found:
    abortOnError false
    disable 'InvalidPackage'
}
signingConfigs {
    ...
    customerProgurd {
        storeFile file('../keys/debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
...
}
buildTypes {
...
    customerProguard {
        debuggable false
        jniDebuggable false
        minifyEnabled true
        proguardFiles rootProject.file('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.customerProgurd
         }
     ...
 }
 compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_6
         targetCompatibility JavaVersion.VERSION_1_6
 }
 packagingOptions {
         exclude 'META-INF/services/javax.annotation.processing.Processor'
 }
 }


 dependencies {
     ...
     app files('libs/classes.jar') // it's custom sdk

     compile 'com.android.support:appcompat-v7:23.1.1'
     compile 'com.android.support:recyclerview-v7:23.1.1'
     compile 'com.android.support:design:23.1.1'
     ...
 }

0 个答案:

没有答案
相关问题