How To Fix Resource Error from Android Manifest - android

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>

Related

Default activity not found error when following Android Studio beginner guide

Im trying to add upward navigation while following the beginners tutorial to android studio here. However, when I try to run it, it gives me the error:
Error running 'app':
Default Activity not found
The code in my AndroidManifest.xml file is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".DisplayMessageActivity"
android:parentActivityName=".MainActivity">
<!-- The meta-data tag is required if you support API level 15 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
</application>
</manifest>
There could be a number of things going on here. I would first suggest that you check all naming references to the layout and the code behind with a discerning eye. Sometimes with editing, you can inadvertently change and rename a file by adding or deleting letter in the name. Also, from time to time, when working with a IDE, a state of modification can go stale in which you can sometimes do a clean/build or a restart of the IDE. Pending updates to the IDE may be a culprit as well.
As a best practice, you should version your code. This will help alleviate most issues such as this. Check out the following link to Android's recommendations on this practice.
https://developer.android.com/studio/publish/versioning

Facing error during Merging manifest file in android studio

I added PAYTM SDK in my project and now I am facing a problem with merging manifest file since the library has its own manifest file.
So I am getting
> Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#icon value=(#mipmap/logo) from AndroidManifest.xml:19:9-42
is also present at [com.paytm.pgsdk:pgsdk:1.0.6] AndroidManifest.xml:12:9-45 value=(#drawable/ic_launcher).
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:16:5-178:19 to override.
But after adding tools:replace="android:icon" in my application tag, my app has crashed at runtime by the following exception.
Caused by: java.lang.IllegalStateException: You need to use a
Theme.AppCompat theme (or descendant) with this activity.
Here is my manifest file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.demo">
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
tools:replace="android:icon"
android:icon="#mipmap/login_logo"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
.
.
.
</application>
Just remove icon="#mipmap/login_logo" and theme="#style/AppTheme" from your Application Manifest and replace drawable ic_launcher in PayTM SDK with your app logo and that would do it.
Application will merge both manifests and you will get your desired theme and logo will be fetched from PayTM's manifest hence you would have replaced their ic_launcher with yours.
Finally, I have solved that theme issue by removing conflicting AppTheme's style from SDK.

No resource identifier found for attribute 'fullBackupContent' in package 'android'

part of my AndroidManifest.xml
<application
android:allowBackup="true"
android:fullBackupContent="false"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppThemeCompat"
android:largeHeap="true" >
I'm newbie in android developer, i use eclipse mars with sdk 25.1.3 and i get this error. they are no '/xml' folder under 'res/' in my project.
what should i do to fix this issue?
sorry for my english.
Does your manifest tag look like this?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.my.appexample">
I never used "fullBackupContent" but every attribute needs to be declared with the xmlns to use it.
Also, if you say you are new to android development. Why do you need "fullBackupContent" and "largeHeap"? Did you copy that from somewhere or is it on purpose?

android manifest merger cannot merge three manifest files

i have 2 versions of AndroidManifest.xml files in my project, one is the main and another for debug.
in both of them i have android:label and in the debug version i have tools:replace="label"
after adding a library through gradle i suddenly see:
Error:Execution failed for task ':app:processMobileDebugManifest'.
Manifest merger failed : Attribute application#label value=(XXXX Debug) from AndroidManifest.xml:36:13-45
is also present at [library_name] AndroidManifest.xml:13:9-41 value=(#string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:7:5-20:19 to override.
it already exists there! what am i doing wrong?
Edit1:
main xml:
<application
android:name="[package_name]"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
debug xml:
<application
tools:replace="name, label"
android:name="[package_name]"
android:label="[debug_name]">
third party library xml:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
I found out that the label should have the same value like all others.
Meaning that tools:replace works only if all labels looks like this:
android:label="#string/app_name"
In my case it didn't work because in the debug manifest it looked like this:
android:label="debug name"
But once i changed it to android:label="#string/app_name" and added string in the debug/values dir it started working correctly.
Seems like a bug in Android Studio.

Modfiying Android Manifest

So I have been following a tutorial titled 31 days of Android. I am having an issue with one of the tutorials. It calls for me to modify the androidmanifest.xml file but when I do but it doesn't work. Everytime I run the application it crushes after I press button 2. Here is the code they wanted me to add
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:name="MyApplication">
and here is the code looks after I have added that code to my file.
<application android:icon="#drawable/icon" android:label="#string/app_name" android:name="MyApplication">
I did not add the android:icon="#drawable/ic_launcher" because it gave me an error which read "no resoucre found that matches the given name". Any help would be appreciated.
The error is because there is no icon in your project,
Look in Project/res/drawable/ ...
The ic_launcher is the default icon, so just replace
android:icon="#drawable/icon"
By :
android:icon="#drawable/ic_launcher"

Categories

Resources