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:
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.