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

Framework should not crash on Androids <4.3 #48

Closed
tjvolume opened this issue May 10, 2014 · 23 comments
Closed

Framework should not crash on Androids <4.3 #48

tjvolume opened this issue May 10, 2014 · 23 comments
Labels

Comments

@tjvolume
Copy link

Seeing a lot of this:

java.lang.NoClassDefFoundError: com.estimote.sdk.service.BeaconService$InternalLeScanCallback
at com.estimote.sdk.service.BeaconService.(BeaconService.java:122)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2395)
at android.app.ActivityThread.access$1700(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1323)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4950)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
at dalvik.system.NativeStart.main(Native Method)

@wiktor
Copy link
Contributor

wiktor commented May 12, 2014

Where are you seeing that?

It looks like a jar is corrupted and you need to re-download it.

@wiktor wiktor closed this as completed May 12, 2014
@wiktor wiktor reopened this May 12, 2014
@tjvolume
Copy link
Author

Getting it from Play dev console. All pre 4.3 devices. Will add a check on my end. But shouldn't bring down the app and instead fail gracefully on your end as well.

@wiktor wiktor changed the title java.lang.NoClassDefFoundError Framework should not crash on Androids <4.3 May 13, 2014
@wiktor
Copy link
Contributor

wiktor commented May 13, 2014

You are correct. Changed title of this bug to track it better.

@wiktor wiktor added the bug label May 13, 2014
@francisdb
Copy link

This is actually crashing the app so high priority!
Some more context:

06-12 10:26:12.417    1610-1610/com.waylay.client I/dalvikvm﹕ Failed resolving Lcom/estimote/sdk/service/BeaconService$InternalLeScanCallback; interface 39 'Landroid/bluetooth/BluetoothAdapter$LeScanCallback;'
06-12 10:26:12.417    1610-1610/com.waylay.client W/dalvikvm﹕ Link of class 'Lcom/estimote/sdk/service/BeaconService$InternalLeScanCallback;' failed
06-12 10:26:12.417    1610-1610/com.waylay.client E/dalvikvm﹕ Could not find class 'com.estimote.sdk.service.BeaconService$InternalLeScanCallback', referenced from method com.estimote.sdk.service.BeaconService.<init>
06-12 10:26:12.417    1610-1610/com.waylay.client W/dalvikvm﹕ VFY: unable to resolve new-instance 895 (Lcom/estimote/sdk/service/BeaconService$InternalLeScanCallback;) in Lcom/estimote/sdk/service/BeaconService;
06-12 10:26:12.437    1610-1610/com.waylay.client I/dalvikvm﹕ Could not find method android.bluetooth.BluetoothAdapter.startLeScan, referenced from method com.estimote.sdk.service.BeaconService.startScanning
06-12 10:26:12.437    1610-1610/com.waylay.client W/dalvikvm﹕ VFY: unable to resolve virtual method 229: Landroid/bluetooth/BluetoothAdapter;.startLeScan (Landroid/bluetooth/BluetoothAdapter$LeScanCallback;)Z
06-12 10:26:12.447    1610-1610/com.waylay.client I/dalvikvm﹕ Could not find method android.bluetooth.BluetoothAdapter.stopLeScan, referenced from method com.estimote.sdk.service.BeaconService.stopScanning
06-12 10:26:12.447    1610-1610/com.waylay.client W/dalvikvm﹕ VFY: unable to resolve virtual method 230: Landroid/bluetooth/BluetoothAdapter;.stopLeScan (Landroid/bluetooth/BluetoothAdapter$LeScanCallback;)V
06-12 10:26:12.457    1610-1610/com.waylay.client E/dalvikvm﹕ Could not find class 'android.bluetooth.BluetoothManager', referenced from method com.estimote.sdk.service.BeaconService.onCreate
06-12 10:26:12.457    1610-1610/com.waylay.client W/dalvikvm﹕ VFY: unable to resolve check-cast 46 (Landroid/bluetooth/BluetoothManager;) in Lcom/estimote/sdk/service/BeaconService;
06-12 10:26:12.457    1610-1610/com.waylay.client I/dalvikvm﹕ Failed resolving Lcom/estimote/sdk/service/BeaconService$InternalLeScanCallback; interface 39 'Landroid/bluetooth/BluetoothAdapter$LeScanCallback;'
06-12 10:26:12.467    1610-1610/com.waylay.client W/dalvikvm﹕ Link of class 'Lcom/estimote/sdk/service/BeaconService$InternalLeScanCallback;' failed
06-12 10:26:12.467    1610-1610/com.waylay.client W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2deb288)
06-12 10:26:12.477    1610-1610/com.waylay.client E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NoClassDefFoundError: com.estimote.sdk.service.BeaconService$InternalLeScanCallback
            at com.estimote.sdk.service.BeaconService.<init>(BeaconService.java:122)
            at java.lang.Class.newInstanceImpl(Native Method)
            at java.lang.Class.newInstance(Class.java:1319)
            at android.app.ActivityThread.handleCreateService(ActivityThread.java:2344)
            at android.app.ActivityThread.access$1600(ActivityThread.java:130)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1277)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4745)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)

@keithkml
Copy link

Any update on this? Is there any workaround?

@francisdb
Copy link

@keithkml this is #48 :-)

@keithkml
Copy link

Oops, I meant: isn't this a duplicate of #25 ?

@keithkml
Copy link

This is preventing me from using the Estimote SDK in my app.

@wiktor
Copy link
Contributor

wiktor commented Aug 28, 2014

Just check in your app version of Android before using it.

On Thu, Aug 28, 2014 at 5:23 PM, keithkml [email protected]
wrote:

This is preventing me from using the Estimote SDK in my app.

Reply to this email directly or view it on GitHub:
#48 (comment)

@keithkml
Copy link

That won't work, as the service is loaded in the AndroidManifest.xml, not in code. Any other ideas?

@francisdb
Copy link

Not sure what you mean by that but I need my app to e compatible with older devices, the sdk should just disable itself but not crash my app.

@wiktor
Copy link
Contributor

wiktor commented Aug 28, 2014

In AndroidManifest.xml you would need to have it declared nevertheless. It is not loaded automatically.

You should check BeaconManager#hasBluetooth before interacting with beacons. That's all is needed.

@keithkml
Copy link

Hi @wiktor, just having it declared as a service causes these errors. I am not interacting with beacons without checking the SDK version and BeaconManager.

This line being present in my AndroidManifest.xml causes my app to crash on Android phones with SDK 4.2 and earlier, with the exception mentioned in this issue description.

Please tell me how to modify my AndroidManifest.xml to prevent this crash on <4.3 devices.

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

@wiktor
Copy link
Contributor

wiktor commented Aug 28, 2014

What's the stack trace?

On Thu, Aug 28, 2014 at 6:54 PM, keithkml [email protected]
wrote:

Hi @wiktor, just having it declared as a service causes these errors. I am not interacting with beacons without checking the SDK version and BeaconManager.
This line being present in my AndroidManifest.xml causes my app to crash on Android phones with SDK 4.2 and earlier, with the exception mentioned in this issue description.
Please tell me how to modify my AndroidManifest.xml to prevent this crash on <4.3 devices.
<service android:name="com.estimote.sdk.service.BeaconService"

android:exported="false"

Reply to this email directly or view it on GitHub:
#48 (comment)

@keithkml
Copy link

Well now I can't reproduce it... I'm wondering if that issue appears to be in BeaconService, but is actually caused by attempting to load com.estimote.sdk.BeaconManager via Class.forName. Normally when I'm calling into code that may not be supported on earlier SDK's, I simply put it in a try block. But it looks like that doesn't work for Estimote code.

@francisdb
Copy link

if(beaconManager.hasBluetooth()) {
  ...
}

indeed seems to avoid this crasher. But I still think this could be handled better by the sdk.

francisdb added a commit to waylayio/WaylayAndroidClient that referenced this issue Sep 1, 2014
@wiktor
Copy link
Contributor

wiktor commented Sep 1, 2014

You are right, it should be handled more gracefully.

On Mon, Sep 1, 2014 at 9:39 AM, Francis De Brabandere
[email protected] wrote:

if(beaconManager.hasBluetooth()) {
  ...
}

indeed seems to avoid this crasher. But I still think this could be handled better by the sdk.

Reply to this email directly or view it on GitHub:
#48 (comment)

@Almaas
Copy link

Almaas commented Sep 8, 2014

Hi, I think my error might be related to this. I am trying to use the android sdk for the Estimote Beacons. I have followed all the steps. I am using a Android 4,3 device, but it all just crashes. Could anyone advice me as to how they overcame this??

Thanks!

@francisdb
Copy link

"it all jat crashes" is never a good way to get help.

What error stack traces do you get?
What are you doing in your code?
What android version/device are you testing on?
...

If you stack trace does not look like the above ones you probably should open a different ticket/try some other way to get help.

@Almaas
Copy link

Almaas commented Sep 8, 2014

Hi @francisdb ,
Thank you for the reply!
-I have not changed the code apart from just followed the steps(add estimote-sdk-preview.jar to libs,add permission to AndroidManifest.xml, and import the demos).
-I am testing on a Android 4.3(Samsung S3).
-When I run a alert appears on the device which states" Unfortunately ,Estimote Demos has stopped".
-The following is what the logcat shows when I run the project:

09-08 15:42:44.964: E/AndroidRuntime(10644): FATAL EXCEPTION: main
09-08 15:42:44.964: E/AndroidRuntime(10644): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.estimote.examples.demos/com.estimote.examples.demos.AllDemosActivity}: java.lang.ClassNotFoundException: Didn't find class "com.estimote.examples.demos.AllDemosActivity" on path: /data/app/com.estimote.examples.demos-1.apk
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219)
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.app.ActivityThread.access$700(ActivityThread.java:159)
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.os.Handler.dispatchMessage(Handler.java:99)
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.os.Looper.loop(Looper.java:137)
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.app.ActivityThread.main(ActivityThread.java:5419)
09-08 15:42:44.964: E/AndroidRuntime(10644): at java.lang.reflect.Method.invokeNative(Native Method)
09-08 15:42:44.964: E/AndroidRuntime(10644): at java.lang.reflect.Method.invoke(Method.java:525)
09-08 15:42:44.964: E/AndroidRuntime(10644): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209)
09-08 15:42:44.964: E/AndroidRuntime(10644): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025)
09-08 15:42:44.964: E/AndroidRuntime(10644): at dalvik.system.NativeStart.main(Native Method)
09-08 15:42:44.964: E/AndroidRuntime(10644): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.estimote.examples.demos.AllDemosActivity" on path: /data/app/com.estimote.examples.demos-1.apk
09-08 15:42:44.964: E/AndroidRuntime(10644): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)
09-08 15:42:44.964: E/AndroidRuntime(10644): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-08 15:42:44.964: E/AndroidRuntime(10644): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
09-08 15:42:44.964: E/AndroidRuntime(10644): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
09-08 15:42:44.964: E/AndroidRuntime(10644): ... 11 more

@wiktor
Copy link
Contributor

wiktor commented Sep 8, 2014

@wiktor wiktor closed this as completed Sep 8, 2014
@smaspe
Copy link

smaspe commented Sep 29, 2014

The issue is caused by

09-29 11:13:00.758: E/dalvikvm(16177): Could not find class 'android.bluetooth.BluetoothManager', referenced from method com.estimote.sdk.service.BeaconService.onCreate

Because the device is API<18, meaning no BluetoothManager there.

The solution @wiktor suggested

if(beaconManager.hasBluetooth()) {

Does work, but I would like to also ask for integrating this test in the SDK.

Could this issue be linked to a change request? Or at least be included in the quick start?

@wiktor
Copy link
Contributor

wiktor commented Sep 30, 2014

Suggestion noted. Thanks.

On Mon, Sep 29, 2014 at 5:22 PM, njzk2 [email protected] wrote:

The issue is caused by
09-29 11:13:00.758: E/dalvikvm(16177): Could not find class 'android.bluetooth.BluetoothManager', referenced from method com.estimote.sdk.service.BeaconService.onCreate
Because the device is API<18, meaning no BluetoothManager there.
The solution @wiktor suggested
if(beaconManager.hasBluetooth()) {
Does work, but I would like to also ask for integrating this test in the SDK.

Could this issue be linked to a change request? Or at least be included in the quick start?

Reply to this email directly or view it on GitHub:
#48 (comment)

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

No branches or pull requests

6 participants