Cordova-plugin-background-geolocation: Build Issue

Created on 16 Oct 2018  路  6Comments  路  Source: mauron85/cordova-plugin-background-geolocation

Your Environment


  • Plugin version: current
  • Platform: Android
  • OS version: N/A
  • Device manufacturer and model: N/A
  • Cordova version (cordova -v):
  • Cordova platform version (cordova platform ls): 6.3.0
  • Plugin configuration options:
  • Link to your project:

Context


I want to build my app with this plugin via phonegap, it is OK if I register plugin by adding following line into my config.xml:
<plugin name="cordova-plugin-mauron85-background-geolocation"/>

However, because I have to use another plugin and I follow the instruction you mentioned to set specific google play version and android support library version by the line below, it failed as the log post below.

<plugin name="cordova-plugin-mauron85-background-geolocation"> <variable name="GOOGLE_PLAY_SERVICES_VERSION" value="11+" /> <variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="23+" /> <variable name="ALWAYS_USAGE_DESCRIPTION" value="App requires background tracking enabled" /> <variable name="MOTION_USAGE_DESCRIPTION" value="App requires motion detection" /> </plugin>

the plugin I am trying to use with yours is cordova-plugin-camera-preview

Expected Behavior

Actual Behavior

Possible Fix

Steps to Reproduce



1.
2.
3.
4.

Context


Yes, app can't be built

Debug logs

BUILD FAILED

Total time: 2.77 secs
Error: /gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/src/com/marianhello/bgloc/sync/SyncAdapter.java:149: error: constructor Builder in class Builder cannot be applied to given types;
builder = new NotificationCompat.Builder(getContext(), NotificationHelper.SYNC_CHANNEL_ID);
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
/src/com/marianhello/bgloc/sync/SyncAdapter.java:214: error: constructor Builder in class Builder cannot be applied to given types;
NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext(), NotificationHelper.SYNC_CHANNEL_ID);
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
/src/com/marianhello/bgloc/NotificationHelper.java:51: error: constructor Builder in class Builder cannot be applied to given types;
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext, NotificationHelper.SERVICE_CHANNEL_ID);
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
stale

Most helpful comment

ANDROID_SUPPORT_LIBRARY_VERSION 23 seems not to be compatible (it's too old). But I think you can workaround this issue by replacing lines in plugin.xml

<source-file src="android/common/src/oreo/java/com/marianhello/bgloc/NotificationHelper.java" target-dir="src/com/marianhello/bgloc" />
<source-file src="android/common/src/oreo/java/com/marianhello/bgloc/sync/SyncAdapter.java" target-dir="src/com/marianhello/bgloc/sync" />

with

<source-file src="android/common/src/preoreo/java/com/marianhello/bgloc/NotificationHelper.java" target-dir="src/com/marianhello/bgloc" />
<source-file src="android/common/src/preoreo/java/com/marianhello/bgloc/sync/SyncAdapter.java" target-dir="src/com/marianhello/bgloc/sync" />

All 6 comments

ANDROID_SUPPORT_LIBRARY_VERSION 23 seems not to be compatible (it's too old). But I think you can workaround this issue by replacing lines in plugin.xml

<source-file src="android/common/src/oreo/java/com/marianhello/bgloc/NotificationHelper.java" target-dir="src/com/marianhello/bgloc" />
<source-file src="android/common/src/oreo/java/com/marianhello/bgloc/sync/SyncAdapter.java" target-dir="src/com/marianhello/bgloc/sync" />

with

<source-file src="android/common/src/preoreo/java/com/marianhello/bgloc/NotificationHelper.java" target-dir="src/com/marianhello/bgloc" />
<source-file src="android/common/src/preoreo/java/com/marianhello/bgloc/sync/SyncAdapter.java" target-dir="src/com/marianhello/bgloc/sync" />

I was struggling with it yesterday...
Setting ANDROID_SUPPORT_LIBRARY_VERSION to 26+ (and cleaning the project) solved the issue for me. BTW I'm using meteor.

If you can use ANDROID_SUPPORT_LIBRARY_VERSION to 26+ of course you don't need the workaround mentioned above.

ANDROID_SUPPORT_LIBRARY_VERSION 23 seems not to be compatible (it's too old). But I think you can workaround this issue by replacing lines in plugin.xml

<source-file src="android/common/src/oreo/java/com/marianhello/bgloc/NotificationHelper.java" target-dir="src/com/marianhello/bgloc" />
<source-file src="android/common/src/oreo/java/com/marianhello/bgloc/sync/SyncAdapter.java" target-dir="src/com/marianhello/bgloc/sync" />

with

<source-file src="android/common/src/preoreo/java/com/marianhello/bgloc/NotificationHelper.java" target-dir="src/com/marianhello/bgloc" />
<source-file src="android/common/src/preoreo/java/com/marianhello/bgloc/sync/SyncAdapter.java" target-dir="src/com/marianhello/bgloc/sync" />

I can't find the those two lines that you were referring to. I am using 2.3.6. Am I missing something? I'm having a similar issue where I got an build time error. Thanks

BUILD FAILED in 3s
/Users/symbp/My Files/code/ionic/cabbus_partner_v2.1/platforms/android/gradlew: Command failed with exit code 1 Error output:
/Users/symbp/My Files/code/ionic/cabbus_partner_v2.1/platforms/android/app/src/main/java/com/marianhello/bgloc/ActivityRecognitionLocationProvider.java:68: error: cannot access zzbfm
        if (lastActivity.getType() == DetectedActivity.STILL) {
                        ^
  class file for com.google.android.gms.internal.zzbfm not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vlafranca picture vlafranca  路  6Comments

n0minal picture n0minal  路  10Comments

netbitsolutions picture netbitsolutions  路  10Comments

ThorvaldAagaard picture ThorvaldAagaard  路  9Comments

maurojones picture maurojones  路  3Comments