Per*_*ric 5 android ionic-framework
我在使用 ionic cordova build android 时遇到问题。如何修复“任务':app:processReleaseResources'执行失败。> Android 资源链接失败authenticator.xml:2: AAPT: error: resource mipmap/icon (aka io.ionic.starter:mipmap/icon) not found. FAILURE : 构建失败,出现异常。
什么地方出了错:
任务 :app:processReleaseResources FAILED 任务“:app:processReleaseResources”执行失败。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) 未找到。
错误:链接文件资源失败。
经过几个小时的研究,终于找到了为我的 IONIC 5 项目修复它的正确方法。
步骤1。
icon.png在您的文件夹中创建一个名为 的图像文件resources。
第2步。
将此行添加到您的CONFIG.XML文件中的 tag 下<platform name="android">。
<resource-file src="resources/icon.png" target="app/src/main/res/mipmap/icon.png" />
Run Code Online (Sandbox Code Playgroud)
步骤 3.
然后,删除平台: ionic cordova platform rm android
添加平台: ionic cordova platform add android
准备科尔多瓦: ionic cordova prepare android
构建安卓: ionic cordova build android
我认为这会解决这个问题。谢谢。
小智 5
我知道这是一个老话题,但是如果有人遇到这个问题,我有一个解决方案,如果您使用 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"
}
}
]
}
}`
Run Code Online (Sandbox Code Playgroud)
你可以像这样改变它
`
{
"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"
}
}
]
}
}
}`
Run Code Online (Sandbox Code Playgroud)
它就像一个魅力
问候
| 归档时间: |
|
| 查看次数: |
3005 次 |
| 最近记录: |