0

My Roximity SDK is continuously crashing,

Here's my Gradle:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':cropper')
compile project(':main')
compile project(':ROXIMITY_SDK_1_3_73')
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.slf4j:slf4j-api:1.7.10'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'org.apache.httpcomponents:httpmime:4.5.2'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:appcompat-v7:23.1.1'

} My Manifest:

I am using code according to instructions mentioned on documentation page as http://docs.roximity.com/mobile/android/integration, In onCreate:

ROXIMITYEngine.startEngineWithOptions(this.getApplicationContext(),  R.drawable.ic_launcher, null, this, null);
createBroadcastRecievers();

definition:

private void createBroadcastRecievers(){
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ROXConsts.MESSAGE_FIRED);
    intentFilter.addAction(ROXConsts.BEACON_RANGE_UPDATE);
    intentFilter.addAction(ROXConsts.WEBHOOK_POSTED);

    LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, intentFilter);
}
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent.getAction().equals(ROXConsts.MESSAGE_FIRED)) {
            MessageParcel messageParcel = (MessageParcel)intent.getParcelableExtra(ROXConsts.EXTRA_MESSAGE_PARCEL);
            handleMessageFired(messageParcel);
        } else if (intent.getAction().equals(ROXConsts.BEACON_RANGE_UPDATE)){
            String rangeJson = intent.getStringExtra(ROXConsts.EXTRA_RANGE_DATA);
            handleBeaconRangeUpdate(rangeJson);
        }
    }
};

Now its behavior is completely weird. Sometimes it didn't detect the beacons at all and send empty bundles in response. Sometimes detects the beacons for few minutes, and mostly getting crash after one or two updates. Here's the crash Report: FATAL EXCEPTION: main Process:

java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.location.Location.mProvider' on a null object reference at android.location.Location.set(Location.java:131) at android.location.Location.(Location.java:124) at com.roximity.sdk.location.RoxLocation.(RoxLocation.java:30) at com.roximity.sdk.actions.b.b(ActionManager.java:265) at com.roximity.sdk.actions.b.c(ActionManager.java:213) at com.roximity.sdk.beacons.c.c(RangingManager.java:169) at com.roximity.sdk.beacons.c.b(RangingManager.java:107) at com.roximity.sdk.beacons.c.a(RangingManager.java:84) at com.roximity.system.ble.d.j(BluetoothScanController.java:286) at com.roximity.system.ble.f.run(BluetoothScanController.java:257) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5835) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

I have tried almost all possible solutions, it's not an issue on application end, neither resolved by making changes in their recommended code. Any solution will be highly appreciated.

arslan haktic
  • 4,348
  • 4
  • 22
  • 35

1 Answers1

1

A few things that hopefully will help:

  • The most concerning thing I see is the second parameter, com.roximity.roximitysdkstarterkit.R.raw.roxstore , in your ROXIMITYEngine.startEngineWithOptions() call. The documentation describes that parameter as, "A drawable id that will be displayed for notifications, example R.drawable.ic_launcher." Replace this parameter with the id of a drawable in your app's resource directory.
  • From your gradel dependencies it looks like you may be using an unsupported version of the SDK, 1.3.71. The earliest supported SDK version to run with Google Play Services 8.4.0 is 1.3.73. Ensure that you are using a supported .aar and have it linked correctly to your project.
  • Android Compatibility v7, used to support older version of Android, dependency also appears to be missing from your gradel dependencies. Be sure you add compile 'appcompat-v7:23.1.1' to your dependency list.
  • It also appears in your dependencies that you are compiling the entire Google Play Services library, and also including lines for individual modules, while this isn't technically wrong - you should consider only importing the Google Play Service modules that are needed for you code. With respect to the ROXIMITY v1.3.73 SDK the only needed modules are; base, gcm, and location.

EDIT

Looking at your crash stack trace, the presented error is a null reference when the mProvider field is attempted to be retrieved from a Location object. It would seem that this crash is a result of the code expecting a Location object, likely from the FusedLocationApi, but instead receiving null. Perhaps some research into how and why the FusedLocationApi might return a null object would be a good place for you to continue your efforts.

Here are a few links to get you started:

Why is FusedLocationApi.getLastLocation null

FusedLocationApi.getLastLocation always null

Community
  • 1
  • 1
gacoler
  • 11
  • 2
  • thanks for your detailed response, i have tried with all solutions you have mentioned, but still no luck and getting same crash. As per support team there's no solution of this crash unless they update their sdk, but its still same even after updating their sdk, and they are bad at response. – arslan haktic Mar 25 '16 at 06:43