react-native-background-geolocation
react-native-background-geolocation copied to clipboard
[ANDROID] Not working when following the instructions + SOLUTION
Your Environment
- Plugin version:
- Platform: Android
- OS version: 10.0
- Device manufacturer and model: Doesn't matter
- Running in Simulator: Yes
- React Native version: 0.61.5
- Plugin configuration options: 0.6.3
- Link to your project: Nope
Context
Not working on android after following the instructions, ie :
- Add the library with
yarn add @mauron85/react-native-background-geolocation
- Launch the script using
node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js
Expected Behavior
The app is now able to use background geolocation and build correctly and not crash
Actual Behavior
Build fails.
Possible Fix
I think jetifier was not picking up the common module. So I migrated everything to androidx using Android Studio. And also in the file VERSION.gradle
there was an issue with getApplicationId that I fixed too.
You can use the package patch-package
.
And then apply this patch patches/@mauron85+react-native-background-geolocation+0.6.3.patch
:
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/VERSIONS.gradle b/node_modules/@mauron85/react-native-background-geolocation/android/common/VERSIONS.gradle
index 61f0865..17a0623 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/VERSIONS.gradle
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/VERSIONS.gradle
@@ -21,11 +21,11 @@ def RESOURCE_PREFIX = "mauron85_bgloc_"
ext {
getApplicationId = { ->
def applicationId = "com.marianhello.app"
- if (findProject('..:app') != null) {
- applicationId = project('..:app').android.defaultConfig.applicationId
- } else if (findProject(':app') != null) {
- applicationId = project(':app').android.defaultConfig.applicationId
- }
+ // if (findProject('..:app') != null) {
+ // applicationId = project('..:app').android.defaultConfig.applicationId
+ // } else if (findProject(':app') != null) {
+ // applicationId = project(':app').android.defaultConfig.applicationId
+ // }
if (rootProject.hasProperty('applicationId')) {
applicationId = rootProject.applicationId
}
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/build.gradle b/node_modules/@mauron85/react-native-background-geolocation/android/common/build.gradle
index 98542b1..07961e8 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/build.gradle
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/build.gradle
@@ -64,7 +64,7 @@ android {
resValue "string", resourcePrefix + "account_name", 'Locations'
resValue "string", resourcePrefix + "account_type", accountPrefix + '.account'
resValue "string", resourcePrefix + "content_authority", accountPrefix + '.provider'
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion project.ext.getMinSdkVersion()
versionCode 1
versionName "1.0"
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java
index 24fc246..3de1756 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java
@@ -1,7 +1,7 @@
package com.marianhello.bgloc;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.provider.TestLocationProviderFactory;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java
index 33e5c69..cd1439d 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java
@@ -2,9 +2,9 @@ package com.marianhello.bgloc;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import android.util.JsonReader;
import android.util.JsonToken;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java
index a255b87..e7aaec7 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java
@@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import static android.support.test.InstrumentationRegistry.getContext;
+import static androidx.test.platform.app.InstrumentationRegistry.getContext;
import static com.marianhello.bgloc.data.sqlite.SQLiteLocationContract.LocationEntry.SQL_DROP_LOCATION_TABLE;
import static junit.framework.Assert.assertEquals;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java
index 27c27c9..026a547 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java
@@ -1,9 +1,9 @@
package com.marianhello.bgloc;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.marianhello.logging.DBLogReader;
import com.marianhello.logging.LogEntry;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java
index 01c5271..ceaad33 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java
@@ -6,20 +6,17 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ServiceTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.rule.ServiceTestRule;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.marianhello.bgloc.provider.TestLocationProviderFactory;
import com.marianhello.bgloc.service.LocationServiceImpl;
-import com.marianhello.bgloc.service.LocationServiceIntentBuilder;
import com.marianhello.bgloc.service.LocationServiceProxy;
import org.junit.After;
-import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java
index 6698819..dee5233 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java
@@ -7,12 +7,12 @@ import android.content.IntentFilter;
import android.location.Location;
import android.os.Bundle;
import android.os.IBinder;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ServiceTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.rule.ServiceTestRule;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.provider.MockLocationProvider;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java
index 2257931..d5b3bb6 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java
@@ -3,11 +3,10 @@ package com.marianhello.bgloc;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
-import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.data.HashMapLocationTemplate;
import com.marianhello.bgloc.data.LocationTemplate;
import com.marianhello.bgloc.data.LocationTemplateFactory;
@@ -24,7 +23,6 @@ import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.LinkedHashSet;
/**
* Created by finch on 13/07/16.
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java
index 3c8ff11..92bb501 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java
@@ -3,9 +3,9 @@ package com.marianhello.bgloc;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationDAO;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java
index 32b9b7b..eccc276 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java
@@ -3,9 +3,9 @@ package com.marianhello.bgloc;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationDAO;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java
index 169c6c4..d5efa03 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java
@@ -5,9 +5,9 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteConfigurationContract;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java
index a8c755f..e428e3a 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java
@@ -14,8 +14,8 @@ import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.core.content.ContextCompat;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.text.TextUtils;
import com.github.jparkie.promise.Promise;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/Config.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/Config.java
index db809d0..09a6432 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/Config.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/Config.java
@@ -12,7 +12,7 @@ package com.marianhello.bgloc;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.Nullable;
+import androidx.annotation.Nullable;
import com.marianhello.bgloc.data.AbstractLocationTemplate;
import com.marianhello.bgloc.data.LocationTemplate;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java
index f41b12a..9d2e7ce 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java
@@ -7,9 +7,8 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.v4.util.TimeUtils;
+import androidx.core.util.TimeUtils;
-import com.marianhello.bgloc.data.sqlite.SQLiteLocationContract;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationContract.LocationEntry;
import org.json.JSONException;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java
index 3e3b65c..41e2002 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java
@@ -1,10 +1,8 @@
package com.marianhello.bgloc.data;
import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
-import com.marianhello.bgloc.data.BackgroundLocation;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
public interface LocationTransform
{
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java
index 18f1ba1..8f40b37 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java
@@ -29,8 +29,8 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
-import android.support.annotation.Nullable;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.annotation.Nullable;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.ConnectivityListener;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java
index fd0b99e..3d95eba 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java
@@ -21,7 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
-import android.support.annotation.IntDef;
+import androidx.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java
index 9be9687..0959766 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java
@@ -9,8 +9,8 @@ import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build;
-import android.support.annotation.RequiresApi;
-import android.support.v4.app.NotificationCompat;
+import androidx.annotation.RequiresApi;
+import androidx.core.app.NotificationCompat;
import com.marianhello.bgloc.ResourceResolver;
import com.marianhello.logging.LoggerManager;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java
index 9c713e9..c2fe392 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java
@@ -11,8 +11,8 @@ import android.content.SyncResult;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.support.v4.app.NotificationCompat;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.core.app.NotificationCompat;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.HttpPostService;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java
index 145816a..35ffe15 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java
@@ -1,7 +1,7 @@
package com.marianhello.backgroundgeolocation;
import android.os.Build;
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.data.BackgroundLocation;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java
index 01ee7f9..80ab3d8 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java
@@ -1,6 +1,6 @@
package com.marianhello.backgroundgeolocation;
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.data.ArrayListLocationTemplate;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java
index 39e3d3e..6072a6f 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java
@@ -1,6 +1,6 @@
package com.marianhello.backgroundgeolocation;
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
import com.marianhello.logging.DBLogReader;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/gradle.properties b/node_modules/@mauron85/react-native-background-geolocation/android/gradle.properties
index 89e0d99..915f0e6 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/gradle.properties
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/gradle.properties
@@ -16,3 +16,5 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
+android.enableJetifier=true
+android.useAndroidX=true
\ No newline at end of file
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/lib/build.gradle b/node_modules/@mauron85/react-native-background-geolocation/android/lib/build.gradle
index 3a8b36c..32c46bc 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/lib/build.gradle
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/lib/build.gradle
@@ -69,7 +69,7 @@ android {
useLibrary 'android.test.mock'
defaultConfig {
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion project.ext.getMinSdkVersion()
targetSdkVersion project.ext.getTargetSdkVersion()
versionCode 1 // intentionally not updating version as we're not uploading to any java repository
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/androidTest/java/com/marianhello/bgloc/react/ConfigMapperTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/androidTest/java/com/marianhello/bgloc/react/ConfigMapperTest.java
index 44682bc..48b1676 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/androidTest/java/com/marianhello/bgloc/react/ConfigMapperTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/androidTest/java/com/marianhello/bgloc/react/ConfigMapperTest.java
@@ -1,9 +1,9 @@
package com.marianhello.bgloc.react;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReadableMap;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/react/headless/HeadlessService.java b/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/react/headless/HeadlessService.java
index 50a31b4..298f6fb 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/react/headless/HeadlessService.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/react/headless/HeadlessService.java
@@ -2,7 +2,7 @@ package com.marianhello.bgloc.react.headless;
import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.Nullable;
+import androidx.annotation.Nullable;
import com.facebook.react.HeadlessJsTaskService;
import com.facebook.react.bridge.Arguments;
Steps to Reproduce
- New react native project
- Install the library using instructions
- Cry
- Apply my patch and rejoice
Context
Add background geolocation to my app.
Debug logs
I too ran into the VERSIONS.gradle issue in the common module. I opened a PR there that you can reference. Hoping it can get resolved soon (https://github.com/mauron85/background-geolocation-android/pull/41)
@mysport12 Do you think these two are related? I think androidX support is lacking so the patch seems more reasonable to me. Unless I'm missing something, in which case I'm curious how I can test what you're proposing in your PR?
@Daavidaviid Could you make this into a PR? Patches work but PRs are better 😄
@mauron85 I've run the patch and verified that it works.
I made a patch because the common
module is in another repo and I don't know if @mauron85 is maintaining this library actively to validate PRs.
Hi @Daavidaviid
I tried to apply the patch and got the following error:
**ERROR** Failed to apply patch for package @mauron85/react-native-background-geolocation at path
node_modules/@mauron85/react-native-background-geolocation
This error was caused because patch-package cannot apply the following patch file:
patches/@mauron85+react-native-background-geolocation+0.6.3.patch
@mikadze I updated the patches in my first post (I messed up by removing the local.properties
section by hand), try again
For me the only issue was in VERSIONS.gradle. I had no other build issues and didn’t need to patch anything else
@Daavidaviid first post was last edited 1 hour ago. I tried that version. Did you make edit since then?
I did but here it is :
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/VERSIONS.gradle b/node_modules/@mauron85/react-native-background-geolocation/android/common/VERSIONS.gradle
index 61f0865..17a0623 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/VERSIONS.gradle
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/VERSIONS.gradle
@@ -21,11 +21,11 @@ def RESOURCE_PREFIX = "mauron85_bgloc_"
ext {
getApplicationId = { ->
def applicationId = "com.marianhello.app"
- if (findProject('..:app') != null) {
- applicationId = project('..:app').android.defaultConfig.applicationId
- } else if (findProject(':app') != null) {
- applicationId = project(':app').android.defaultConfig.applicationId
- }
+ // if (findProject('..:app') != null) {
+ // applicationId = project('..:app').android.defaultConfig.applicationId
+ // } else if (findProject(':app') != null) {
+ // applicationId = project(':app').android.defaultConfig.applicationId
+ // }
if (rootProject.hasProperty('applicationId')) {
applicationId = rootProject.applicationId
}
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/build.gradle b/node_modules/@mauron85/react-native-background-geolocation/android/common/build.gradle
index 98542b1..07961e8 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/build.gradle
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/build.gradle
@@ -64,7 +64,7 @@ android {
resValue "string", resourcePrefix + "account_name", 'Locations'
resValue "string", resourcePrefix + "account_type", accountPrefix + '.account'
resValue "string", resourcePrefix + "content_authority", accountPrefix + '.provider'
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion project.ext.getMinSdkVersion()
versionCode 1
versionName "1.0"
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java
index 24fc246..3de1756 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BackgroundGeolocationFacadeTest.java
@@ -1,7 +1,7 @@
package com.marianhello.bgloc;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.provider.TestLocationProviderFactory;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java
index 33e5c69..cd1439d 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/BatchManagerTest.java
@@ -2,9 +2,9 @@ package com.marianhello.bgloc;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import android.util.JsonReader;
import android.util.JsonToken;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java
index a255b87..e7aaec7 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/ContentProviderLocationDAOTest.java
@@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import static android.support.test.InstrumentationRegistry.getContext;
+import static androidx.test.platform.app.InstrumentationRegistry.getContext;
import static com.marianhello.bgloc.data.sqlite.SQLiteLocationContract.LocationEntry.SQL_DROP_LOCATION_TABLE;
import static junit.framework.Assert.assertEquals;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java
index 27c27c9..026a547 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/DBLogReaderTest.java
@@ -1,9 +1,9 @@
package com.marianhello.bgloc;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.marianhello.logging.DBLogReader;
import com.marianhello.logging.LogEntry;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java
index 01c5271..ceaad33 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceProxyTest.java
@@ -6,20 +6,17 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ServiceTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.rule.ServiceTestRule;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.marianhello.bgloc.provider.TestLocationProviderFactory;
import com.marianhello.bgloc.service.LocationServiceImpl;
-import com.marianhello.bgloc.service.LocationServiceIntentBuilder;
import com.marianhello.bgloc.service.LocationServiceProxy;
import org.junit.After;
-import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java
index 6698819..dee5233 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/LocationServiceTest.java
@@ -7,12 +7,12 @@ import android.content.IntentFilter;
import android.location.Location;
import android.os.Bundle;
import android.os.IBinder;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ServiceTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.rule.ServiceTestRule;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.provider.MockLocationProvider;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java
index 2257931..d5b3bb6 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteConfigurationDAOTest.java
@@ -3,11 +3,10 @@ package com.marianhello.bgloc;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
-import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.data.HashMapLocationTemplate;
import com.marianhello.bgloc.data.LocationTemplate;
import com.marianhello.bgloc.data.LocationTemplateFactory;
@@ -24,7 +23,6 @@ import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.LinkedHashSet;
/**
* Created by finch on 13/07/16.
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java
index 3c8ff11..92bb501 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOTest.java
@@ -3,9 +3,9 @@ package com.marianhello.bgloc;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationDAO;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java
index 32b9b7b..eccc276 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteLocationDAOThreadTest.java
@@ -3,9 +3,9 @@ package com.marianhello.bgloc;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationDAO;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java
index 169c6c4..d5efa03 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/androidTest/java/com/marianhello/bgloc/SQLiteOpenHelperTest.java
@@ -5,9 +5,9 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteConfigurationContract;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java
index a8c755f..e428e3a 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java
@@ -14,8 +14,8 @@ import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.core.content.ContextCompat;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.text.TextUtils;
import com.github.jparkie.promise.Promise;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/Config.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/Config.java
index db809d0..09a6432 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/Config.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/Config.java
@@ -12,7 +12,7 @@ package com.marianhello.bgloc;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.Nullable;
+import androidx.annotation.Nullable;
import com.marianhello.bgloc.data.AbstractLocationTemplate;
import com.marianhello.bgloc.data.LocationTemplate;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java
index f41b12a..9d2e7ce 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/BackgroundLocation.java
@@ -7,9 +7,8 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.v4.util.TimeUtils;
+import androidx.core.util.TimeUtils;
-import com.marianhello.bgloc.data.sqlite.SQLiteLocationContract;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationContract.LocationEntry;
import org.json.JSONException;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java
index 3e3b65c..41e2002 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/data/LocationTransform.java
@@ -1,10 +1,8 @@
package com.marianhello.bgloc.data;
import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
-import com.marianhello.bgloc.data.BackgroundLocation;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
public interface LocationTransform
{
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java
index 18f1ba1..8f40b37 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceImpl.java
@@ -29,8 +29,8 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
-import android.support.annotation.Nullable;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.annotation.Nullable;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.ConnectivityListener;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java
index fd0b99e..3d95eba 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/service/LocationServiceIntentBuilder.java
@@ -21,7 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
-import android.support.annotation.IntDef;
+import androidx.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java
index 9be9687..0959766 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/NotificationHelper.java
@@ -9,8 +9,8 @@ import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build;
-import android.support.annotation.RequiresApi;
-import android.support.v4.app.NotificationCompat;
+import androidx.annotation.RequiresApi;
+import androidx.core.app.NotificationCompat;
import com.marianhello.bgloc.ResourceResolver;
import com.marianhello.logging.LoggerManager;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java
index 9c713e9..c2fe392 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/main/java/com/marianhello/bgloc/sync/SyncAdapter.java
@@ -11,8 +11,8 @@ import android.content.SyncResult;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.support.v4.app.NotificationCompat;
-import android.support.v4.content.LocalBroadcastManager;
+import androidx.core.app.NotificationCompat;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.HttpPostService;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java
index 145816a..35ffe15 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/BackgroundLocationTest.java
@@ -1,7 +1,7 @@
package com.marianhello.backgroundgeolocation;
import android.os.Build;
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.data.BackgroundLocation;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java
index 01ee7f9..80ab3d8 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/ConfigTest.java
@@ -1,6 +1,6 @@
package com.marianhello.backgroundgeolocation;
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.data.ArrayListLocationTemplate;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java
index 39e3d3e..6072a6f 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/common/src/test/java/com/marianhello/backgroundgeolocation/DBLogReaderTest.java
@@ -1,6 +1,6 @@
package com.marianhello.backgroundgeolocation;
-import android.support.test.filters.SmallTest;
+import androidx.test.filters.SmallTest;
import com.marianhello.logging.DBLogReader;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/gradle.properties b/node_modules/@mauron85/react-native-background-geolocation/android/gradle.properties
index 89e0d99..915f0e6 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/gradle.properties
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/gradle.properties
@@ -16,3 +16,5 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
+android.enableJetifier=true
+android.useAndroidX=true
\ No newline at end of file
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/lib/build.gradle b/node_modules/@mauron85/react-native-background-geolocation/android/lib/build.gradle
index 3a8b36c..32c46bc 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/lib/build.gradle
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/lib/build.gradle
@@ -69,7 +69,7 @@ android {
useLibrary 'android.test.mock'
defaultConfig {
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion project.ext.getMinSdkVersion()
targetSdkVersion project.ext.getTargetSdkVersion()
versionCode 1 // intentionally not updating version as we're not uploading to any java repository
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/androidTest/java/com/marianhello/bgloc/react/ConfigMapperTest.java b/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/androidTest/java/com/marianhello/bgloc/react/ConfigMapperTest.java
index 44682bc..48b1676 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/androidTest/java/com/marianhello/bgloc/react/ConfigMapperTest.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/androidTest/java/com/marianhello/bgloc/react/ConfigMapperTest.java
@@ -1,9 +1,9 @@
package com.marianhello.bgloc.react;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReadableMap;
diff --git a/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/react/headless/HeadlessService.java b/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/react/headless/HeadlessService.java
index 50a31b4..298f6fb 100644
--- a/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/react/headless/HeadlessService.java
+++ b/node_modules/@mauron85/react-native-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/react/headless/HeadlessService.java
@@ -2,7 +2,7 @@ package com.marianhello.bgloc.react.headless;
import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.Nullable;
+import androidx.annotation.Nullable;
import com.facebook.react.HeadlessJsTaskService;
import com.facebook.react.bridge.Arguments;
Still not working for me, but thanks anyways I will try manually.
I made 2 PR, one concerning the main repo and the other one the submodule. Main : https://github.com/mauron85/react-native-background-geolocation/pull/471 Sub : https://github.com/mauron85/background-geolocation-android/pull/42
@mauron85 Need help with this lib (/ these libs)? They're important to my apps and I really prefer not forking anything.
Any updates about it ? I'm getting a error too, just with VERSIONS.gradle ...
I could solve it just putting a couple point before :app
to reference:
File: VERSIONS.gradle
Lines: 26 and 27.
Before (doesn't work):
else if (findProject(':app') != null) {
applicationId = project(':app').android.defaultConfig.applicationId
After: (it's work)
else if (findProject('..:app') != null) {
applicationId = project('..:app').android.defaultConfig.applicationId
I can confirm this small edit works.
or just remove the whole else if statement below also work.
else if (findProject(':app') != null) {
applicationId = project(':app').android.defaultConfig.applicationId
I could solve it just putting a couple point before
:app
to reference: File: VERSIONS.gradle Lines: 26 and 27. Before (doesn't work):else if (findProject(':app') != null) { applicationId = project(':app').android.defaultConfig.applicationId
After: (it's work)
else if (findProject('..:app') != null) { applicationId = project('..:app').android.defaultConfig.applicationId
Does anybody know version of the ReactNative when this starts happening?
I believe it began with RN0.62.0. I was able to work around the issue for now using the manual linking. I have also been able to work around the issue with the VERSIONS.gradle file changes proposed
I'm facing this in 0.61.5
@mauron85
@mauron85 it will start happening on 0.60.0 or above if i am not wrong i am also facing same when trying to update to 0.60.6
@mauron85 are you still maintaining the repo's?
@mauron85 I working on 0.62.2.
Worked at RN 0.61.5, broke when I updated to RN 0.62.2. Even with the above changes applied the app crashes on start.
Rollback to RN 0.61.5 fixed the problem.
Package version :
"react": "16.13.1",
"react-native": "0.63.1",
"@mauron85/react-native-background-geolocation": "^0.6.3",
I see autolinking doesn't complete setup.
$ yarn add @mauron85/react-native-background-geolocation
$ node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js
Solution is follow manual doc and make sure all things are there. For me, android/settings.gradle
and android/app/build.gradle
were required to modify.
Cheers
After following the steps here, I'm facing this other error while trying to build for release if anyone can help me on this (I've tried many different things already): https://github.com/mauron85/react-native-background-geolocation/issues/505
Not sure if this will help anyone but I tried a couple things which one helped
npx jetify
inside android folder
./gradlew clean
inside my build.gradle in android I had multiple commands inside of maven {} - I moved each into their own maven {} statement
https://stackoverflow.com/questions/49542654/react-native-error-cannot-find-symbol-after-upgrade
Also I changed from:
implementation "com.facebook.react:react-native:+"
to
implementation "com.facebook.react:react-native:0.60.5"
Again not sure what was the fix, but I think it might have been the maven piece
Hello!
I solved this running npx jetify
before building.
https://stackoverflow.com/a/57501835/2343313
Hello! I solved this running
npx jetify
before building.https://stackoverflow.com/a/57501835/2343313
Worked for me with this thanks @marcoburrometo