I have a problem when using RC1 of MAUI that caused me to remove this part from the Android manifest:
<application
...
android:icon="#mipmap/appicon"
android:roundIcon="#mipmap/appicon_round"
...>
</application>
Now that it has GA'd, I'm trying to add it back in because in Android my application icon is not displayed - instead it's just the generic Android icon. When I add this back into my Android manifest like so:
<application android:allowBackup="true"
android:supportsRtl="true"
android:icon="#mipmap/appicon"
android:roundIcon="#mipmap/appicon_round">
</application>
I get compile errors that I have no idea how to resolve. NOTE: I DO have a file called "appicon.png", and it DOES work correctly as the application icon on iOS. The errors look like this:
APT2260 resource xml/microsoft_maui_essentials_fileprovider_file_paths (aka com.watchlikes.watchlikesapp:xml/microsoft_maui_essentials_fileprovider_file_paths) not found.
APT2260 resource style/Maui.SplashTheme (aka com.watchlikes.watchlikesapp:style/Maui.SplashTheme) not found.
APT2067 failed processing manifest.
If I take the android:icon and android:roundIcon attributes out of the manifest file it compiles correctly again. Any idea on what this problem is, and/or how to troubleshoot it?
Had the same issue and followed https://learn.microsoft.com/en-us/dotnet/maui/user-interface/images/app-icons?tabs=android under "Platform-specific configuration":
If your icons name is "testicon.svg" just change the manifest file like this:
<application android:allowBackup="true"
android:supportsRtl="true"
android:icon="#mipmap/testicon"
android:roundIcon="#mipmap/testicon_round">
</application>
Ok so I was going through a tutorial online, then when i tried to change my build.gradle file to compileSdkVersion 21 instead of 23 everything lost the plot and now all my previous projects etc are all showing errors.
In the AndroidManifest.xml the 2 http lines and all the android: are all red and the the activity opening tag has a red squiggly line under it also. I have zero idea what i have done wrong! Almost like internet has gone? Just a noob so i have no idea please help!
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/tools"
package="com.site.project" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
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>
This answer extends #adelphus'.
A new app\build\intermediates\manifests\full\debug\AndroidManifest.xml would have listed these errors. Close and reopen the AndroidManifest.xml file from the project pane under app > manifests.
Hope this works for you.
You have duplicate schema definitions for the xmlns:android namespace in your manifest file - only one schema per namespace is allowed and I suspect the compiler is getting confused by the duplicate entry.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/tools"
package="com.site.project" >
should be:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.site.project" >
The namespace schema definitions are important - they are used to define attribute prefixes. Because your duplicate entry is invalidating the android namespace, all attributes prefixed with android: will be wrong - this is why all the android: attributes have an error (red line) displayed.
Alternatively, just remove the tools namespace completely if you're not using any attributes with the tools: prefix in your manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.site.project" >
you need download jdk here "https://www.oracle.com/technetwork/java/javase/downloads/index.html"
then go to File > Project Structure > here you config path jdk default C:\Program Files\Java\jdk-11.0.2 . Hope this works for you
I think you have two AndroidManifest.xml files to change it. Just rename the debug AndroidManifest.xml and that solution works for me.
Search for the AndroidManifest.xml file(s). on the project ParentPath. if there are multiple, keep one and delete the others.(usually find many other)
I am using a gradle project with many different library dependencies and using the new manifest merger. In my <application /> tag I have it set up as such:
<application tools:replace="android:icon, android:label, android:theme, android:name"
android:name="com.example.myapp.MyApplcation"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/application_name"
android:logo="#drawable/logo_ab"
android:theme="#style/AppTheme"
>
....
</application>
Yet I am receiving the error:
/android/MyApp/app/src/main/AndroidManifest.xml:29:9 Error:
Attribute application#icon value=(#drawable/ic_launcher) from AndroidManifest.xml:29:9
is also present at {Library Name} value=(#drawable/app_icon)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:26:5 to override
/android/MyApp/app/src/main/AndroidManifest.xml:30:9 Error:
Attribute application#label value=(#string/application_name) from AndroidManifest.xml:30:9
is also present at {Library Name} value=(#string/app_name)
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:26:5 to override
/android/MyApp/app/src/main/AndroidManifest.xml:27:9 Error:
Attribute application#name value=(com.example.myapp.MyApplication) from AndroidManifest.xml:27:9
is also present at {Another Library}
Suggestion: add 'tools:replace="android:name"' to <application> element at AndroidManifest.xml:26:5 to override
/android/MyApp/app/src/main/AndroidManifest.xml:32:9 Error:
Attribute application#theme value=(#style/AppTheme) from AndroidManifest.xml:32:9
is also present at {Library Name} value=(#style/AppTheme)
Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:26:5 to override
Declare your manifest header like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourpackage"
xmlns:tools="http://schemas.android.com/tools">
Then you can add to your application tag the following attribute:
<application
tools:replace="icon, label" ../>
For example I need to replace icon and label.
I fixed same issue. Solution for me:
add the xmlns:tools="http://schemas.android.com/tools" line in the manifest tag
add tools:replace=.. in the manifest tag
move android:label=... in the manifest tag
Example:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:replace="allowBackup, label"
android:allowBackup="false"
android:label="#string/all_app_name"/>
Try reordering your dependencies in your gradle file. I had to move the offending library from the bottom of the list to the top, and then it worked.
I just experienced the same behavior of tools:replace=... as described by the OP.
It turned out that the root cause for tools:replace being ignored by the manifest merger is a bug described here. It basically means that if you have a library in your project that contains a manifest with an <application ...> node containing a tools:ignore=... attribute, it can happen that the tools:replace=... attribute in the manifest of your main module will be ignored.
The tricky point here is that it can happen, but does not have to. In my case I had two libraries, library A with the tools:ignore=... attribute, library B with the attributes to be replaced in the respective manifests and the tools:replace=... attribute in the manifest of the main module. If the manifest of B was merged into the main manifest before the manifest of A everything worked as expected. In opposite merge order the error appeared.
The order in which these merges happen seems to be somewhat random. In my case changing the order in the dependencies section of build.gradle had no effect but changing the name of the flavor did it.
So, the only reliable workaround seems to be to unpack the problem causing library, remove the tools:ignore=... tag (which should be no problem as it is a hint for lint only) and pack the library again.
And vote for the bug to be fixed, of cause.
Final Working Solution for me (Highlighted the tages in the sample code):
add the xmlns:tools line in the manifest tag
add tools:replace in the application tag
Example:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pagination.yoga.com.tamiltv"
**xmlns:tools="http://schemas.android.com/tools"**
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
**tools:replace="android:icon,android:theme"**
>
The missing piece for me was this:
xmlns:tools="http://schemas.android.com/tools"
for example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.your.appid">
You can replace those in your Manifest application tag:
<application
tools:replace="android:icon, android:label, android:theme, android:name,android:allowBackup"
android:allowBackup="false"...>
and will work for you.
The following hack works:
add the xmlns:tools="http://schemas.android.com/tools" line in the
manifest tag
add
tools:replace="android:icon,android:theme,android:allowBackup,label"
in the application tag
tools:replace="android:supportsRtl,android:allowBackup,icon,label">
FIXED IT
HAD THE EXACT ERROR, Just add this tools:replace="android:icon,android:theme"
into your application tag in your manifest,
it works just fine,
You can replace those in your Manifest application tag:
<application
...
tools:replace="android:label, android:icon, android:theme"/>
and will work for you.
Explanation
Using such a dependency/library in your gradle file which has those labels in its Manifest's application tag may produce this problem and replacing them in your Manifest is the solution.
My problem is multi modules project with base module, app module and feature module.
Each module has AndroidManifest of its own, and I implemented build variant for debug and main.
So we must sure that "android:name" just declared in Manifest of debug and main only, and do not set it in any of Manifest in child module.
Ex:
Manifest in main:
<application
android:name=".App"/>
Manifest in debug:
<application
tools:replace="android:name"
android:name=".DebugApp"
/>
Do not set "android:name" in other Manifest files like this:
<application android:name=".App">
Just define in feature module like this and it will merged fine
<application>
I also went through this problem and changed that:
<application android:debuggable="true" android:icon="#drawable/app_icon" android:label="#string/app_name" android:supportsRtl="true" android:allowBackup="false" android:fullBackupOnly="false" android:theme="#style/UnityThemeSelector">
to
<application tools:replace="android:allowBackup" android:debuggable="true" android:icon="#drawable/app_icon" android:label="#string/app_name" android:supportsRtl="true" android:allowBackup="false" android:fullBackupOnly="false" android:theme="#style/UnityThemeSelector">
I was receiving a similar error on a project I was importing:
Multiple entries with same key: android:icon=REPLACE and
tools:icon=REPLACE
Fixed after changing the below line within the application tag:
tools:replace="icon, label, theme"
to
tools:replace="android:icon, android:label, android:theme"
This is new androidManifest.xml for flutter
<application
android:label="Your app Name"
tools:replace="android:label"
android:name="io.flutter.app.FlutterApplication"
android:networkSecurityConfig="#xml/network_security_config"
android:usesCleartextTraffic="true"
android:icon="#mipmap/ic_launcher">
please make to add android:label in the first line in <application, 'cause if you are using this package flutter_app_name will throw an error if the not sorted like example Above
I wish to rename my android app and package name. I have successfully done the latter via refactoring, but I'm having trouble with the former.
I have renamed the Java project, and I've also edited strings.xml to reflect the new app_name. However, while the new app name is reflected in my main activity as well as in the app drawer/home screen, when I try to view the app on the device in application manager, the old app name is still displayed.
How do I update that?
It should be the temporary issue. If you uninstall and re-install the application I think it will be resolved. And when users update from the Play Store it should be updated as well.
The application name is received from the android:label value in the application tag in AndroidManifest.xml
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
You need to change Application Name into android:label attribute of <application> tag in manifest.xml file
<application
android:icon="#drawable/logo"
android:label="#string/app_name"
>...</application>
And also change the Package into manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="New Package Name"
android:versionCode="1"
android:versionName="1.0" >....</manifest>
And after this built your project again see here for more info:http://developer.android.com/guide/topics/manifest/application-element.html
I'm extending Application. In another test, where everything was in the same package, everything went well. Now, I do have multiple packages and the app crashes. I guess, I miss something about the path in the manifest?
<application
android:name=".MyInheritedApplication"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
Any hints appreciated!
Thanx, Marcus
Make sure that your package-attribute in the manifest-tag is set correctly.
Example
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo.android"
... >
</manifest
Every application has his own name-attribute that will use this package to build up its path.