cordova-plugin-background-geolocation: error: failed linking file resources ...platforms\android\app\src\main\res\xml\authenticator.xml:2: AAPT: error: resource mipmap/icon (aka xxx.xxx:mipmap/icon) not found.
Your Environment
- Plugin version: 3.0.0-alpha.50
- Platform: Android
- OS version: Android 9
- Device manufacturer and model: OnePlus A3000 (oneplus 3t)
- Running in Simulator:
- Cordova version (
cordova -v
): 8.1.2 (cordova-lib@8.1.1) - Cordova platform version (
cordova platform ls
): android 8.0.0 - Plugin configuration options:
- Link to your project:
Context
- What went wrong: Execution failed for task ‘:app:processDebugResources’.
Android resource linking failed …platforms\android\app\src\main\res\xml\authenticator.xml:2: AAPT: error: resource mipmap/icon (aka xx.xxx:mipmap/icon) not found.
error: failed linking file resources.
Expected Behavior
BUILD SUCCESS
Actual Behavior
BUILD FAILED
Possible Fix
Steps to Reproduce
- cordova create …
- cordova plugin add cordova-plugin-background-geolocation
- cordova platform add android@latest
- cordova run
Context
BUILD FAILING
Debug logs
This is line 2 of the file authenticator.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”
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 37
Commits related to this issue
- Fixes to https://github.com/mauron85/cordova-plugin-background-geolocation/issues/553 — committed to dilawar/HippoApp by deleted user 5 years ago
Just add below line to config.xml (inside
<platform name="android">
tag) This will reuse the pre-generated icon.<resource-file src="resources/android/icon/drawable-xxxhdpi-icon.png" target="app/src/main/res/mipmap/icon.png" />
On newer API versions, you need to set SMALL_ICON and ICON to
@mipmap/ic_launcher
in both package.json and config.xml After that I had to recreate the android platform for it to “take”.cordova platform remove android && cordova platform add android
.Agree, actually I added the following to my config.xml:
<resource-file src="assets/ic_launcher.png" target="app/src/main/res/mipmap/icon.png" />
crie pasta “mipmap” platforms\android\app\src\main\res\mipmap coloque seu icon na pasta “icon.png” pronto resolvido
create folder “mipmap” platforms\android\app\src\main\res\mipmap place your icon in the “icon.png” folder ready resolved
Actually for me to work I had to modify it to
<resource-file src="SRC/assets/ic_launcher.png" target="app/src/main/res/mipmap/icon.png" />
and to manually copy a ‘ic_launcher.png’ resource from the path: platforms/android/app/src/main/res/mipmap-xxhdpi’ to the folder: src/assets
Reusing the “main” icon here
This declaration :
Works for me with :
I don’t have the
ALWAYS_USAGE_DESCRIPTION
andMOTION_USAGE_DESCRIPTION
keys because I handle iOS permission messages differently but you should include them too.Thanks, after two days I have managed to solve it with this.
this issue happens on cordova andoird 8 Downgrade your cordova android to 7. On my machine, it’s fixed.
cordova platform remove android cordova platform add android@^7
in which line you adete?
I think the solution lies just in a correct declaration in config.xml:
This is not a good practice, you should not edit manually the content of
platform
folders since they can be recreated at some point (for exemple in a CI environnment).Switching from
@mipmap/icon
to@mipmap/ic_launcher
in yourpackage.json
andconfig.xml
should be solution with the 3.0.0 release (don’t forget to reinstall platforms and plugins).In my case the @mipmap/icon problem was solved by following the instructions in this example: https://github.com/oliviercherrier/mauron85-background-geolocation-example-ionic2 See the text below ‘Mimap icon missing’.
I have the same issue too. Going to roll-back to cordova 7.1.1 until this is fixed.