Cordova-plugin-background-geolocation: Can't make build for android In Ionic

Created on 16 Mar 2018  路  25Comments  路  Source: mauron85/cordova-plugin-background-geolocation

Your Environment

  • Plugin version: 2.3.3
  • Platform: Android
  • OS version: 4.4.4 to 7.0.0
  • Device manufacturer and model: All devices
  • Cordova version (cordova -v): 8.0.0

Context


My issue is after adding this plugin to my Ionic project cannot make a build for the android device. So I created a new project and added this plugin to my project. Now I generated the build it shows the same exception but this time I did not add any code of this plugin.

Expected Behavior


Can able to make a build for android.

Actual Behavior


Cannot able to make a build for android.

Steps to Reproduce


  1. create a new Ionic project. start ionic
  2. Just add the plugin to the project using the below comment.
    $ ionic cordova plugin add cordova-plugin-mauron85-background-geolocation
    $ npm install --save @ionic-native/background-geolocation
  3. Now connect any android device. And run the following comment.
    ionic cordova run android --device
    4.Now you will get the exception.

Debug logs

/home/hmspl/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0-alpha1.aar/d22f6362e4ac053c8f6b4d99d0c72969/res/values/values.xml:20:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

/home/hmspl/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0-alpha1.aar/d22f6362e4ac053c8f6b4d99d0c72969/res/values/values.xml:20:5-70: AAPT: error: resource android:attr/ttcIndex not found.

/home/hmspl/TestProject2/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:94: error: resource android:attr/fontVariationSettings not found.
/home/hmspl/TestProject2/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:94: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
... 41 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logsfor details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:454)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:411)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugResources'.

    Failed to execute aapt

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

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s
at ChildProcess.whenDone (/home/hmspl/TestProject2/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at ChildProcess.emit (events.js:180:13)
at maybeClose (internal/child_process.js:936:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:10036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10036) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?

hmspl@BALA-LAPTOP:~/TestProject2$ ^C
hmspl@BALA-LAPTOP:~/TestProject2$ B^C
hmspl@BALA-LAPTOP:~/TestProject2$ ^C
hmspl@BALA-LAPTOP:~/TestProject2$ ionic cordova run android --device
Running app-scripts build: --platform android --target cordova
[10:43:29] build dev started ...
[10:43:29] clean started ...
[10:43:29] clean finished in 4 ms
[10:43:29] copy started ...
[10:43:29] deeplinks started ...
[10:43:29] deeplinks finished in 22 ms
[10:43:29] transpile started ...
[10:43:33] transpile finished in 3.13 s
[10:43:33] preprocess started ...
[10:43:33] preprocess finished in 1 ms
[10:43:33] webpack started ...
[10:43:33] copy finished in 3.28 s
[10:43:38] webpack finished in 5.85 s
[10:43:38] sass started ...
Without from option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to undefined to prevent this warning.
[10:43:39] sass finished in 1.13 s
[10:43:39] postprocess started ...
[10:43:39] postprocess finished in 6 ms
[10:43:39] lint started ...
[10:43:40] build dev finished in 10.23 s

cordova run android --device

You have been opted out of telemetry. To change this, run: cordova telemetry on.
Android Studio project detected

ANDROID_HOME=/home/hmspl/Android/Sdk
JAVA_HOME=/usr/lib/jvm/jdk1.8.0_161
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.

Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.

The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_cuzl6il90i7xxre4h67pe49rx.run(/home/hmspl/TestProject2/platforms/android/app/build.gradle:144)
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl
UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues
UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources
UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources
UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac
UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild
UP-TO-DATE
:app:compileDebugAidl
UP-TO-DATE
:CordovaLib:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources
/home/hmspl/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0-alpha1.aar/d22f6362e4ac053c8f6b4d99d0c72969/res/values/values.xml:20:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

/home/hmspl/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0-alpha1.aar/d22f6362e4ac053c8f6b4d99d0c72969/res/values/values.xml:20:5-70: AAPT: error: resource android:attr/ttcIndex not found.

/home/hmspl/TestProject2/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:94: error: resource android:attr/fontVariationSettings not found.
/home/hmspl/TestProject2/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:94: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt

com.android.ide.common.process.ProcessException: Failed to execute aapt

    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)

    at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)

    at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)

    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)

    at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:498)

    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)

    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)

    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)

    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)

    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)

    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)

    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)

    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)

    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)

    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)

    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)

    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)

    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)

    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)

    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)

    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)

    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:748)

Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
... 47 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logsfor details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
... 1 more
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:454)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:411)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugResources'.

    Failed to execute aapt

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

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s
FAILED
25 actionable tasks: 1 executed, 24 up-to-date
[10:43:43] lint finished in 3.76 s
(node:11008) UnhandledPromiseRejectionWarning: Error: /home/hmspl/TestProject2/platforms/android/gradlew: Command failed with exit code 1 Error output:
/home/hmspl/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0-alpha1.aar/d22f6362e4ac053c8f6b4d99d0c72969/res/values/values.xml:20:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

/home/hmspl/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0-alpha1.aar/d22f6362e4ac053c8f6b4d99d0c72969/res/values/values.xml:20:5-70: AAPT: error: resource android:attr/ttcIndex not found.

/home/hmspl/TestProject2/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:94: error: resource android:attr/fontVariationSettings not found.
/home/hmspl/TestProject2/platforms/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:94: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
... 47 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logsfor details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
... 1 more
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:454)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:411)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugResources'.

    Failed to execute aapt

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

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s
at ChildProcess.whenDone (/home/hmspl/TestProject2/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at ChildProcess.emit (events.js:180:13)
at maybeClose (internal/child_process.js:936:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:11008) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11008) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Most helpful comment

me too, simple to reproduce: ionic start (choose blank project and integrate with cordova),
then (as explained in the ionic docs):
ionic cordova plugin add cordova-plugin-mauron85-background-geolocation
npm install --save @ionic-native/background-geolocation
ionic cordova build android

All 25 comments

Documentation is very Poor for IONIC. For fixing this issue, I have changed many things and taken 2.5 days of time.
I did the following changes in my Project:

1) Change build tool version as 26.0.2 in /platforms/android/build.gradle

2) Change compile option as follows in : /platforms/android/app/build.gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}

Change dependencies as follows:

compile "com.android.support:support-v4:26.1.0"
compile "com.android.support:appcompat-v7:26.1.0"

3)Change the followings in /platforms/android/build.gradle/projects.properties:
cordova.system.library.1=com.android.support:support-v4:26.1.0
cordova.system.library.2=com.android.support:appcompat-v7:26.1.0

@balakrishnan4cse balakrishnan 4cse with your solution is possible build app, but when i try to use the plugin all is white, no render the view

I've the same problem, I got it when I run rm -rf plugins node_modules platforms && npm i && ionic cordova build android --prod --release

me too, simple to reproduce: ionic start (choose blank project and integrate with cordova),
then (as explained in the ionic docs):
ionic cordova plugin add cordova-plugin-mauron85-background-geolocation
npm install --save @ionic-native/background-geolocation
ionic cordova build android

mauron85, How do I use the background geolocation plugin on Ionic 3 and Java 8. I have already made several configurations, but not one of them worked properly.

Could you help me, please?

+1

I found a temporary solution:

  1. run the command:
    ionic cordova plugin add [email protected]
  2. edit the file config.xml:
<plugin` name="cordova-plugin-mauron85-background-geolocation" spec="^3.0.0-alpha.18>
<variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="27.1.0" />
</plugin>
  1. edit the file project.properties that you find in the folder platformsandroid:
cordova.system.library.1=com.google.android.gms:play-services-location:+
cordova.system.library.2=com.android.support:support-v4:27.1.0
  1. run the command:
    ionic cordova build android or ionic cordova run android --device

my project has the following configuration:

cli packages: (~/.nvm/versions/node/v8.10.0/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.6
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.0 
    ios-sim           : 5.0.10 
    Node              : v8.10.0
    npm               : 5.6.0 
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b 

Environment Variables:

    ANDROID_HOME : ~/Library/Android/sdk

Misc:

    backend : pro

I hope I was helpful

@giussa Sadly your solution does not work. This is caused by ionic-native that is not compatible with V3.

It fixes the build error so you are half right :)

I have the exact same problem and can't do anything too fix this. Hopefully there is a solution for this problem soon.

ionic info:

cli packages: (XX/XX/XX/node_modules)
    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:
    cordova (Cordova CLI) : 8.0.0

local packages:
    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:
    Node : v8.9.1
    npm  : 5.5.1
    OS   : macOS High Sierra

Environment Variables:
    ANDROID_HOME : ~/Library/Android/sdk

Misc:
    backend : pro

Try different versions of play service and support library in your config.xml. Eg:

<plugin name="cordova-plugin-mauron85-background-geolocation">
    <!-- may contain other variables as shown above -->
    <variable name="GOOGLE_PLAY_SERVICES_VERSION" value="11.0.1" />
    <variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="23+" />
</plugin>

EDIT: But you need to remove and reinstall plugin first. Or without reinstallation, just edit project.properties in folder platforms\android:

@mauron85 what version of your plugin do you suggest to use for these tests?

@mbakker96, what do you mean with "ionic-native that is not compatible with V3"? If you mean that there is no wrapper for ionic-native, try to edit the file index.js, which you find in <your project folder>\node_modules\@ionic-native\background-geolocation\ and replace the line pluginRef: 'backgroundGeolocation' with pluginRef: 'BackgroundGeolocation'.

I found the suggestion here: https://github.com/mauron85/cordova-plugin-background-geolocation/issues/377#issuecomment-373401083, obviously it's not the definitive solution, now I'm trying if it's viable.

@giussa just realised that you can't change ANDROID_SUPPORT_LIBRARY_VERSION in 2.3.3 (only in 3.x). This is unfortunate as ionic currently supports 2.x only. Maybe I'll prepare special 2.x release for you guys.

But editing project.properties in folder platforms\android and changing libraries version IMO should work. Anybody using ionic can confirm this?

@mauron85 I've tried but it's still not working for me.

It is working fine in my project. Here is the section in config.xml:

<plugin name="cordova-plugin-mauron85-background-geolocation" spec="^2.3.3">
        <variable name="ACCOUNT_TYPE" value="$PACKAGE_NAME.account" />
        <variable name="CONTENT_AUTHORITY" value="$PACKAGE_NAME" />
        <variable name="GOOGLE_PLAY_SERVICES_VERSION" value="9.0.0" />
    </plugin>

and inside the plugin.xml u should have:

<preference name="GOOGLE_PLAY_SERVICES_VERSION" default="9.0.0"/>

<framework src="com.google.android.gms:play-services-location:9.0.0"/>

<framework src="com.android.support:support-v4:24+"/>

It might be required to remove and reinstall the android platform. I am currently using v6.3.0..

However, it seems that with the new version, the geolocation stops updating after the phone is locked. Can you please assist us with this problem?

Thank you.

Just published version 2.3.4 with both android support library and play-services versions locked to compatible with cordova. Also you can now override both in your config.xml.

<plugin name="cordova-plugin-mauron85-background-geolocation">
    <!-- may contain other variables as shown above -->
    <variable name="GOOGLE_PLAY_SERVICES_VERSION" value="11.0.1" />
    <variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="23+" />
</plugin>

I've tried all solutions but it's still not working for me. @mauron85 Do you have any other ideas to fix this problem?

here are my steps to reproduce:

ionic start
npm install
ionic cordova plugin add cordova-plugin-mauron85-background-geolocation
npm install --save @ionic-native/background-geolocation
ionic cordova build android

ionic info:

cli packages: (XX/XX/XX/node_modules)
    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:
    cordova (Cordova CLI) : 8.0.0

local packages:
    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:
    Node : v8.9.1
    npm  : 5.5.1
    OS   : macOS High Sierra

Environment Variables:
    ANDROID_HOME : ~/Library/Android/sdk

Misc:
    backend : pro

Even for me the fix does not work, my workspace is so configured:

cli packages: (~/.nvm/versions/node/v8.10.0/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.6
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.0 
    ios-sim           : 5.0.10 
    Node              : v8.10.0
    npm               : 5.6.0 
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b 

Environment Variables:

    ANDROID_HOME : ~/Library/Android/sdk

Misc:

    backend : pro

To test the fix I performed the following operations:

  1. npm start 'project name'
  2. ionic cordova plugin add [email protected]
  3. I put the following lines in the config.xml:
    <plugin name="cordova-plugin-mauron85-background-geolocation" spec="^2.3.4">
      <variable name="GOOGLE_PLAY_SERVICES_VERSION" value="11.0.1" />
      <variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="23+" />
    </plugin>
  1. ionic cordova prepare android
  2. ionic cordova build android

The result is the following:

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.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
27 actionable tasks: 27 executed
(node:30900) UnhandledPromiseRejectionWarning: Error: ~/Documents/ionic/geo/platforms/android/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.
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:563: error: cannot find symbol
    @TargetApi(Build.VERSION_CODES.KITKAT)
                                  ^
  symbol:   variable KITKAT
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/org/apache/cordova/splashscreen/SplashScreen.java:297: error: cannot find symbol
                LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                                                                                      ^
  symbol:   variable MATCH_PARENT
  location: class LayoutParams
~/Documents/ionic/geo/platforms/android/app/src/main/java/org/apache/cordova/splashscreen/SplashScreen.java:297: error: cannot find symbol
                LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                                                                                                                 ^
  symbol:   variable MATCH_PARENT
  location: class LayoutParams
~/Documents/ionic/geo/platforms/android/app/src/main/java/org/apache/cordova/splashscreen/SplashScreen.java:371: error: cannot find symbol
                if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                                                                                      ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/org/apache/cordova/splashscreen/SplashScreen.java:388: error: cannot find symbol
                        progressBar.setIndeterminateTintList(colorStateList);
                                   ^
  symbol:   method setIndeterminateTintList(ColorStateList)
  location: variable progressBar of type ProgressBar
~/Documents/ionic/geo/platforms/android/app/src/main/java/org/apache/cordova/device/Device.java:132: error: cannot find symbol
        String serial = android.os.Build.SERIAL;
                                        ^
  symbol:   variable SERIAL
  location: class Build
~/Documents/ionic/geo/platforms/android/app/src/main/java/io/ionic/keyboard/IonicKeyboard.java:91: error: cannot find symbol
                                display.getSize(size);
                                       ^
  symbol:   method getSize(Point)
  location: variable display of type Display
~/Documents/ionic/geo/platforms/android/app/src/main/java/io/ionic/keyboard/IonicKeyboard.java:131: error: cannot find symbol
        rootView.getViewTreeObserver().removeOnGlobalLayoutListener(list);
                                      ^
  symbol:   method removeOnGlobalLayoutListener(OnGlobalLayoutListener)
  location: class ViewTreeObserver
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/HttpPostService.java:59: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                                                        ^
  symbol:   variable KITKAT
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/LocationService.java:189: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
                                                        ^
  symbol:   variable JELLY_BEAN_MR2
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/LocationService.java:190: error: cannot find symbol
            handlerThread.quitSafely();
                         ^
  symbol:   method quitSafely()
  location: variable handlerThread of type HandlerThread
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/LocationService.java:198: error: method does not override or implement a method from a supertype
    @Override
    ^
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/LocationService.java:207: error: cannot find symbol
        super.onTaskRemoved(rootIntent);
             ^
  symbol: method onTaskRemoved(Intent)
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/LocationService.java:421: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                                                        ^
  symbol:   variable HONEYCOMB
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/LocationService.java:422: error: cannot find symbol
            task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, location);
                                            ^
  symbol:   variable THREAD_POOL_EXECUTOR
  location: class AsyncTask
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java:55: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                                                        ^
  symbol:   variable JELLY_BEAN_MR1
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java:56: error: cannot find symbol
            elapsedRealtimeNanos = location.getElapsedRealtimeNanos();
                                           ^
  symbol:   method getElapsedRealtimeNanos()
  location: variable location of type Location
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java:58: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
                                                        ^
  symbol:   variable JELLY_BEAN_MR2
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java:59: error: cannot find symbol
            isFromMockProvider = location.isFromMockProvider();
                                         ^
  symbol:   method isFromMockProvider()
  location: variable location of type Location
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java:567: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                                                        ^
  symbol:   variable JELLY_BEAN_MR1
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java:568: error: cannot find symbol
            l.setElapsedRealtimeNanos(elapsedRealtimeNanos);
             ^
  symbol:   method setElapsedRealtimeNanos(long)
  location: variable l of type Location
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java:592: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                                                        ^
  symbol:   variable JELLY_BEAN_MR1
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/sync/SyncService.java:60: error: cannot find symbol

settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, false);
                                                 ^
  symbol:   variable SYNC_EXTRAS_DO_NOT_RETRY
  location: class ContentResolver
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java:71: error: constructor AbstractThreadedSyncAdapter in class AbstractThreadedSyncAdapter cannot be applied to given types;
        super(context, autoInitialize, allowParallelSyncs);
        ^
  required: Context,boolean
  found: Context,boolean,boolean
  reason: actual and formal argument lists differ in length
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/sync/BatchManager.java:70: error: cannot find symbol
            db.beginTransactionNonExclusive();
              ^
  symbol:   method beginTransactionNonExclusive()
  location: variable db of type SQLiteDatabase
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationDAO.java:113: error: method queryNumEntries in class DatabaseUtils cannot be applied to given types;
    return DatabaseUtils.queryNumEntries(db, LocationEntry.TABLE_NAME, whereClause, whereArgs);
                        ^
  required: SQLiteDatabase,String
  found: SQLiteDatabase,String,String,String[]
  reason: actual and formal argument lists differ in length
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteLocationDAO.java:154: error: cannot find symbol
    db.beginTransactionNonExclusive();
      ^
  symbol:   method beginTransactionNonExclusive()
  location: variable db of type SQLiteDatabase
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteOpenHelper.java:118: error: cannot find symbol
        Log.d(TAG, "Creating db: " + this.getDatabaseName());
                                         ^
  symbol: method getDatabaseName()
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/data/sqlite/SQLiteOpenHelper.java:172: error: method does not override or implement a method from a supertype
    @Override
    ^
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:535: error: cannot find symbol
            activity.bindService(locationServiceIntent, mConnection, Context.BIND_IMPORTANT);
                                                                            ^
  symbol:   variable BIND_IMPORTANT
  location: class Context
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:569: error: cannot find symbol
        return getContext().registerReceiver(locationModeChangeReceiver, new IntentFilter(LocationManager.MODE_CHANGED_ACTION));
                                                                                                         ^
  symbol:   variable MODE_CHANGED_ACTION
  location: class LocationManager
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:585: error: cannot find symbol
        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                                           ^
  symbol:   variable ACTION_APPLICATION_DETAILS_SETTINGS
  location: class Settings
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:598: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                                                        ^
  symbol:   variable KITKAT
  location: class VERSION_CODES
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:599: error: cannot find symbol
            locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE);
                                                                                               ^
  symbol:   variable LOCATION_MODE
  location: class Secure
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:600: error: cannot find symbol
            return locationMode != Settings.Secure.LOCATION_MODE_OFF;
                                                  ^
  symbol:   variable LOCATION_MODE_OFF
  location: class Secure
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:148: error: cannot find symbol
            criteria.setHorizontalAccuracy(translateDesiredAccuracy(config.getDesiredAccuracy()));
                    ^
  symbol:   method setHorizontalAccuracy(Integer)
  location: variable criteria of type Criteria
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:166: error: cannot find symbol
                    if (provider != LocationManager.PASSIVE_PROVIDER) {
                                                   ^
  symbol:   variable PASSIVE_PROVIDER
  location: class LocationManager
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:187: error: cannot find symbol
                accuracy = Criteria.ACCURACY_LOW;
                                   ^
  symbol:   variable ACCURACY_LOW
  location: class Criteria
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:190: error: cannot find symbol
                accuracy = Criteria.ACCURACY_MEDIUM;
                                   ^
  symbol:   variable ACCURACY_MEDIUM
  location: class Criteria
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:193: error: cannot find symbol
                accuracy = Criteria.ACCURACY_HIGH;
                                   ^
  symbol:   variable ACCURACY_HIGH
  location: class Criteria
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:196: error: cannot find symbol
                accuracy = Criteria.ACCURACY_HIGH;
                                   ^
  symbol:   variable ACCURACY_HIGH
  location: class Criteria
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:199: error: cannot find symbol
                accuracy = Criteria.ACCURACY_MEDIUM;
                                   ^
  symbol:   variable ACCURACY_MEDIUM
  location: class Criteria
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:463: error: cannot find symbol
             criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH);
                                                    ^
  symbol:   variable ACCURACY_HIGH
  location: class Criteria
~/Documents/ionic/geo/platforms/android/app/src/main/java/com/tenforwardconsulting/bgloc/DistanceFilterLocationProvider.java:467: error: cannot find symbol
                 locationManager.requestSingleUpdate(criteria, singleUpdatePI);
                                ^
  symbol:   method requestSingleUpdate(Criteria,PendingIntent)
  location: variable locationManager of type LocationManager
Note: ~/Documents/ionic/geo/platforms/android/app/src/main/java/com/marianhello/bgloc/ActivityRecognitionLocationProvider.java uses or overrides a d
eprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
44 errors

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.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
    at ChildProcess.whenDone (~/Documents/ionic/geo/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:30900) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:30900) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@mauron85 do you have any suggestions?

@giussa not really, but I would start fresh by deleting folders platform, plugins, maybe even node_modules. Then cordova platform add android ...

It is not working for me in combination with cordova 8.0.0. I can make an Android build after installing cordova version 7.1.0

npm install -g [email protected]

ionic cordova platform remove android
ionic cordova platform add android
ionic cordove build android

@mauron85 Do you have any idea why this is happens for this specific version of Cordova?

@pascalrijk Good catch. Can confirm that 2.3.4 is not working with cordova 8.0.0. Version 3.x is working with cordova 8, but only without ionic. Not sure how can I help here.

Hello to all, I tried to understand how to solve the new problem, I arrived to read the following issue: https://github.com/mauron85/cordova-plugin-background-geolocation/issues/362#issuecomment-367310158.

Then following the directions, I edited the file /platforms/android/app/build.gradle
replacing the parameters present with:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_6
    targetCompatibility JavaVersion.VERSION_1_6
}

initially sourceCompatibility and targetCompatibility they were set to JavaVersion.VERSION_1_8. By launching the command ionic cordova build android, I succeeded.

@mauron85 launching the command ionic cordova plugins ls the version of your plugin is 2.3.3:

cordova-plugin-device 2.0.1 "Device"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-mauron85-background-geolocation 2.3.3 "CDVBackgroundGeolocation"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"

looking in the file config.xml instead the version is 2.3.4:
<plugin name="cordova-plugin-mauron85-background-geolocation" spec="^2.3.4" />

the same in the file package.json:
"cordova-plugin-mauron85-background-geolocation": "^2.3.4",

The current configuration of the project is:

cli packages: (~/.nvm/versions/node/v8.10.0/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.1.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.0 
    ios-sim           : 5.0.10 
    Node              : v8.10.0
    npm               : 5.6.0 
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b 

Environment Variables:

    ANDROID_HOME : ~/Library/Android/sdk

Misc:

    backend : pro

@giussa you just reminded me that in version 3.x there was exclusion group added for logback.
I just did the same for 2.x. Please try 2.3.5 if it fixes your problem.

@mauron85 now I can use the plugin without any changes, thanks.

Closing.

I have fixed the issue with the next steps:

  1. Make sure that you init plugin AFTER platform.ready
  2. Check plugins/cordova-plugin-mauron85-background-geolocation/www/backgroundGeolocation.js the line window.backgroundGeoLocation = backgroundGeolocation; (if you are using 2.x plugin version)

and

check node_modules/@ionic-native/background-geolocation/index.js the line pluginRef: 'backgroundGeolocation',

  1. Change pluginRef: 'backgroundGeolocation' to pluginRef: 'backgroundGeoLocation'

I think it should depends on @ionic-native version.

Good Luck!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

frankzhangxd picture frankzhangxd  路  6Comments

mahmed-ntd picture mahmed-ntd  路  10Comments

mauron85 picture mauron85  路  4Comments

vlafranca picture vlafranca  路  6Comments

maurojones picture maurojones  路  3Comments