cordova-plugin-background-geolocation: 2.2.5 build fails Android on Phonegap Build

Version 2.2.2 works for Android. 2.2.5 works for iOS

Environment

  • Phonegap Build CLI 6.3.0
  • Plugin version: 2.2.5
  • Platform: Android
  • OS version: 4+
  • Cordova version (cordova -v): 6.3.0
  • Cordova platform version (cordova platform ls): android 5.2.1
  • Plugin configuration options: desiredAccuracy: 10, stationaryRadius: 20, distanceFilter: 30, maxLocations: 1000, // Android only section locationProvider: backgroundGeolocation.provider.ANDROID_ACTIVITY_PROVIDER, interval: 60000, activitiesInterval: 10000, notificationTitle: ‘Background tracking’, notificationText: ‘enabled’, notificationIconColor: ‘#FEDD1E’, notificationIconLarge: ‘mappointer_large’, notificationIconSmall: ‘mappointer_small’, startForeground: true
  • Link to project: https://github.com/klaus-donnert/iDispatcher-Gps-Tracker.git

Expected Behavior

Build without error

Actual Behavior

Build failed:

Possible Fix

Steps to Reproduce

  1. fork https://github.com/klaus-donnert/iDispatcher-Gps-Tracker.git
  2. checkout branch 2.2.5 GPS Plugin test
  3. build for Android using Phonegap build CLI 6.3.0

Debug logs

Execution failed for task ‘:processDebugResources’.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/android-sdk/build-tools/24.0.1/aapt’’ finished with non-zero exit value 1

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 27 (10 by maintainers)

Most upvoted comments

This plugin has ic_launcher.png images in its resources inside its mipmap folders (in cordova-plugin-background-geolocation/android/plugin/src/main/res/

those are there probably by mistake. I should remove those.

because your cordova project retrieved the images from another source

no, I was testing on freshly created project

Anyway, I would recommend changing the image file names from ic_launcher.png to icon.png

actually I’ll remove those ic_launcher.pngs and plugin will assume that cordova create will create icon.png in mipmap folders.

EDIT:

and also adding a note in the documentation to tell people that if they generate their own mipmap images they make sure they name them icon to avoid cordova build problems.

there is already section in documentation

Please note that as of Cordova Android 6.0.0 icons are by default in mipmap/ directory not drawable/ directory, so this plugin will have a build issue on < 6.0.0 Cordova builds, you will need to update Authenticator.xml to drawable directory from mipmap directory to work on older versions.

, but I agree that it can be probably more exhaustive to cover this situation

I think I’m having a similar issue when building for android. In my case I’m building with cordova (cordova build android).

Environment

Plugin version: 2.2.5 Cordova version: 6.4.0

Debug log

my_project_route/platforms/android/res/xml/authenticator.xml:5:19-31: AAPT: No resource found that matches the given name (at 'icon' with value '@mipmap/icon').

my_project_route/platforms/android/res/xml/authenticator.xml:6:24-36: AAPT: No resource found that matches the given name (at 'smallIcon' with value '@mipmap/icon').

Possible solution

I think the issue comes from a mismatch between what is specified in the authenticator.xml file and the content of the mipmap folders. Those folders contain files named ic_launcher.png, but the authenticator.xml file contains the following two lines:

android:icon="@mipmap/icon"
android:smallIcon="@mipmap/icon"

I tried changing those lines for the following:

android:icon="@mipmap/ic_launcher"
android:smallIcon="@mipmap/ic_launcher"

Doing that the build worked. I guess changing the image file names from ic_launcher.png to icon.png would work too.

Could you also try 2.2.4? It’s basically same as 2.2.5, but 2.2.5 was adjusted to work with new cordova android 6.0.