UI Automator in project with minSdkVersion 9 - android

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.

Related

Manifest merger failed error during build

I'm trying to build an app for API 7 which is the device I need to run it on.
I've set the minSDK to 7, and added the following:
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="19"
tools:ignore="OldTargetApi"
tools:overrideLibrary="android.support.test.espresso,
android.support.v7.appcompat,
android.support.v4,
android.support.mediacompat,
android.support.fragment,
android.support.coreui,
android.support.coreutils,
android.support.graphics.drawable,
android.support.compat">
</uses-sdk>
However, during the (gradle) build I get the following error:
Error:Execution failed for task ':app:processDebugAndroidTestManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 7 cannot be smaller than version 8 declared in library [com.android.support.test.espresso:espresso-core:2.2.2] C:\Users\david\.android\build-cache\828bf92787e99464e08501328373b997b66ab556\output\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.test.espresso" to force usage
Everything worked fine until I set the min sdk to 7 (it was 26).
What else do I have to do to get this to build? Thanks
If your android:minSdkVersion="7" is a mandatory, you can try using the old version of espresso in your app build.gradle with the following dependencies:
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
You can found the version list in Testing Library Support Release Notes
uses-sdk:minSdkVersion 7 cannot be smaller than version 8 declared in
library
Your error is perfectly clear.Some of your included libraries configured to use with Minimum of SDK version 8.
Please downgrade the libraries to 7 or upgrade your App to 8.
Ok, this issue is resolved. As advised, I removed the reference to espresso, and found a solution to Dex problem on SO. Thanks to all who replied.

':app:processDebugManifest' error while importing project

I am trying to import an Android sample project then i get this message error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:11.0.0] C:\Users\HP.android\build-cache\084ac0ca1bed4f5e30644d43f2b1fe5758c0d427\output\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
You need to change min sdk to 14 in build.gradle file of app module.
Basically, libraries have their own minSdkVersion. When you add a library in your project, which here is gms.play_services, for example, uses 14 as minSdkVersion, and in the meantime, you are using 10 in your own project, this error will appear while you're trying to sync your project. SO:
Or you have to raise your projects minSdkVersion to 14.
Or you can add tools:overrideLibrary in your manifest like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk
tools:overrideLibrary="com.google.android.gms.play_services"/>
</manifest>

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.

I'm getting error: ":BaseGameUtils:processDebugAndroidTestManifest" on Android Studio startup only

My android app is using BaseGameUtils and every time I start Android Studio I get the following error:
Error:Execution failed for task ':BaseGameUtils:processDebugAndroidTestManifest'.
java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 7 declared in library [com.android.support:appcompat-v7:20.0.0] F:\Programowo\androidapps\FixMath\BaseGameUtils\build\intermediates\exploded-aar\com.android.support\appcompat-v7\20.0.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
I'm getting this error only once on startup Android Studio.
That's how look my project structure
app project structure
I just add this line in BaseGameUtils AndroidManifest.xml
<uses-sdk android:minSdkVersion="14" />
Just add this line
<uses-sdk tools:overrideLibrary="com.google.android.gms.all"/>
on your app --> manifest --> AndroidManifest.xml file
That error means that the imported library com.android.support:appcompat-v7:20.0.0 has a minSdkVersion specified as 7 whereas you seem to be targeting lower versions

Minimum sdk for Facebook sdk

I had the common errors like when trying to setup the fb sdk such as ANDROID_BUILD_SDK_TOOLS ERROR and getbootclasspath() method error
but some of the solutions that people posted on SO has the minimum sdk as 14, instead of 9 (which is shown on the fb's guide). Now in my app's build.gradle file, if I use minSdkVersion 9 instead of 14, it wont work and it will say:
Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library
I have researched, but couldn't find the solution for using 9 because I want to support the app on Gingerbread.
If anyone has this kind of error
"uses-sdk:minSdkVersion 14 cannot be smaller than version 15"
Just downgrade FacebookSDK to 4.5.0
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
nvm I solved it. All I had to do was put this in the app's manifest file:
> <uses-sdk android:targetSdkVersion="22" android:minSdkVersion="9"
> tools:overrideLibrary="com.facebook"/>

Categories

Resources