I am trying to add a dependency in my app which has the minimum sdk version newer than my apps so I am getting the following error
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library
Suggestion: use tools:overrideLibrary="com.nononsenseapps.filepicker" to force usage
but I don't know where to add that suggestion so I can build it.
This is how my build.gradle(Module: app) looks right now
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.codedspycamera.android"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nononsenseapps:filepicker:+'
compile 'com.squareup.picasso:picasso:2.4.0'
}
com.nononsenseapps.filepicker works only on >=14 version android device. I think it will crash if you force it to work on <14 devices. But anyway if you want to do this, you should force using minSdkVersion params from your main app to override library value. Add suggested line to main app manifest. Read this for more information.
Just to make the answer more clear for everyone this is what you have to do
tools:overrideLibrary marker
A special marker that can only be used with uses-sdk declaration to override importing a library which minimum SDK version is more recent than that application's minimum SDK version.
Without such a marker, the manifest merger will fail. The marker will allow users to select which libraries can be imported ignoring the minimum SDK version.
Example, In the main android manifest :
<uses-sdk android:targetSdkVersion="14" android:minSdkVersion="2"
tools:overrideLibrary="com.example.lib1, com.example.lib2"/>
will allow the library with the following manifest to be imported without error :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lib1">
<uses-sdk android:minSdkVersion="4" />
</manifest>
Note that the if multiple libraries are added than they must be separated with a comma ","
For ionic developers
config.xml - add -
<preference name="android-minSdkVersion" value="19" />
bundle.gradle - add
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
Related
I have this error :
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzrf.class
I want to add google play services to my project so i put this line in build.gradle file :
compile 'com.google.android.gms:play-services:7.8.0'
So I had to enable multidex and I followed android doc, adding this in build.gradle :
compile 'com.android.support:multidex:1.0.1'
and
multiDexEnabled true
I add this in android manifest :
<application
...
android:name="android.support.multidex.MultiDexApplication">
But I have the error I wrote above. I've found a lot of questions relative to this problem (app:packageAllDebugClassesForMultiDex) but not with that (duplicate entry: com/google/android/gms/internal/zzrf.class).
I tried some solutions like remove some google libraries but I don't know what refers to internal/zzrf.class.
Here is my gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "fr.djey.testgoogleplus"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.android.support:multidex:1.0.1'
}
I faced same problem. In my case I used home made Android library used by My Android app. Which means 1 project with 2 separate modules, while the app module depends on the library module.
Both have support of multidex. The root cause was inconsistency between google play services version. In the app module I used 7.8.+ and in the library I used 8.1.+. So I just updated both to same 8.1.+ and that fixed for me. So my answer is to check all the libs you depend on and may 1 of them using google play services version below yours.
Delete all files under build folder of that project. In my case, it is the jar file of the whole google play conflict with the jar file of only ads service.
As I said in the comment : I created another project and just did the same things : putting google play services and multidex, the problem didn't appear anymore.
I am using the latest Android Studio 1.2.2. While trying to set AppTheme to Theme.Material according to this answer to support for older versions too(other than API 21) and many other solutions on the internet I did everything that was written. I made a different values folder named values-v21 and styles.xml in that folder. Then I wrote <uses-sdk tools:node="replace" /> , the build gave me an error saying:
Error:(6, 5) uses-sdk element cannot have a "tools:node" attribute
Error:(6, 5) Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk element cannot have a "tools:node" attribute.
Here is my app.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.amangrover.finalapp"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
I thought this problem was fixed for newer versions of Android Studio?
Add this lines in your project's AndroidManifest.xml file to uses-sdk tag like this:-
<uses-sdk
tools:node="merge"
android:minSdkVersion="14"
android:targetSdkVersion="19"/>
And also add the tools name space in manifest :-
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" .....
.../>
So I know that many other people had this problem, but mine is a little different. I've tried running my app on an LG G2 with Android 4.4.4, and a Note 3 with Android 4.4.2, but neither worked. I have installed the API 18, 19, and 20 SDKs.
Failure [INSTALL_FAILED_OLDER_SDK]
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ween.control"
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.+'
}
You can't test an Android-L app on a device with lower API.
Take a look here.
You need to make sure your dependencies are configured targeting the same sdk (also make sure the sdk is supported for the dependency).
As of version .11, the gradle plugin now uses the new manifest merger tool by default which you can use to avoid conflicting configurations when merging manifests from your dependencies while building by specifying <uses-sdk tools:node="replace" /> in your AndroidManifest.xml file.
http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger
credit goes to Eddie Ringle
I was having a similar issue but my device sdk was 19 and it was looking for it to be 20. I changed the sdk from the file > Project Structure > SDK to 19 also I noticed when I was running it had the wear value selected in the top toolbar so I switched that to mobile and Voila.
I am not sure what's the issue. I googled and though it was about matching the sdk versions. They are the same as follows:
build.gradle
android {
compileSdkVersion 17
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 4
targetSdkVersion 17
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':slidingMenu')
compile project(':slidingMenu')
compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')
compile files('libs/Parse-1.4.0.jar')
}
Manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gurbani.ujagar"
android:hardwareAccelerated="true"
android:installLocation="preferExternal"
android:versionCode="26"
android:versionName="7.0" >
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="17" />
You will be ended up with this error, If your libraries/modules uses different minSdkVersion or targetSdkVersion inside your project.
To find , In which module actual conflicts are happening you can see your Gradle Console output.
Best practice is to have minSdkVersion 8 at least because most of the libraries like play services etc using this.
Please do the following change and sync Project with gradle
Try to Use minsdkVesion 8 in all your build.gradle files as well as AndroidManifest.xml files ans sync.
If it doesn't solves the problem go through your gradle console to and make required changes as per the error shown.
Note : While compilation, your minSdkVersion and targetSdkVersion in AndroidManifest.xml will be overridden by what you have mention in your build.gradle files.
I think slidingMenu library minSdkVersion is greater than yours (minSdkVersion 4). So manifests cant be merged. You cant use library that requires min version 11 (e.g.) in app that works on api version 4.
I got this Froyo (2.2) device that I am using to make an app.
When I try to run the app directly to the device it shows an error saying
pkg: /data/local/tmp/com.example.HelloWorldProject
Failure [INSTALL_FAILED_OLDER_SDK]
and in another window there's an error saying
Unable to attach test reporter to test framework or test framework quit unexpectedly
What seem to make the said errors?
EDIT:
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.helloworld"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17"/>
<application
android:allowBackup="true"
android:debuggable="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
>
<activity
android:name="com.example.HelloWorldProject.MyActivity"
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>
After I changed
defaultConfig {
applicationId "com.example.bocheng.myapplication"
minSdkVersion 15
targetSdkVersion 'L' #change this to 19
versionCode 1
versionName "1.0"
}
in build.gradle file.
it works
This error
Failure [INSTALL_FAILED_OLDER_SDK]
Means that you're trying to install an app that has a higher minSdkVersion specified in its manifest than the device's API level. Change that number to 8 and it should work. I'm not sure about the other error, but it may be related to this one.
Besides checking the right minSdkVersion in build.gradle, make sure you have installed all necessary tools and correct SDK Platform for your preferred Android Version in SDK Manager. In Android Studio klick on Tools -> Android -> SDK Manager. Then install at minimum (for Android 2.2 without emulator):
Android SDK Tools
Android SDK Platform-tools
Android SDK Build-tools (latest)
Android 2.2 (API 8)
SDK Platform
Google APIs
This is what worked for me.
Make sure you don't have a minSdkVersion set in your build.gradle with a value higher than 8. If you don't specify it at all, it's supposed to use the value in your AndroidManfiest.xml, which seems to already be properly set.
Just removing uses-sdk tag works for me for such problems.
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.
N/B Froyo 2.2 API 8
To fix this simply change
targetSdkVersion="17" to targetSdkVersion="8"
cheers.
Make Sure the Select Run/Debug Configuration is wear or mobile as per your installation in android studio...
Failure [INSTALL_FAILED_OLDER_SDK]
For Sumsung note3 I just edit the AndroidManifest.xml file and add the following code:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17"/>
In your manifest file package attribute is set to com.test.helloworld however your activity class is under different package. Change your MyActivity class package to com.example.helloworld
This is because you mobile has older sdk version than your application..!!!
It means your application need sdk version suppose Lollipop but you mobile has version kitkat.
Fix your gradle file the following way
defaultConfig {
applicationId "package.com.app"
minSdkVersion 8 //this should be lower than your device
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
In android studio: reduce minSDKversion. It will work...
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "healthcare.acceliant.trianz.com.myapplication"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
}
I fixed this problem.The device system version is older then the sdk minSdkVersion。
I just modified the minSdkVersion 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
Maybe go to File>Project Structure > Modules and Change your Source Compability to a lower version before Ive done this, Ive changed in build.gradle
mindSdk and tragetSdk from 31 to 30.
Now I can use the Emulator without problems
Change file AndroidManifest.xml
<uses-sdk android:minSdkVersion="19"/>
<uses-sdk android:minSdkVersion="14"/>