[英]How to fix an issue while build android app in ionic?
I've got an issue while use ionic cordova build android .我在使用 ionic cordova build android 时遇到问题。 How to fix " Execution failed for task ':app:processReleaseResources'. > Android resource linking failed authenticator.xml:2: AAPT: error: resource mipmap/icon (aka io.ionic.starter:mipmap/icon) not found. FAILURE: Build failed with an exception.
如何修复“任务':app:processReleaseResources'执行失败。> Android 资源链接失败authenticator.xml:2: AAPT: error: resource mipmap/icon (aka io.ionic.starter:mipmap/icon) not found. FAILURE : 构建失败,出现异常。
What went wrong:什么地方出了错:
Task :app:processReleaseResources FAILED Execution failed for task ':app:processReleaseResources'.
任务 :app:processReleaseResources FAILED 任务“:app:processReleaseResources”执行失败。 Android resource linking failed C:\\ES.eWarrant\\eWarrant\\platforms\\android\\app\\src\\main\\res\\xml\\authenticator.xml:2: AAPT: error: resource mipmap/icon (aka io.ionic.starter:mipmap/icon) not found.
Android 资源链接失败 C:\\ES.eWarrant\\eWarrant\\platforms\\android\\app\\src\\main\\res\\xml\\authenticator.xml:2: AAPT: error: resource mipmap/icon (aka io.ionic.starter:mipmap /icon) 未找到。
error: failed linking file resources.错误:链接文件资源失败。
i know this is an old topic, but if someons has this problema, i have a solution, if you use the Background Geolocation plugin from ionic native, has an issue with authenticator.xml, this uses @mipmap/icon as the resource for tha icon in the background, the way that i solved it was changing the vaules in the file android.json inside platforms/android, if you search for this我知道这是一个老话题,但是如果有人遇到这个问题,我有一个解决方案,如果您使用 ionic native 的 Background Geolocation 插件,那么authenticator.xml 存在问题,这使用 @mipmap/icon 作为 tha 的资源背景中的图标,我解决它的方法是更改平台/android 内文件 android.json 中的值,如果您搜索此内容
`{
"res/xml/authenticator.xml": {
"parents": {
"/*": [
{
"xml": "<account-authenticator android:accountType=\"@string/mauron85_bgloc_account_type\" android:icon=\"@mipmap/icon\" android:label=\"@string/app_name\" android:smallIcon=\"@mipmap/icon\" xmlns:android=\"http://schemas.android.com/apk/res/android\" />",
"count": 1,
"mode": "overwrite",
"plugin": "cordova-plugin-mauron85-background-geolocation",
"oldAttrib": {
"android:accountType": "@string/mauron85_bgloc_account_type",
"android:icon": "@mipmap/icon",
"android:label": "@string/app_name",
"android:smallIcon": "@mipmap/icon",
"xmlns:android": "http://schemas.android.com/apk/res/android"
}
}
]
}
}`
you can change it like this你可以像这样改变它
`
{
"res/xml/authenticator.xml": {
"parents": {
"/*": [
{
"xml": "<account-authenticator android:accountType=\"@string/mauron85_bgloc_account_type\" android:icon=\"@mipmap/ic_launcher\" android:label=\"@string/app_name\" android:smallIcon=\"@mipmap/ic_launcher\" xmlns:android=\"http://schemas.android.com/apk/res/android\" />",
"count": 1,
"mode": "overwrite",
"plugin": "cordova-plugin-mauron85-background-geolocation",
"oldAttrib": {
"android:accountType": "@string/mauron85_bgloc_account_type",
"android:icon": "@mipmap/ic_launcher",
"android:label": "@string/app_name",
"android:smallIcon": "@mipmap/ic_launcher",
"xmlns:android": "http://schemas.android.com/apk/res/android"
}
}
]
}
}
}`
and it works like a charm它就像一个魅力
Regards问候
After spending hours and hours on this, finally found the proper way to fix it for my IONIC 5 project.在为此花费了数小时和数小时后,终于找到了为我的 IONIC 5 项目修复它的正确方法。
Step 1.第1步。
Create a image file named icon.png
, inside your resources
folder.在您的
resources
文件夹中创建一个名为icon.png
的图像文件。
Step 2.第2步。
Add this line to your CONFIG.XML
file, under <platform name="android">
tag.将此行添加到您的
CONFIG.XML
文件中,在<platform name="android">
标记下。
<resource-file src="resources/icon.png" target="app/src/main/res/mipmap/icon.png" />
Step 3.第 3 步。
Then, remove platform : ionic cordova platform rm android
然后,删除平台:
ionic cordova platform rm android
add platform : ionic cordova platform add android
添加平台:
ionic cordova platform add android
prepare cordova : ionic cordova prepare android
准备科尔多瓦:
ionic cordova prepare android
build android : ionic cordova build android
构建 android :
ionic cordova build android
I think this will solve this issue.我认为这将解决这个问题。 Thanks.
谢谢。
The solution:解决方案:
Just as a correction> Create a directory: platforms\\android\\app\\src\\main\\res\\mipmap
.作为更正> 创建一个目录:
platforms\\android\\app\\src\\main\\res\\mipmap
。
Then copy resources\\splash.png
to icon.png
in the new mipmap directory.然后将
resources\\splash.png
复制到新 mipmap 目录中的icon.png
中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.