Hi I am using CameraX api to build custom camera, after adding updated library dependency to build.gradle file, i am getting following build error
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [androidx.camera:camera-extensions:1.0.0-alpha08] /Users/.gradle/caches/transforms-2/files-2.1/f20dc98c605a4c4dbd6030601f9665d3/camera-extensions-1.0.0-alpha08/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="androidx.camera.extensions" to force usage (may lead to runtime failures)
build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
flavorDimensions 'dimensions'
productFlavors {
dev {
//assembleDevDebug crashlyticsUploadDistributionDevDebug
applicationId ""
versionName "D(0.0)" //for QA Release
versionCode 00
proguardFile("proguard-rules.pro")
}
prod {
applicationId ""
versionName "1.3" //for prod release
versionCode 13
proguardFile("proguard-rules.pro")
resValue "string", "app_name", "Prod Android"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.camera:camera-core:1.0.0-beta01"
implementation "androidx.camera:camera-camera2:1.0.0-beta01"
implementation "androidx.camera:camera-extensions:1.0.0-alpha08"
}
apply plugin: 'com.google.gms.google-services'
You can stick to your minimum version 16 by adding the following to your manifest file.
<uses-sdk tools:overrideLibrary="androidx.camera.view, androidx.camera.camera2, androidx.camera.lifecycle, androidx.camera.core"/>
To avoid runtime failures you'll need to check if the device is running on api 21 and above before using CameraX
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
// Use camera2 or cameraX
}else{
// Use Camera1
}
Update your app.gradle minSdkVersion
from:
minSdkVersion 16
to:
minSdkVersion 21
Here is my gradle settings.
ext {
android_compile_version = 26
android_version = '26.0.1'
android_min_sdk_version =15
appcompat_library_version = '25.2.0'
support_library_version = '25.2.0'
gms_library_version = '11.0.4'
}
this is define in my project.gradle file and
apply plugin: 'com.android.application'
android {
compileSdkVersion android_compile_version
buildToolsVersion android_version
defaultConfig {
applicationId "com.xxasda.stickman"
minSdkVersion android_min_sdk_version
targetSdkVersion compileSdkVersion
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile project(':libraries:BaseGameUtils')
}
buildscript {
repositories {
jcenter()
}
}
This is my Build.Gradle file I don't know why it's not compiling.
but when I try to run application on emulator it throws me this error
Failure [INSTALL_FAILED_OLDER_SDK]
Installation failed since app's minSdkVersion is newer than device's API level (API 23).
Please update your apps minSdkVersion.
Error while Installing APK
I checked many times and replace min_sdk_version with absolute value 15 but still no luck.any one please advice it would be helpful.
Thank you. :)
I'm also getting same issue
I have solved my issue making below changes
compileSdkVersion 'android-P'
targetSdkVersion 27
and the dependencies
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
hope it help someone
this can also be caused when creating the app and you select a higher minimum sdk so when creating empty activity select the lowest(Icecream) and you wont experience the same...was avictim of the same and i got sorted after realising the it
You can try to add to your build.gradle (D:\AppName\app\build.gradle) the following line under default config:
minSdkVersion 28 //or whatever version you need
defaultConfig {
applicationId "com.example.appname"
minSdkVersion 28 <<<----------------------------------
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
I'm using Android-Studio.
When i tried to compile the project i got error:
Error:Execution failed for task ':app:processDebugResources'.
> at index 4
build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.myapp.user.myapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
Any suggestion please?thanks!
Change:
This:
buildToolsVersion "23.0.2"
To:
buildToolsVersion "21.0.1"
The newer buildTools sometimes have some bugs
I was having this exact same issue today. This is how I fixed it:
Check to see that the latest 23.0.3 build tool was installed. In my case (shown below), I noticed it wasn't installed:
Then, in my app level build.gradle, I changed this:
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
to
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
Hopefully this helps anyone encountering this issue recently.
Anyone know what I'm missing? My program worked 5 minutes ago and know I have this strange error:
17:16:38 UnsupportedMethodException
Unsupported method: AndroidArtifactOutput.getOutputFile().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.: Unsupported method: AndroidArtifactOutput.getOutputFile().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
I can't ignore it because I can not run it anymore on my android device, anyone?
Build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.test.google_maps_task_1"
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:4.2.42'
compile 'com.android.support:appcompat-v7:21.+'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
}
As I thought, there are many out of date plugins/tools here. Please try this fixed and updated build.gradle:
Also, make sure you are using the latest build plugin: com.android.tools.build:gradle:1.1.3.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22 // <-- was 21
buildToolsVersion "22.0.1" // <-- was 20.0.0
defaultConfig {
applicationId "com.example.test.google_maps_task_1"
minSdkVersion 11
targetSdkVersion 22 // <-- was 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:6.5.87' // <-- was 4.2.42
compile 'com.android.support:appcompat-v7:22.0.0' // <-- was 21.+
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1' // (the only up to date plugin you had)
}
Today I have downloaded Android Studio v 0.8.0 beta. I am trying to test my app on SDK 17 . Android studio error Failure [INSTALL_FAILED_OLDER_SDK]
Here is my android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vahe_muradyan.notes" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Main_Activity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
It seems that android studio uses configurations in build.gradle.Here is build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 'L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.vahe_muradyan.notes"
minSdkVersion 8
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
}
There are my config to support L and old versions of android:
apply plugin: 'com.android.application'
android {
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.uladzimir_klyshevich.myapplication"
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
l {
minSdkVersion 'android-L'
targetSdkVersion 'android-L'
compileSdkVersion 'android-L'
}
old {
minSdkVersion 10
targetSdkVersion 20
//TODO comment second line if build is not compiles for "L"
compileSdkVersion 20
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
lCompile 'com.android.support:appcompat-v7:21.+'
oldCompile 'com.android.support:appcompat-v7:19.1.0'
}
As result you will have flavors:
oldDebug
oldRelease
lDebug
lRelease
And can install your application on old versions of android.
Do those changes in build.gradle file in the wear module
compileSdkVersion 20
targetSdkVersion 20
So the final wear/build.gradle content will be:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "your package name"
minSdkVersion 20
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
}
I'm using Android Studio Beta version 0.8.1 and I have the same problem. I now I sold my problem by changing the AVD (I'm using Genymotion) to API 19.
and here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.daroath.actionbar"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Hope this help!
I ran into the same issue and solved it by downloading api level 20 using sdk manager and changing every string that points to android-L. I did it because I dont have a kitkat device and don't want to use emulator.
See the image download the marked one.
Here's my build config:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20//changed this from default
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.subash.test"
minSdkVersion 12//changed this from default
targetSdkVersion 20//changed this from default
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
As mentioned before switching to build 19 is the suggested route here until v20 is "fixed". This thread helped me solve the issue, but it seems similar answers have been posted here as well. https://code.google.com/p/android/issues/detail?id=72840
<uses-sdk android:minSdkVersion="19"/>
In AndroidManifest.xml worked for me on Android Studio(Beta)0.8.2.
in the AndroidManifest.xml file change the user-sdk to older version
<uses-sdk android:minSdkVersion="19"/>
Change file AndroidManifest.xml
<uses-sdk android:minSdkVersion="19"/>
<uses-sdk android:minSdkVersion="14"/>
After a lot of research i found the solution for this huge error which i was struggling for 2 days.
Instead of changing the minSdkVerison & targetSdkVersion in build.gradle
Just open the Manifest file and use this
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21"/
Failure [INSTALL_FAILED_OLDER_SDK]
basically means that the installation has failed due to the target location (AVD/Device) having an older SDK version than the targetSdkVersion specified in your app.
FROM
apply plugin: 'com.android.application'
android {
compileSdkVersion 'L' //Avoid String change to 20 without quotes
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.vahe_muradyan.notes"
minSdkVersion 8
targetSdkVersion 'L' //Set your correct Target which is 17 for Android 4.2.2
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+' // Avoid Generalization
// can lead to dependencies issues remove +
}
TO
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.vahe_muradyan.notes"
minSdkVersion 8
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.0.0'
}
This is common error from eclipse to now Android Studio 0.8-.8.6
Things to avoid in Android Studio (As for now)
Avoid Strings instead set API level/Number
Avoid generalizing dependencies + be specific
The real issue is that with vanilla Android Studio v 0.8 beta, it only installs/recognize SDK 20 which is android L. In order to target another complieSDK you need to install it via the SDK manager. Once it is set, you can then change the compileSDK to a lower version and it should work.
you may also want to restrict the compatibility library, it needs to be restricted from using the latest version of the library so change the dependecy to something like :
compile('com.android.support:appcompat-v7:19.1.0') {
// really use 19.1.0 even if something else resolves higher
force = true
}
I fixed this problem.
I just modified the compileSdk Version from android_L to 19
to target my nexus 4.4.4.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
**compileSdkVersion 'android-L'** modified to 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.antwei.uiframework.ui"
minSdkVersion 14
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
**compile 'com.android.support:support-v4:21.+'** modified to compile 'com.android.support:support-v4:20.0.0'
}
how to modified the value by ide.
select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19
sorry I don't have enough reputation to add pictures
I initially went into the SDK Manager and updated all that it had set to update.
I also added in the SDK version for the version of Android I had on the Droid I had...Version 2.3.4(10)
I don't think that really fixed anything, and after a Android Studio restart as recommended after the SDK installs, I changed the minSdkVersion to 8 in the build.gradle file
I was then able to download the application to my Droid.
defaultConfig {
applicationId "com.cmcjr.chuck.droid_u"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
This is Android Studio installed on Ubuntu 12.04
Just go to build.gradle(Module:App) and change the minSdkVersion to whatever you are using with emulator.
Example:
defaultConfig {
applicationId "com.example.raghu.sample"
// Change the version in following line
minSdkVersion 10 // <-- Whatever you are using with Emulator
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Just installed Android Studio v 0.8.1 beta and ran into the same problem targeting SDK 19.
Copied 19 from the adt-bundle to android-studio, changed build.gradle to:
compileSdkVersion 19
targetSdkVersion 19
then project -> app -> open module settings (aka project structure): change compile sdk version to 19.
Now works fine.
Similar to a few posts prior - I went to SDK Manager and uninstalled v20 and version L. Then I installed version 19 and this problem was resolved and I could debug using my android device, no errors.
Another way to support Android L is to use custom lpreview property for Gradle. For instance:
lpreview = hasProperty('lpreview')
apply plugin: 'com.android.application'
android {
compileSdkVersion lpreview ? "android-L" : 19
buildToolsVersion "20.0.0"
productFlavors { lpreview ? lpreview{} : classic{} }
defaultConfig lpreview ? {} : {
minSdkVersion 14
targetSdkVersion 19
}
Now, you can build your app with:
./gradlew clean
./gradlew -Plpreview assembleDebug
or
./gradlew -Plpreview installLpreviewDebug
This way you can build your app with lpreview property for Android L and without it for previous versions.
Check the 'minSdkVersion' in your build.gradle
The default project creates it with the latest API, so if you're phone is not yet up-dated (e.g. minSdkVersion 21), which is probably your case.
Make sure the minSdkVersion value matches with the device API version or if the device has a higher one.
Example:
defaultConfig {
applicationId 'xxxxxx'
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
your device older than minSDK , edit minSdkVersion in build.gradle
Try changing you sdk min version
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="19" />
One more place where minSdkVersion makes a sense is a flavor:
productFlavors {
dev {
minSdkVersion 22
}
prod {
minSdkVersion 9
}
}
minSdkVersion (22) will not install on development devices with API level older than 22.
you need update.
This is my current solution (09/2015).
In Android Studio search.
Menu --> Help --> check for update
Upate and problem solved!!
Good luck
Check the minimum API level inside the build.gradle(module: app)[inside of the gradle scripts].
Thatt should be equal to or lower than the device you use
In build.gradle change minSdkVersion 17 or later.