0

在为 module 运行仪器测试时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>
4

0 回答 0