Android Build Problem / Package missing
Ste-denko opened this issue · 2 comments
Your Environment
- Plugin version: >=2.3.0
- Platform: Android
- OS version: LineageOS 18.1
- Device manufacturer and model: MotoG7
- Running in Simulator: No
- Cordova version (
cordova -v
): - Cordova platform version (
cordova platform ls
): - Plugin configuration options:
- Link to your project:
Context
I included this plugin in my Ionic/Angular/Capacitor project.
When building it in Android Studio the following error occurs for BackgroundLocation.java file:
error: package android.support.v4.util does not exist
import android.support.v4.util.TimeUtils;
^
How to get rid of this package missing error?
As stated in the project documentation I added the related Maven repository to the build gradle file
and also added the following dependency:
"com.android.support:support-core-utils:28.0.0"
I am not quite sure if this is the correct package!?
Could anyone please guide me here?
Expected Behavior
No package missing should appear
Actual Behavior
Package missing error appears
Possible Fix
Install the missing package!
I added the related Maven repository to the build gradle file
and also added the following dependency:
"com.android.support:support-core-utils:28.0.0"
I am not quite sure if this is the correct package!?
Could anyone please guide me here?
Steps to Reproduce
- Follow the documentation of this project
- Try to build the project within Android Studio
- Error appears
Context
Did research and tried to make the android support library available without success.
Debug logs
Same error. Does anyone find a solution for this?
I had to change several 'imports' in many classes in Android Studio to the current version (e.g.: androidx).
Change:
import android.support.v4.util.TimeUtils;
To:
import androidx.core.util.TimeUtils;
Also 'annotation' and 'localbroadcastmanager' imports were wrong.
In these cases this was correct:
import androidx.annotation
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
You can also try to right click into your class window in Android Studio, then "Refactor -> Migrate to AndroidX" to get problems like this sorted out.
After this was fixed I got errors about missing Strings.
This could again be fixed by adding the following lines to the strings.xml file:
<string name="mauron85_bgloc_account_name">$ACCOUNT_NAME</string>
<string name="mauron85_bgloc_account_type">$ACCOUNT_TYPE</string>
<string name="mauron85_bgloc_content_authority">$CONTENT_AUTHORITY</string>
In general I cannot recommend using this plugin anymore since newer Android versions are really buggy and not working as expected at all.
It also seems as this plugin is unfortunately not maintained any more.
I simply do not get why this plugin is still referenced by the Ionic site.
See also this issue: Alternative free plugin #749
Cheers