Nikitah
Nikitah

Reputation: 739

AWS Device Farm error: INSTALL_FAILED_OLDER_SDK, but I have backwards compatibility

So I'm receiving the following error when device farm devices with Android 7.0 (and lower) try to install my application:

Failed to install com.carto.advanced.kotlin.test - 
INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: 
/data/app/vmdl777879102.tmp/base.apk (at Binary XML file line #5): 
Requires newer sdk version #25 (current version is #24)

While it is technically correct, I am targeting sdk 25, I also have backwards compatibility installed and this should not be a problem.

compile 'com.android.support:appcompat-v7:25.2.0'

Here's the relevant section of my build.gradle:

compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.carto.advanced.kotlin"
    minSdkVersion 18
    targetSdkVersion 25
    versionCode 4
    versionName "0.3.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    manifestPlaceholders = [HOCKEYAPP_APP_ID: "xxxx"]
}

It installs and runs on everything >=18 just fine, I've tested it on several devices. What's going on here?

It's worth mentioning that I'm using espresso version 2.2.2 and UIAutomator version-v18:2.0.0

compile 'com.android.support.test.uiautomator:uiautomator-v18:2.0.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

Image from error page:

Image from error page

Image from result page: enter image description here

Upvotes: 1

Views: 495

Answers (2)

Nikitah
Nikitah

Reputation: 739

The problem is not resolved, but answering my own question, as the question is no longer relevant – it's not related to AWS Device Farm.

By analyzing the test's .apk, I found out that Android Studio does some weird magic where it override's the tests minSdkVersion.

From Android's documentation: You can add your own manifest file if necessary, such as to specify a different value for minSdkVersion or register run listeners just for your tests.

So I created a separate manifest for my test (and it does use it), but build.gradle still overrides minSdkVersion to be the targetSdkVersion.

Will update my answer when it's solved.

Upvotes: 0

ahawker
ahawker

Reputation: 3374

Nikitah,

Failed to install com.carto.advanced.kotlin.test

The package that is failing to install ends with .test which tells me that it's the instrumentation APK and not the actual application APK that is failing to install.

My guess is that the AndroidManifest.xml in your instrumentation APK has the minSdkVersion set to 25 (or is unset).

You can confirm using aapt. For example:

⇒ aapt debug badging <your-instrumentation.apk> | grep -i sdkversion sdkVersion:'14' targetSdkVersion:'24'

Hope that helps!

Upvotes: 1

Related Questions