This multi-apk application requires a device with API level 21+

1.2k Views Asked by At

I want to automate the android test using CI(Jenkins), but I'm getting the following error once I executed the gradle connectedCheck:

:app:connectedAndroidTest
Unable to install /Users/asolano/Projects/Mobile/Android/Integration-Test-ATDroidUtils/app/build/outputs/apk/app-debug-androidTest-unaligned.apk
com.android.ddmlib.InstallException: This multi-apk application requires a device with API level 21+
    at com.android.ddmlib.Device.installPackages(Device.java:862)
    at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:105)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:132)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

com.android.builder.testing.ConnectedDevice > runTests[SM-G850M - 4.4.4] FAILED 
    com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: This multi-apk application requires a device with API level 21+
        at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:108)
null
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: This multi-apk application requires a device with API level 21+
    at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:108)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:132)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.ddmlib.InstallException: This multi-apk application requires a device with API level 21+
    at com.android.ddmlib.Device.installPackages(Device.java:862)
    at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:105)
    ... 8 more
:app:connectedAndroidTest FAILED

This is working fine in the workstation which has the Android Studio installed. But the server does not have Android Studio Installed, only Gradle and Android SDK (Tools and everything else).

My question is what am I missing to get the tests running using gradle connectedCheck on the server? Using the console in the work station they are working fine.

The work station is using Android Plugin Version 1.1.0rc-3 Gradle 2.3(same as the server) and the android sdks installed on both are the same.

![apply plugin: 'com.android.library'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        abortOnError false
    }

    testOptions{
        unitTests.returnDefaultValues = true
    }

    sourceSets{
        instrumentTest.setRoot('src/test/java')
    }

    packagingOptions {
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile 'junit:junit:4+'
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    compile fileTree(dir: 'libs', include: \['*.jar'\])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.googlecode.json-simple:json-simple:1.1'
    compile 'org.roboguice:roboguice:2.0'
    compile project(':atdroidutilslib')

    androidTestCompile 'junit:junit:4.12'
    androidTestCompile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    androidTestCompile fileTree(dir: 'libs', include: \['*.jar'\])
    androidTestCompile 'com.android.support:appcompat-v7:21.0.3'
    androidTestCompile 'com.googlecode.json-simple:json-simple:1.1'
    androidTestCompile 'org.roboguice:roboguice:2.0'
    androidTestCompile project(':atdroidutilslib')
}]

Android Plugin Version

0

There are 0 best solutions below