Cordova-plugin-background-geolocation: Mipmap/icon not found

Created on 27 Apr 2019  路  10Comments  路  Source: mauron85/cordova-plugin-background-geolocation

Environment:

  • Plugin version: "3.0.0-alpha.50",
  • Platform: Android (Ionic 4)
  • OS version: 8.0+
  • Device manufacturer and model: any
  • Running in Simulator: No
  • Cordova version (cordova -v): 9.0.0 ([email protected])
  • Cordova platform version (cordova platform ls): android 8.0.0
  • Plugin configuration options: default
  • Link to your project: private

Context:

I get failure when I try to release the apk for publishing, I get the following error:

Expected Behavior

Compile without errors in cordova 9.0

Actual Behavior

I get failure for mipmap/icon not found.

Possible Fix

It's happening because on latest cordova versions the icon isn't compiled anymore for mipmap/icon.png but for mipmap/ic_launcher.png.

Steps to Reproduce

  1. Create an application using Ionic 4 (latest)
  2. Add this plugin to the application
  3. Run: ionic cordova build android --release

Debug logs

`

Task :app:processReleaseResources FAILED
23 actionable tasks: 1 executed, 22 up-to-date
Android resource linking failed
C:\Projetos\utrack-app\platforms\android\appsrc\main\res\xml\authenticator.xml:2: AAPT: error: resource mipmap/icon (aka br.com.grupounicad.utrackv2:mipmap/icon) not found.

error: failed linking file resources.`

Most helpful comment

@n0minal Hi, I reopen this issue because your fix is just insanely time consuming.

For the app to work you need to change what is causing the problem (aka the mimap ressource)

So as you wrote it :

--variable ICON="@mipmap/ic_launcher" \
--variable SMALL_ICON="@mipmap/ic_launcher"
  1. The file to change is in : projectRoot/platforms/android/android.json

  2. Here find the line "res/xml/authenticator.xml"

  3. now change the @mipmap/icon for @mipmap/ic_launcher there (needs 2 modifications only in the xml object line)

change :

"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\" />",

to :

"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\" />",

It should work, also this should be fixed in the plugin directly.

All 10 comments

It is same with me. Did you find any solution?

Yes, you have to remove the plugin from cordova and then add it again using the variables to set it manually.

Remove your platforms (e.g: android):
ionic cordova platform rm android

Remove the plugin manually:
ionic cordova plugin rm cordova-plugin-mauron85-background-geolocation

Reinstall the plugin using it's variables

ionic cordova plugin add cordova-plugin-mauron85-background-geolocation@alpha \
--variable GOOGLE_PLAY_SERVICES_VERSION=11+ \
--variable ANDROID_SUPPORT_LIBRARY_VERSION=26+ \
--variable ALWAYS_USAGE_DESCRIPTION="App requires access to your location" \
--variable MOTION_USAGE_DESCRIPTION="App requires access to motion detection" \
--variable ICON="@mipmap/ic_launcher" \
--variable SMALL_ICON="@mipmap/ic_launcher"

And then add your platform again:
ionic cordova platform add android

ionic cordova prepare android

ionic cordova run android

I'm having too many issues related to this plugin unfortunately, I hope the author can make it work without problems for Ionic 4.

I'm getting the same problem.

@Makepool just use the command as I said above and it will be fixed.

I'm closing this issue, anyone who wants to fix the problem with ionic 4 just read my comment above.

@n0minal Hi, I reopen this issue because your fix is just insanely time consuming.

For the app to work you need to change what is causing the problem (aka the mimap ressource)

So as you wrote it :

--variable ICON="@mipmap/ic_launcher" \
--variable SMALL_ICON="@mipmap/ic_launcher"
  1. The file to change is in : projectRoot/platforms/android/android.json

  2. Here find the line "res/xml/authenticator.xml"

  3. now change the @mipmap/icon for @mipmap/ic_launcher there (needs 2 modifications only in the xml object line)

change :

"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\" />",

to :

"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\" />",

It should work, also this should be fixed in the plugin directly.

@mightytyphoon thanks a lot

@Divyanshu30 my plugin version: "3.0.3" 锛孖t doesn't work for me. Can you write in more detail?

@mightytyphoon this worked for me as well! Thank you 馃檹馃徏

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adrieldubemarante picture adrieldubemarante  路  4Comments

netbitsolutions picture netbitsolutions  路  10Comments

shyamal890 picture shyamal890  路  10Comments

Ritzlgrmft picture Ritzlgrmft  路  6Comments

sasiadstar picture sasiadstar  路  4Comments