Manifest merger failed : Problem solving didn't work - android

Problems: There are bugs in the new version and the old version. Problems occur when updating SDK versions.
"Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details."
There is a solution, but it gives an error as in the picture.
<activity android:name=".MainActivity"
android:exported="true">
I think the solution should be like this, but it gives another error.

You are getting this error because the API level (or the android version) of the device that you are trying to run the app is less than the minimum API version you specified in the gradle file.
You can find more information about API levels here.

Related

AGP 7.3.1 manifest merger failed

After updating to Android Gradle Plugin 7.3.1 Android Studio says that package is deprecated in AndroidManifest.xml and I need to use namespace param in build.gradle.kts. I removed the package attribute in all my android manifests (I'm using additional manifest files for debug and release builds) and have done this:
build.gradle.kts
android {
...
applicationId = "org.sample.appid"
...
namespace = "org.sample.packageid"
...
}
After this I can not build the project because of the error:
D:\Desktop\Sample\app\src\debug\AndroidManifest.xml:4:5
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Attribute manifest#package value=(org.sample.packageid) from AndroidManifest.xml:4:5-35
is also present at AndroidManifest.xml:2:1-102:12 value=(org.sample.appid).
Attributes of <manifest> elements are not merged.
Debug manifest can not be merged with the main manifest, but why package name is mixed with applicationId while merging? Is there anything that must be additionally configured? Or there's a bug with AGP 7.3.1?
The error message even precisely tells where the problem lies.
... also remove package from src\debug\AndroidManifest.xml.
The problem was really complex - I missed removing the package attribute in one AndroidManifest.xml. Also, Android Studio must be restarted after that with a full cache clear (without this it will not work). After that everything works as expected.

Does using `tools:overrideLibrary` have any benifits over `minSdkVersion`?

I'm going to use a library in my project and it shows error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library [:library:] ... Suggestion: use
tools:overrideLibrary="test.com.library" to force usage
This prompt lets me know that imported liobrary using higher version (15) than my application min sdk version which is 14.
I want to know if I
I want to know if I use tools:overrideLibrary does it let my application to keep its min SDK version and be installed on phones with API14 or it is not the case? Beside I want to know what is the benefit for using tools:overrideLibrary over `minSdkVersion'?

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.

Manifest merger failed : uses-sdk:minSdkVersion 11

I really don't know what's the problem, I always get this error when I try to build my project
Error:Execution failed for task ':app:processReleaseManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 11 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:10.2.0] C:\Users\AYOUB\Desktop\Boiling ball studio\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\10.2.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
As stated in the error; you should update your minimum version from 11 to 14.
Google Play services need at least Android version 14 (4.0) to work.
Check this link from Google
Manifest Merger occurs when there is a mismatch in a version of your dependencies. So be careful to mention the version of your dependencies to be same.
And also make sure that the version is same in all the external libraries or a module, you are using.

Android theme error when adding a new dependency

I'm following the examples on this sample from github but when i add the dependency I recieve the error
"
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application#theme value=(#style/AppTheme) from AndroidManifest.xml:20:9-40
is also present at [com.github.boxme:squarecamera:1.0.3] AndroidManifest.xml:11:18-76 value=(#style/squarecamera__CameraFullScreenTheme).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:16:5-81:19 to override."
I gather it's because im using this "compile 'com.android.support:appcompat-v7:22.2.1'" which is an older version and is conflicting with the theme from the added dependency.
however I want to avoid changing appcompat to a newer version because every activity i have relies on 22.2.1 and the change would be too great.
Are there any ways of working around this error? Or should i just look into another way of creating a square image from camera activity?

Categories

Resources