简体   繁体   中英

How to fix an issue while build android app in ionic?

I've got an issue while use 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.

  • What went wrong:

    Task :app:processReleaseResources FAILED Execution failed for task ':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.

    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

`{
"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.

Step 1.

Create a image file named icon.png , inside your resources folder.

Step 2.

Add this line to your CONFIG.XML file, under <platform name="android"> tag.

<resource-file src="resources/icon.png" target="app/src/main/res/mipmap/icon.png" />

Step 3.

Then, remove platform : ionic cordova platform rm android

add platform : ionic cordova platform add android

prepare cordova : ionic cordova prepare android

build 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 .

Then copy resources\\splash.png to icon.png in the new mipmap directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM