【问题标题】:Proguard error android - oauth.signpost.signatureProguard错误android - oauth.signpost.signature
【发布时间】:2015-02-17 21:53:35
【问题描述】:

我在构建过程中收到此错误

Warning:oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64

它是我在项目中使用的 libs 文件夹中的一个 jar 文件。

编辑: 这是 build.gradle 文件,但它不包含所有依赖项。我在 libs 文件夹中也有一些罐子。

apply plugin: 'com.android.application'
apply plugin: 'robolectric'
apply plugin: 'android'
apply plugin: 'newrelic'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.abc.xyz"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 54
        versionName "2.002"
        multiDexEnabled true
        testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
        resConfigs "en", "fr" , "ar"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        androidTest {
            setRoot('src/test')
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    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
    }

    repositories{
        maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
    }

    repositories {
        mavenCentral()
    }

    dependencies {
        compile fileTree(dir: 'libs', include: '*.jar')
        compile 'com.android.support:appcompat-v7:21.+'
        compile 'com.github.chrisbanes.photoview:library:1.2.3'
        compile 'com.etsy.android.grid:library:1.0.5'
        compile 'com.facebook.android:facebook-android-sdk:3.21.1'
        compile 'com.google.android.gms:play-services-base:6.5.+'
        compile 'com.google.android.gms:play-services-wallet:6.5.+'
        compile 'com.google.android.gms:play-services-ads:6.5.+'
        compile 'com.google.android.gms:play-services-maps:6.5.+'
        compile 'com.google.android.gms:play-services-drive:6.5.+'
        compile 'com.google.android.gms:play-services-appindexing:6.5.+'
        compile 'com.google.android.gms:play-services-location:6.5.+'
        compile 'com.google.android.gms:play-services-identity:6.5.+'
        compile 'com.google.android.gms:play-services-plus:6.5.+'
        compile 'com.android.support:multidex:1.0.+'
        compile project(':Adjust')
        compile project(':aFileChooser-cbccac1d1cb74a6d57d25c5ded61e4bf4fc40c91')
        compile 'com.parse.bolts:bolts-android:1.+'
        compile 'com.squareup.picasso:picasso:2.4.0'
        compile 'com.android.support:recyclerview-v7:+'
        compile (group: 'com.zendesk', name: 'sdk', version: '1.0.0.1'){
            //    exclude group:'picasso'
        }
        compile 'com.android.support:recyclerview-v7:+'
        compile 'com.newrelic.agent.android:android-agent:4.+'
        compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
        compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.2'
        compile 'com.fasterxml.jackson.core:jackson-core:2.4.2'

        androidTestCompile 'org.robolectric:robolectric:2.4'
        androidTestCompile('junit:junit:4.12')
        androidTestCompile('org.mockito:mockito-core:1.10.19')

    }

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



robolectric {
    include '**/*Test.class'
}

更新:我现在可以使用@goonerdroid 指定的规则构建项目,但它在启动时崩溃,我的 MainActivity 出现 NoClassDefFound 错误

【问题讨论】:

  • 发布你的 gradle 文件,只是为了了解你正在使用的所有库
  • @goonerdroid 我已经编辑了这个问题。 SO 进入只读模式一段时间,所以我无法发布它。

标签: android proguard


【解决方案1】:

试试这些规则

-dontwarn org.mortbay.**
-dontwarn org.slf4j.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.apache.commons.codec.binary.**

【讨论】:

  • 同一包中的其他一些类仍然出现错误。它是我在项目中引用的 jar 文件。你不认为忽略这一点会导致运行时异常吗?
  • 更新:我现在可以构建项目,但它在启动时崩溃,我的 MainActivity 出现 NoClassDefFound 错误
  • 使用额外的“-libraryjars”选项添加这些罐子
  • 我的 proguard 规则中已经有了 -libraryjars 库。你在说这个吗。它似乎是multidex + proguard的问题。我已经发布了一个问题。请看最后编辑的部分stackoverflow.com/questions/28563803/…
猜你喜欢
  • 1970-01-01
  • 2014-11-19
  • 2014-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-08
相关资源
最近更新 更多