Estimote / Android-Fleet-Management-SDK

Estimote Fleet Management SDK for Android
https://developer.estimote.com
MIT License
836 stars 451 forks source link

Could not find class/NoClassDefFoundError BeaconService while using SDK in remote service #25

Closed Mtx88 closed 10 years ago

Mtx88 commented 10 years ago

Our application runs in a remote service.

Android Manifest File:

<service
            android:name="..."
            android:process=":remote" >
            <intent-filter>
                <action android:name="..." />
            </intent-filter>
</service>

I first added the BeaconService like this

<service android:name="com.estimote.sdk.service.BeaconService"
         android:exported="false"/>

But then I got the following error

02-19 12:42:19.923: E/dalvikvm(14751): Could not find class 'android.bluetooth.BluetoothManager', referenced from method com.estimote.sdk.BeaconManager.isBluetoothEnabled
02-19 12:42:19.983: E/dalvikvm(14751): Could not find class 'com.estimote.sdk.service.BeaconService$InternalLeScanCallback', referenced from method com.estimote.sdk.service.BeaconService.<init>
02-19 12:42:20.033: E/dalvikvm(14751): Could not find class 'android.bluetooth.BluetoothManager', referenced from method com.estimote.sdk.service.BeaconService.onCreate
02-19 12:42:20.038: E/AndroidRuntime(14751): FATAL EXCEPTION: main
02-19 12:42:20.038: E/AndroidRuntime(14751): java.lang.NoClassDefFoundError: com.estimote.sdk.service.BeaconService$InternalLeScanCallback
02-19 12:42:20.038: E/AndroidRuntime(14751):    at com.estimote.sdk.service.BeaconService.<init>(BeaconService.java:121)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at java.lang.Class.newInstanceImpl(Native Method)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at java.lang.Class.newInstance(Class.java:1319)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2385)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at android.app.ActivityThread.access$1600(ActivityThread.java:140)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at android.os.Looper.loop(Looper.java:137)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at android.app.ActivityThread.main(ActivityThread.java:4898)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at java.lang.reflect.Method.invokeNative(Native Method)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at java.lang.reflect.Method.invoke(Method.java:511)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
02-19 12:42:20.038: E/AndroidRuntime(14751):    at dalvik.system.NativeStart.main(Native Method)

Looking for a solution I tried adding: android:process=":remote" to the BeaconService

<service android:name="com.estimote.sdk.service.BeaconService"
         android:process=":remote"
         android:exported="true"/>

This did fix the error and I was able to receive data from the listeners but for some reason this only works on my Nexus 5 which runs Android KitKat 4.4. This solution did NOT work on my Samsung S3 which runs on an older version of Android.

Jar path: libs\estimote-sdk-preview.jar

I understand that BLE only works on 4.3+ but should it just crash like that?

Any advice?

wiktor commented 10 years ago

No, it should be more clear for the logs.

I'll leave it open to make sure that errors are more friendly when it runs on non 4.3+ device.