Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set different minSdkVersion for testAndroid than for main app

Is it possible to set a different minSdkVersion for tests than for the app itself? I ask because I want to use the new Test Support Library and UI Automator for testing. However, this is only available on API 18+. At the same time, I still want to support older versions of Android, albeit not as thoroughly tested. What do I need to add to my build.gradle file in order to do this?

To clarify, I am using Android Studio and the "new" Gradle-based project structure.

like image 463
Code-Apprentice Avatar asked Jun 02 '15 00:06

Code-Apprentice


People also ask

How do you change minSdkVersion in react native?

You can see it here on their official build. gradle file: android { compileSdkVersion 28 ... defaultConfig { minSdkVersion(16) targetSdkVersion(28) versionCode(1) versionName("1.0") } ... } By setting minSdkVersion to 16 , react-native uses Android API's natively supported by at least KitKat version.

How do I change sdk to minSdkVersion?

check it: Android Studio->file->project structure->app->flavors->min sdk version and if you want to run your application on your mobile you have to set min sdk version less than your device sdk(API) you can install any API levels. Show activity on this post. Set the min SDK version in your project's AndroidManifest.

Where can I change minSdkVersion?

To change Android minSdkVersion in Flutter for the project created after the 2.8 update, you have to make changes in the local. properties file and then reference the new variable from the local. properties file inside the build. gradle file.


1 Answers

I got this from the new testing template from Google.

Create a new AndroidManifest.xml file in your test or androidTest folder.

<?xml version="1.0" encoding="utf-8"?> <manifest     xmlns:tools="http://schemas.android.com/tools"     package="your.package.name">      <uses-sdk tools:overrideLibrary="android.support.test.uiautomator.v18"/> </manifest> 
like image 176
theblang Avatar answered Sep 20 '22 00:09

theblang