使用Android Espresso自动化工具时会出现一些错误。找不到它究竟指的是什么

时间:2017-01-12 07:36:25

标签: android android-studio android-espresso

以下是我在构建应用程序时遇到的错误。

AGPBI: {"kind":"error","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}
AGPBI: {"kind":"error","text":"(org.ccil.cowan.tagsoup.Parser$1) that doesn\u0027t come with an","sources":[{}]}
AGPBI: {"kind":"error","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]}
AGPBI: {"kind":"error","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]}
AGPBI: {"kind":"error","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]}
AGPBI: {"kind":"error","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]}
AGPBI: {"kind":"error","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]}
AGPBI: {"kind":"error","text":"indicate that it is *not* an inner class.","sources":[{}]}

FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/test/BuildConfig;

有人可以帮我解决这个问题吗?是否需要使用build.gradle更改任何内容?

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
    applicationId "com.example.sanket.loginapp"
    minSdkVersion 18
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled = false
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
    exclude module: 'support-annotations'
}

androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile ('com.android.support.test:runner:0.5') {
    exclude module: 'support-annotations'
}
androidTestCompile ('com.android.support.test:rules:0.5') {
    exclude module: 'support-annotations'
}

androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
compile 'com.android.support:appcompat-v7:23.1.1'
testCompile 'junit:junit:4.12'
}

这是我的build.gradle。我找不到任何解决这个问题的方法。

1 个答案:

答案 0 :(得分:0)

您可以放心地忽略这些警告。 import os os.environ["SCIPY_PIL_IMAGE_VIEWER"]="display" # i'm not sure what you want here

对于构建失败,您似乎达到了神奇的65K方法计数。 在AGPBI: {"kind":"error","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]}

中将multiDexEnabled更改为true

供参考: 我认为最好的做法是在defaultConfig中创建调试构建风格,如下所示。这样您就可以使用ProGuard管理版本的apk大小。

buildTypes