React-native-background-geolocation: java.lang.NoClassDefFoundError: com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$1

Created on 11 Feb 2018  Β·  7Comments  Β·  Source: transistorsoft/react-native-background-geolocation

Your Environment

Expected Behavior

I trying to use library in native Android app. It works fine for then 6 mounths, but tooday I have an crash.
I enable Multidex like here https://developer.android.com/studio/build/multidex.html. I dont use proGuard
mb will be helpfull: I try to reset few commits, but app still crashing.

Actual Behavior

I have a crash.

Steps to Reproduce

I think here this point not actual

Sourse Code

backgroundGeolocation is a field of Service. I try to connect in onCreate() method of this service, early it works fine.

backgroundGeolocation = BackgroundGeolocation.getInstance(this, new Intent());
        backgroundGeolocation.isDead();
        backgroundGeolocation.configure(getConfig(), new TSCallback() {
            @Override
            public void onSuccess() {
                Log.d(TAG, "onSuccess");
                backgroundGeolocation.start(new TSCallback() {
                    @Override
                    public void onSuccess() {
                        Log.d(TAG, "onSuccess Start");

                    }

                    @Override
                    public void onFailure(String s) {
                        Log.d(TAG, "onFailure Start: " + s);
                    }
                });
                Log.d(TAG, "ONSUCCESS");
            }

            @Override
            public void onFailure(String s) {
                Log.d(TAG, "onFailure: " + s);

            }
        });

Context

I try to start BackgroundGeolocation updates

Debug logs

StakTrace on error FATAL EXCEPTION: pool-6-thread-1
Process: com.thesoft.ourtaxi, PID: 24541
java.lang.NoClassDefFoundError: com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$1
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation.start(Unknown Source)
at com.thesoft.ourtaxi.service.location.LService$1.onSuccess(LService.java:81)
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$c.a(Unknown Source)
at com.transistorsoft.locationmanager.adapter.BackgroundGeolocation$c.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

Logs from yours library:
[c.t.l.util.Sensors print]
╔═════════════════════════════════════════════
β•‘ DEVICE SENSORS
╠═════════════════════════════════════════════
β•Ÿβ”€ βœ… ACCELEROMETER: {Sensor name="BOSCH BMA250 3-axis Accelerometer", vendor="BOSCH", version=1, type=1, maxRange=39.2266, resolution=0.038307227, power=0.1, minDelay=10000}
β•Ÿβ”€ βœ… GYROSCOPE: {Sensor name="R3GD20 Gyroscope sensor", vendor="ST Group Ltd.", version=1, type=4, maxRange=34.906586, resolution=0.0012217305, power=6.1, minDelay=10000}
β•Ÿβ”€ βœ… MAGNETOMETER: {Sensor name="AK8963 3-axis Magnetic field sensor", vendor="Asahi Kasei Microdevices", version=1, type=2, maxRange=4915.2, resolution=0.06, power=0.28, minDelay=10000}
β•Ÿβ”€ βœ… SIGNIFICANT_MOTION: {Sensor name="BOSCH BMA250 Signifcant Motion Sensor", vendor="BOSCH", version=1, type=17, maxRange=1.0, resolution=1.0, power=0.1, minDelay=-1}
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
02-11 19:24:18.747 25454-25454/com.thesoft.ourtaxi I/TSLocationManager: [c.t.l.a.BackgroundGeolocation ]
╔═════════════════════════════════════════════
β•‘ TSLocationManager version: 2.11.2
╠═════════════════════════════════════════════
02-11 19:24:18.767 25454-25454/com.thesoft.ourtaxi I/TSLocationManager: [c.t.l.a.BackgroundGeolocation ]
βœ… Google Play Services: connected (version code:11717000)
02-11 19:24:18.807 25454-25454/com.thesoft.ourtaxi D/TSLocationManager: [c.t.l.d.s.SQLiteLocationDAO dbh]
βœ… Opened database
02-11 19:24:18.837 25454-25454/com.thesoft.ourtaxi D/TSLocationManager: [c.t.l.d.s.SQLiteLocationDAO prune]
ℹ️ PRUNE -1 days
02-11 19:24:18.887 25454-25454/com.thesoft.ourtaxi D/TSLocationManager: [c.t.l.data.sqlite.GeofenceDAO dbh]
βœ… Opened database
02-11 19:24:18.917 25454-25454/com.thesoft.ourtaxi I/TSLocationManager: [c.t.l.a.BackgroundGeolocation ]
οΏ½οΏ½ Connecting to GooglePlayServices...
02-11 19:24:18.967 25454-25507/com.thesoft.ourtaxi I/TSLocationManager: [c.t.l.settings.Settings print]
╔═════════════════════════════════════════════
β•‘ BackgroundGeolocation Settings
╠═════════════════════════════════════════════
{
"isMoving": false,
"enabled": false,
"odometer": 0,
"schedulerEnabled": false,
"trackingMode": "location",
"distanceFilter": 2,
"desiredAccuracy": 0,
"desiredOdometerAccuracy": 100,
"locationUpdateInterval": 5000,
"fastestLocationUpdateInterval": 10000,
"locationTimeout": 60,
"deferTime": 0,
"disableElasticity": false,
"elasticityMultiplier": 1,
"allowIdenticalLocations": false,
"activityRecognitionInterval": 10000,
"minimumActivityRecognitionConfidence": 75,
"triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking",
"disableStopDetection": false,
"stationaryRadius": 25,
"stopTimeout": 5,
"stopOnStationary": false,
"url": "",
"method": "POST",
"autoSync": true,
"autoSyncThreshold": 0,
"batchSync": false,
"maxBatchSize": -1,
"params": {},
"headers": {},
"extras": {},
"httpRootProperty": "location",
"locationTemplate": "",
"geofenceTemplate": "",
"persist": true,
"maxDaysToPersist": 1,
"maxRecordsToPersist": -1,
"locationsOrderDirection": "ASC",
"httpTimeout": 60000,
"geofenceProximityRadius": 1000,
"geofenceInitialTriggerEntry": true,
"stopOnTerminate": true,
"startOnBoot": false,
"heartbeatInterval": -1,
"foregroundService": false,
"notificationPriority": 0,
"notificationTitle": "",
"notificationText": "Location Service activated",
"notificationColor": "",
"notificationIcon": "",
"notificationSmallIcon": "",
"notificationLargeIcon": "",
"forceReloadOnLocationChange": false,
"forceReloadOnMotionChange": false,
"forceReloadOnGeofence": false,
"forceReloadOnBoot": false,
"forceReloadOnHeartbeat": false,
"forceReloadOnSchedule": false,
"stopAfterElapsedMinutes": 0,
"schedule": [],
"enableHeadless": false,
"configureUrl": "",
"configureInterval": -1,
"debug": false,
"logLevel": 5,
"logMaxDays": 3
}β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Most helpful comment

Adding new dependency solved my problem. Thanks!

All 7 comments

With latest version, I added a new dependency allowing the library to handle Android permissions. Do you have this included?

I'm working on a dedicated repo for use with native apps. It's almost ready.

You'll install the Android lib like this. This way, you won't have to manage the plugin's dependencies manually -- it'll bring them along in its own build.gradle.

I'm thinking of splitting the repo into 2: 1 for each of iOS and Android.

Adding new dependency solved my problem. Thanks!

Awesome. If you’re using the iOS api, I’ve got big improvements coming there as well.

Both iOS & Android will have a β€œBuilder”-type configuration API instead of the clunky NSDictionary / JSONObject mechanism that it currently does.

I have same issue after upgrading gradle-plugin to 3.1.0

@doniyor2109 post your stacktrace.

Thanks. I have solved with @vaniakerer's solution

Was this page helpful?
0 / 5 - 0 ratings