cordova-plugin-background-geolocation: junit framework not found
Your Environment
- Plugin version: 3.0.0 alpha 50
- Platform: Android
- Running in Simulator:
- Cordova version (
cordova -v
): 8.1.2 - Cordova platform version (
cordova platform ls
): Android 8.0.0 - Plugin configuration options:
ionic cordova plugin add cordova-plugin-mauron85-background-geolocation@alpha --save
--variable ANDROID_SUPPORT_LIBRARY_VERSION="23+"
--variable GOOGLE_PLAY_SERVICES_VERSION="11.+"
--variable ICON="@mipmap/ic_launcher"
--variable SMALL_ICON="@mipmap/ic_launcher"
--variable ACCOUNT_NAME="@string/app_name"
--variable ACCOUNT_LABEL="@string/app_name"
--variable ACCOUNT_TYPE="$PACKAGE_NAME.account"
--variable CONTENT_AUTHORITY="$PACKAGE_NAME"
--variable ALWAYS_USAGE_DESCRIPTION="description"
--variable MOTION_USAGE_DESCRIPTION="description"
Context
Task :app:compileDebugJavaWithJavac FAILED
25 actionable tasks: 25 executed
BUILD FAILED in 40s
/../platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: /../platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/../platforms/android/app/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java:26: error: package junit.framework does not exist
import junit.framework.Assert;
^
/../platforms/android/app/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java:164: error: cannot find symbol
Assert.assertNotNull("Context can not be null!", mContext);
^
symbol: variable Assert
Expected Behavior
After calling cordova android build
, the build process should be successful
Actual Behavior
The error pops up when running cordova android build
Steps to Reproduce
- Install plugin with config above
- run
cordova build android
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 23 (2 by maintainers)
@mowaiskalam
Hey guys, for anyone having this issue the fix is quite simple:
jUnit is used for testing purposes, I don’t know why the dependency is there. So what you have to do is open
platforms\android\app\src\main\java\com\marianhello\bgloc\service\LocationServiceIntentBuilder.java
and comment (or remove, it’s the same) the following lines:26 -
import junit.framework.Assert;
164 -Assert.assertNotNull("Context can not be null!", mContext);
After that everything should be working as expected.
If I remember correctly this has been fixed in common module, which was just updated to latest version. Try plugin version 3.0.0.0 (released just now).
This issue is happening again with the Google Firebase updates from 17th June, forcing devices to update android platform to 8.0.0. After the update, using cordova-plugin-mauron85-background-geolocation@3.0.0-alpha.50 causes the error appear again, making impossible the build for Android with Ionic
If I update the plugin to v3.0.3, it doesn’t work as expected, not fetching locations neither showing the notification in the notification bar or even logging errors or activities in the console.
@mauron85 when you will be able to fix this with a new version?
I think this has been fixed in common package. Need to release new version.