新的Android Gradle插件1.3功能单独的仪器测试模块无法正常工作

时间:2015-12-02 09:31:37

标签: android-studio android-gradle build.gradle robotium gradle-plugin

在运行模块test的检测测试时,我收到以下错误 -

Test running failed: Instrumentation run failed due to 'java.lang.NoClassDefFoundError' Empty test suite.

我有一个包含两个模块的项目:apptest

这是build.gradle(测试)`

apply plugin: 'com.android.test'

    android{
        compileSdkVersion 19
        buildToolsVersion "21.1.2"
        defaultConfig{
            testApplicationId 'com.xx.android.test'
            testInstrumentationRunner com.xx.android.test.CustomRunner'
        }
        targetProjectPath ':app'
        targetVariant 'debug'
    }
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
    }

&安培;这是测试模块的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xx.android.test">
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19" />
<application>
    <uses-library android:name="android.test.runner" />
</application>
    <instrumentation android:name=".CustomRunner"
        android:targetPackage="com.xx.android"
        android:handleProfiling="false"
        android:functionalTest="false"
        android:label="Instrumentation test"/>
</manifest>

0 个答案:

没有答案