question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.2.5 build fails Android on Phonegap Build

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:27 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mauron85commented, Nov 14, 2016

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

1reaction
JaimeFerBeccommented, Nov 14, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PhoneGap build fail - Android · Issue #240 - GitHub
This error is caused by a Gradle version mismatch. The exact cause depends on which other plugins and which version of the cordova-android...
Read more >
Error executing the build in the app (cordova build android ...
After these steps, everything worked fine and I was able to run $ cordova build android without problems. Suggestion: If any other errors...
Read more >
Error during building.apk with adobe PhoneGap
I get an error is called "Error - A plugin you are using requires a preference: ANDROID_SUPPORT_V4_VERSION".
Read more >
[Firebase Cloud Message Plugin] Failed building native ...
Requesting plugin "phonegap-plugin-multidex@~1.0.0". Plugin dependency "phonegap-plugin-multidex" not fetched, retrieving then installing. ... Finding scripts for ...
Read more >
Android Platform Guide - Apache Cordova
This guide will help set up your development environment for building Cordova apps for Android devices and optionally use Android-specific command-line ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found