2015-06-26 13 views
1

Я пытаюсь запустить assertj-android, но он отправил сообщение об ошибке. (Он прекрасно работает с JUnit 4)Android - Assertj Android - Ошибка запуска

Мои Зависимости:

dependencies { 
    testCompile 'junit:junit:4.12' 
    androidTestCompile ('com.squareup.assertj:assertj-android:1.0.0'){ 
     exclude group:'com.android.support', module:'support-annotations' 
    } 
} 

Мой типаж Телосложение:

buildTypes { 
    debug { 
     signingConfig signingConfigs.debug 

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

Мои progard-rules.pro:

## Assertj 
-dontwarn org.assertj.** 
-keep class org.assertj.** {*;} 

И я получаю эта ошибка при запуске:

:app:proguardDebugAndroidTest 
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find superclass or interface org.junit.rules.TestRule 
Warning:org.assertj.core.api.JUnitSoftAssertions$1: can't find superclass or interface org.junit.runners.model.Statement 
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.rules.TestRule 
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.runners.model.Statement 
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.runner.Description 
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.runners.model.Statement 
Warning:org.assertj.core.api.JUnitSoftAssertions: can't find referenced class org.junit.runner.Description 
Warning:org.assertj.core.api.JUnitSoftAssertions$1: can't find referenced class org.junit.runners.model.Statement 
Warning:org.assertj.core.api.JUnitSoftAssertions$1: can't find referenced class org.junit.runners.model.MultipleFailureException 
Warning:org.assertj.core.api.JUnitSoftAssertions$1: can't find referenced class org.junit.runners.model.Statement 
Warning:org.assertj.core.internal.JavaBeanDescriptor: can't find referenced class java.beans.PropertyDescriptor 
Warning:org.assertj.core.internal.PropertySupport: can't find referenced class java.beans.PropertyDescriptor 
Warning:org.assertj.core.internal.cglib.core.DebuggingClassWriter$1: can't find referenced class org.assertj.core.internal.cglib.asm.util.TraceClassVisitor 
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.PropertyDescriptor 
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.IntrospectionException 
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.Introspector 
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.BeanInfo 
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.PropertyDescriptor 
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.BeanInfo 
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.PropertyDescriptor 
Warning:org.assertj.core.internal.cglib.core.ReflectUtils: can't find referenced class java.beans.IntrospectionException 
Warning:org.assertj.core.util.introspection.Introspection: can't find referenced class java.beans.Introspector 
Warning:org.assertj.core.util.introspection.Introspection: can't find referenced class java.beans.BeanInfo 
Warning:org.assertj.core.util.introspection.Introspection: can't find referenced class java.beans.PropertyDescriptor 
Warning:org.assertj.core.util.introspection.Introspection: can't find referenced class java.beans.BeanInfo 
Warning:org.assertj.core.util.xml.XmlStringPrettyFormatter: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry 
Warning:there were 59 unresolved references to classes or interfaces. 
     You may need to add missing library jars or update their versions. 
     If your code works fine without the missing classes, you can suppress 
     the warnings with '-dontwarn' options. 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) 
:app:proguardDebugAndroidTest FAILED 
:app:newRelicDeinstrumentTask 
[newrelic.info] Deinstrumenting... 
Error:Execution failed for task ':app:proguardDebugAndroidTest'. 
> java.io.IOException: Please correct the above warnings first. 

Почему?

ответ

2

Основано на Proguard revision 1.2.0 и post in stackoverflow.

мне нужно добавить testProguardFiles моей отладки buildType, потому что тесты не учитывают proguardFiles атрибут поэтому игнорировал мои настройки Proguard:

buildTypes { 
     debug { 
      signingConfig signingConfigs.debug 

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

И мой файл Proguard:

## Assertj 
-dontwarn org.assertj.core.** 
-dontwarn org.junit.** 
-dontwarn java.beans.**