0

这些是测试依赖项:

// tests
androidTestCompile 'org.mockito:mockito-all:1.10.8'
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.3.1'
androidTestCompile 'junit:junit:4.12'
androidTestCompile ('org.robolectric:robolectric:2.4') {
    exclude module: 'commons-logging'
    exclude module: 'httpclient'
}

而且我的debug构建类型有minifyEnabled true,因为我没有达到 DEX 方法限制。完整的建筑定义如下:

 defaultConfig {
    applicationId "com.example.myapp"
    minSdkVersion 15
    targetSdkVersion 22
    versionName VERSION_NAME

    proguardFile getDefaultProguardFile('proguard-android.txt')
    proguardFile 'proguard-rules.pro'
}

signingConfigs {
    debug {
        storeFile file('keystore/debug.keystore')

    }
}

productFlavors {
    develop {
        versionCode versionBuild()
        signingConfig signingConfigs.debug
        proguardFile 'proguard-rules-debug.pro'
    }
}

buildTypes {
    debug {
        minifyEnabled true
    }
}

有一个默认proguard-rules.pro文件和一个附加文件proguard-rules-debug.pro

根据:proguardDevelopDebug我拥有的选项,gradle 任务成功通过。但是:proguardDevelopDebugAndroidTest失败并出现以下错误: http: //pastebin.com/S623UGfP

这很奇怪,因为我在文件中添加了以下内容:

-dontobfuscate

# ------------------- TEST DEPENDENCIES -------------------

-dontwarn org.hamcrest.**
-dontwarn com.squareup.**
-dontwarn com.google.android.**

-keep class com.google.android.** {
   *;
}
-keep class com.google.common.** {
   *;
}
-keep class org.hamcrest.** {
   *;
}

# Apache Maven
-keep class org.apache.maven.** { *; }
-dontwarn org.apache.maven.**

# Junit
-keep class org.junit.** { *; }
-dontwarn org.junit.**

# Mockito
-keep class org.mockito.** { *; }
-dontwarn org.mockito.**

# Robolectric
-keep class org.robolectric.** { *; }
-dontwarn org.robolectric.**

任何想法为什么这两个不一起工作?

4

0 回答 0