uses-sdk element cannot have a "tools:node" attribute - android

I've updated Android Studio last night to 0.9.0, buildToolsVersion to 21.1.0 and gradle to 0.14.0, after that I'm receiving this error
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk element cannot have a "tools:node" attribute
I've spent the last night looking for a solution, I found this:
<uses-sdk tools:node="replace" />
But unfortunately, added one more error!
Error:(10, 5) uses-sdk element cannot have a "tools:node" attribute
Error:(10, 5) Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk element cannot have a "tools:node" attribute
Another solution I've read, to not use support-v4:21, for me I don't use it, since I'm using v13.

Solution:--
Add this line to uses-sdk tag like this:-
<uses-sdk
tools:node="merge" <----This line do the magic
android:minSdkVersion="14"
android:targetSdkVersion="19" />
And add the tools name space in manifest :-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" .....
.../>

OK this is not the answer, but a temporary workaround.
According to the Gradle build tools release notes this problem was fixed in version 0.13.2 (2014/09/26)
However, seems to happen again in 0.14.0 (2014/10/31)
You can disable the manifest merger task in order to build your project for the time being.
Add the following in your build.gradle file
android.applicationVariants.all { variant ->
variant.processResources.manifestFile = file('src/main/AndroidManifest.xml')
variant.processManifest.enabled=false }
See this question for reference.

I ran into this after upgrading to Android Studio 1.0.0 rc4. I had previously been using so that I could make projects with lower min SDK versions than some of the libraries they depended on. Turns out, if you remove tools:replace and let the compiler error out again with the manifest merge conflict, it will provide you with a much better solution:
<uses-sdk tools:overrideLibrary="com.google.android.gms" />
At least, the Google Play Services library was what I was running into. Actually, you can list a whole bunch if you need to. Just comma-separate the package names. You may have to run the compiler a few times until it tells you every library that's causing problems.

My solution
I have removed all of the <uses-sdk tools:node="replace" /> From all of my manifest.xml files
In my base.gradle file(the one for the entire project I Added
ext {
compileSdkVersion = 19
buildToolsVersion = "21"
minSdkVersion = 10
targetSdkVersion = 19
}
In my modules I have this
// all modules
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
// in an application module
defaultConfig {
applicationId "com.something"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode appVersionCode
versionName appVersionName
}

The problem has solved after updating the AS to v0.9.1 and Gradle to 0.14.1.
Thank you guys_
Update
The problem appears again!
Update 2
Here is a workaround to solve this problem:
Open your project with Android Studio 0.8.14 / Gradle build tools 0.13.2
Build your project.
Switch back to Android Studio 0.9.1 / Gradle build tools 0.14.1
gradlew assembleRelease will work now

Related

error when i import android eclipse project in Android Studio

Hello guys i'm gald to be here, please i have that error, can you help me?
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:10.2.1] C:\Users\Khalil\StudioProjects\Android eBook Template\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\10.2.1\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
what i can do?
In your Manifest.xml file, update uses-sdk to version 14.
First Remove the google play library(in this case com.google.android.gms.play_services), then open manifests --> AndroidManifest.xml
and change min sdk version to 14
This Line:- android:minSdkVersion="14"
Also Change it in your build.gradle of app..
under the defaultConfig
Hope it helps!!

Wikitude: uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library [:wikitudesdk:]

I'm trying to build a cordova android app with wikitude plugin. When I build the project using cordova build, I got an error:
Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library [:wikitudesdk:]. I tried several answers here: Manifest merger failed : uses-sdk:minSdkVersion 14, but they didn't solve my problem.
Currently, my portion of build.gradle looks like:
dependencies {
// do not use dynamic updating.
compile 'com.android.support:appcompat-v7:20.+'
}
and I changed my AndroidManifest.xml to force the minsdkversion set to be 15:
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="23" />
anybody has ideas to solve this?
Sorry, my bad, I shouldn't change the:
~\<Project>\platforms\android\build\intermediates\exploded-aar\wikitudesdk\AndroidManifest.xml.
Instead, I just changed the version in ~\<Project>\platforms\android\AndroidManifest.xml and it works. Also, there's no need to change the dependencies in build.gradle if you are using the latest version. It should be a quick and easy fix.

UI Automator in project with minSdkVersion 9

im trying to use UI Automator in my project with minSdkVersion 9 and of course it not work because it target API 18.
So Android Studio throws me this error:
Error:(5, 5) uses-sdk:minSdkVersion 9 cannot be smaller than version 18 declared in library ~/app/build/intermediates/exploded-aar/com.android.support.test.uiautomator/uiautomator-v18/2.1.1/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.test.uiautomator.v18" to force usage
Error:Execution failed for task ':app:processDebugAndroidTestManifest'.
> java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 18 declared in library ~/app/build/intermediates/exploded-aar/com.android.support.test.uiautomator/uiautomator-v18/2.1.1/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.test.uiautomator.v18" to force usage
I added to my Manifest the tag <uses-sdk tools:overrideLibrary="android.support.test.uiautomator.v18" /> but the error keep showing, i am doing something wrong?
If you use gradle you can add another Manifest to the androidTest build type which will get merged and does not affect your normal release / debug builds.
Add app/src/androidTest/AndroidManifest.xml to your project:
<manifest
package="${applicationId}.test"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk tools:overrideLibrary="android.support.test.uiautomator.v18"/>
</manifest>
This will merge the manifest with your normal one, not requiring to change your minSdk. PLease note, that this will probably crash if you try running UI Instrumentation Tests on sdk < 18.
By adding additional permissions to the debug/AndroidManifest you can also just add permissions for your tests like external storage if you don't regularly need them in your app. They will although be also available to your debug builds.
This worked for me
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="${applicationId}.test">
<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator" />
You need to build your app with minSdkVersion 18, however you can still switch to espresso.

How to change the Android Studio Project minSDK version?

I had a recurring error that I wasnt sure how to correct. My android studio was returning the an error indicating that my minSdk version was 11 and had to 14 in order to use the NoTitleBar parent reference in styles.xml. My AndroidManifest had the tag <uses-sdk android:minSdkVersion="14"/> but the error would not go away. I re-cleaned the project and tried to build again - same error.
Android Studio version: 0.8.6
OS: Win8.1
In app > build.gradle file try to modify this section
defaultConfig {
minSdkVersion 11
}
Best regards
Although I had the minSdk set in the manifest the project level sdk was overriding this or at least causing a collision. I located this way: File -> Project Structure -> App -> Flavors -> Change the minSdk version to whatever you need (preferably to match whats in the manifest if its declared - otherwise remove it from there). Hope this helps.
As a note I also next ran into this error I have not resolved yet:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1

Android Studio gradle build successfully despite api level error

I am working on an android project that Api level is 10, its is declared in build.gradle and AndroidManifest.xml files
defaultConfig {
minSdkVersion 10
targetSdkVersion 15
}
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="15" />
When I use ActionBar class Android Studio Editor underlined this line and gave warning as I expected "Call requires API level 11(current min is 10):android.app.ActionBar..."
but when I compile project , it is compiled successfully. It can be cause errors , how can it be worked on API lvl 10 devices.I want an error about this, but it compiled.How can I get a build error about this. ty.
What you are seeing is the Android lint tool displaying errors, but Android Studio still allowing compilation.
This is because the lint errors you see do not prevent compilation. It seems that Android Studio (at least in v1.3.2) the build process ignores lint errors during compilation by default, whereas in Eclipse w/ ADT plugin you would not be able to compile.
Looking at Improving with Lint, you can modify your build.gradle file with lint options in order to have the build fail:
android {
lintOptions {
// if true, stop the gradle build if errors are found
abortOnError false
}
}
Change below...
defaultConfig {
minSdkVersion 11
targetSdkVersion 15
}
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
After setting gradle or menifest. clean and rebuild your project. hope it will work.... if still not working restart tool and try to compile project again....

Categories

Resources