Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Build Problem / Package missing #758

Open
Ste-denko opened this issue Oct 5, 2021 · 2 comments
Open

Android Build Problem / Package missing #758

Ste-denko opened this issue Oct 5, 2021 · 2 comments

Comments

@Ste-denko
Copy link

Ste-denko commented Oct 5, 2021

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

  1. Follow the documentation of this project
  2. Try to build the project within Android Studio
  3. Error appears

Context

Did research and tried to make the android support library available without success.

Debug logs

@HamzaJaved-tech
Copy link

Same error. Does anyone find a solution for this?

@Ste-denko
Copy link
Author

Ste-denko commented Oct 7, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants