Android theme error when adding a new dependency - android

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?

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.

AndroidManifest error related to AndroidX when trying to build React Native 0.59 app

I'm trying to build a React Native Android application following an upgrade to RN 0.59.9, but I'm getting an error related to AndroidX.
I've tried many things including removing most native packages, changing AndroidManifest.xml and various other solutions mentioned on the internet but nothing seems to work.
My error is this:
> Task :app:processReleaseManifest FAILED
....\android\app\src\main\AndroidManifest.xml:22:18-91 Error:
Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:35:2-108:16 to override.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
As I understand it means one of the package uses AndroidX but not the main app, however as far as I can tell nothing in my app uses AndroidX, and I made sure to upgrade to RN 0.59, not 0.60. I've even tried to grep "androidx" and remove all the packages that might mention it.
I've also tried to add "android.useAndroidX=true / android.enableJetifier=true" to gradle.properties just to see what happens but as expected many modules don't build since they have not been upgraded to AndroidX.
Any idea how to fix this bug?
This is most likely due to Android releasing all AndroidX libraries, and '+'-style gradle dependencies leaking in.
You can either ./gradlew :app:dependencies|grep androidx to find the problem libraries and then use gradle resolutionStrategies or android/build.gradle ext{} versioning to pin the Google library dependency, or you can convert your react-native project to androidx and use the jetifier tool via npm i jetifier && npx jetify so that non-androidx react-native libraries work.
Either should result in a working build as the react-native ecosystem transitions to AndroidX

Manifest merger failed how to solve? [duplicate]

This question already has an answer here:
Manifest Merger Error - Different versions of support library
(1 answer)
Closed 4 years ago.
After adding new library app showing error?
I am trying to add
compile 'com.github.badoualy:stepper-indicator:1.0.7'
and after added this my app showing error
Error:Execution failed for task ':sample:processShopifyDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from
[com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 is
also present at [com.android.support:appcompat-v7:26.0.0-beta2]
AndroidManifest.xml:28:13-41 value=(26.0.0-beta2). Suggestion: add
'tools:replace="android:value"' to element at
AndroidManifest.xml:23:9-25:38 to override.
May be this is right way to solve this issue
https://stackoverflow.com/a/45258773/10010192
Probably you are using multiple versions of Android support library. So Please choose one of version and use it for all libraries. Maybe you can try 25.4.0 for all. (You also need to change compileSdkVersion and targetSdkVersion to 25.4.0)
don't use 'compile' in build.gradle.
try to change
compile 'com.github.badoualy:stepper-indicator:1.0.7'
to
implementation 'com.github.badoualy:stepper-indicator:1.0.7'

tools:replace does not work

I want to use android:allowBackup=false, but some other libraries have android:allowBackup=true.
So I need to add tools:replace="android:allowBackup", and this is also the way the Manifest Merger suggests, BUT it does not work.
After compile and also in the Manifest Merger Tool I get again the same error.
The tools:replace is already set, but the Manifest Merge suggests to add it.
If I click on the suggestion it will add another tools:replace tag.
Here is the Manifest Merger error:
This seems to be caused by a bug in the Gradle plugin: https://code.google.com/p/android/issues/detail?id=193679
If you remove the tools:ignore attribute from the application element, it should work.

Importing project from Eclipse to Android Studio

I just imported an Android project(which was written in Eclipse) to Android Studio. At first, I had some problems so I deleted some dependencies and later when I reimported the project to Android Studio
I had to include the dependencies which I earlier deleted. I tried to run the app and I got the following messages.
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute activity#com.google.android.gms.ads.AdActivity#configChanges value=(keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|locale) from AndroidManifest.xml
is also present at [com.google.android.gms:play-services-ads-lite:9.4.0] AndroidManifest.xml value=(keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize).
Suggestion: add 'tools:replace="android:configChanges"' to <activity> element at AndroidManifest.xml to override.
Error:orientation|screenLayout|uiMode|screenSize|smallestScreenSize)
Error:orientation|screenLayout|uiMode|screenSize|smallestScreenSize|locale) from AndroidManifest.xml
What am I doing wrong?

Categories

Resources