仅将proguard应用于instrumentation apk

时间:2015-12-31 06:40:50

标签: android android-testing android-espresso

您好我正在使用浓缩咖啡来进行仪器测试。

在启用proguard for debug build时,我已经添加了各种与测试相关的依赖项,以检查一切正常。

我正在获取与仪器apk相关的proguard警告。

任何人都可以指导我如何添加Android Studio将用于生成我的仪器apk的proguard规则。

下面是stacktrace

    @Bean
public MappingJackson2HttpMessageConverter MappingJackson2HttpMessageConverter (ApplicationContext applicationContext) {
    ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().applicationContext(applicationContext).build();
    return new MappingJackson2HttpMessageConverter(objectMapper) {
        @Override
        protected void writePrefix(JsonGenerator generator, Object object) throws IOException {
            String jsonpFunction =
                    (object instanceof MappingJacksonValue ? ((MappingJacksonValue) object).getJsonpFunction() : null);
            if (jsonpFunction != null) {
                generator.writeRaw(jsonpFunction + "(");
            }
        }

    };
}
下面的

是build.gradle

Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.client.HttpClient
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.client.HttpClient
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.impl.conn.PoolingClientConnectionManager
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.impl.conn.PoolingClientConnectionManager
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.X509HostnameVerifier
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.SSLSocketFactory
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.scheme.SchemeRegistry
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.impl.conn.PoolingClientConnectionManager
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.SSLSocketFactory
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.scheme.SchemeRegistry
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.SSLSocketFactory
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.scheme.SchemeRegistry
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.X509HostnameVerifier
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.SSLSocketFactory
Warning: com.github.tomakehurst.wiremock.http.HttpClientFactory: can't find referenced class com.belladati.httpclientandroidlib.conn.ssl.X509HostnameVerifier
Warning: com.github.tomakehurst.wiremock.http.HttpHeaders: can't find referenced class com.fasterxml.jackson.databind.annotation.JsonSerialize
Warning: com.github.tomakehurst.wiremock.http.HttpHeaders: can't find referenced class com.fasterxml.jackson.databind.annotation.JsonDeserialize
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonDeserializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonDeserializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonProcessingException
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.DeserializationContext
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.DeserializationContext
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.DeserializationContext
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.core.JsonParser
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.DeserializationContext
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer: can't find referenced class com.fasterxml.jackson.databind.JsonDeserializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$1: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonDeserializer$2: can't find referenced class com.fasterxml.jackson.databind.JsonNode
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.JsonSerializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.JsonSerializer
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonProcessingException
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.SerializerProvider
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.SerializerProvider
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.SerializerProvider
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.core.JsonGenerator
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.SerializerProvider
Warning: com.github.tomakehurst.wiremock.http.HttpHeadersJsonSerializer: can't find referenced class com.fasterxml.jackson.databind.JsonSerializer
Warning: com.github.tomakehurst.wiremock.http.ProxyResponseRenderer: can't find referenced class com.belladati.httpclientandroidlib.client.HttpClient
Warning: com.github.tomakehurst.wiremock.http.ProxyResponseRenderer: can't find referenced class com.belladati.httpclientandroidlib.HttpResponse
Warning: com.github.tomakehurst.wiremock.http.ProxyResponseRenderer: can't find referenced class com.belladati.httpclientandroidlib.StatusLine
Warning: com.github.tomakehurst.wiremock.http.ProxyResponseRenderer: can't find referenced class com.belladati.httpclientandroidlib.HttpResponse

         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED

以下是test-proguard-rule.pro

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.aaa.bb"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"


    }
    buildTypes {
        debug{
            testCoverageEnabled true
            minifyEnabled true
            testProguardFile "test-proguard-rules.pro"
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            testProguardFile('test-proguard-rules.pro')
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }

    lintOptions{
        disable 'InvalidPackage'
    }
    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
        exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    def appDependencies = rootProject.ext.appDependencies;
    def testDependencies = rootProject.ext.testDependencies

    compile appDependencies.appCompact
    compile appDependencies.perCent
    compile appDependencies.design
    compile appDependencies.recyclerView
    compile appDependencies.butterKnife
    compile appDependencies.eventBus
    compile appDependencies.rxJava
    compile appDependencies.materialDialog
    compile appDependencies.rxAndroid
    compile appDependencies.dagger
    compile (appDependencies.materialDialog.toString()){
        transitive true
    }
    compile appDependencies.retofit
    compile appDependencies.retrofitGsonConverter
    compile appDependencies.retrofitRxJavaAdapter
    provided appDependencies.daggerCompiler
    provided appDependencies.javaxAnnotation

    /////////////////  our projects ////////////
    compile project(':pushnotification')
    ////////////////////////////////////////////


    //////////// TDD //////////////////////////
    testCompile testDependencies.jUnit
    testCompile testDependencies.roboelectric
    testCompile (testDependencies.assertJ.toString()){
        exclude group:'com.android.support'
    }

    androidTestCompile testDependencies.espresso
    androidTestCompile testDependencies.espressoIntent
    androidTestCompile testDependencies.runner
    androidTestCompile testDependencies.runnerRules
    androidTestCompile testDependencies.mockito
    androidTestCompile testDependencies.supportAnnotations
    androidTestApt testDependencies.daggerCompiler

    androidTestCompile files(testDependencies.wireMockJar)
    androidTestCompile testDependencies.wmHttpClientAndroid
    androidTestCompile testDependencies.wmLogging
    androidTestCompile testDependencies.wmGuava
    androidTestCompile testDependencies.wmJetty
    androidTestCompile testDependencies.wmJackSonCore

    androidTestCompile (testDependencies.wmJsonAssert) {
        exclude group: 'org.json', module: 'json'
        exclude group: 'commons-collections', module: 'commons-collections'
    }
    androidTestCompile testDependencies.wmXmlUnit
    ///////////////////////////////////////////////////////////////////


}

0 个答案:

没有答案