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

An error occured while executing doInBackground() #20

Closed
nospaceleftondevice opened this Issue Aug 21, 2014 · 9 comments

Comments

Projects
None yet
4 participants
@nospaceleftondevice

nospaceleftondevice commented Aug 21, 2014

I downloaded the binary archive and when I start transmitting beacons from my Mac my Android app crashes with;

D/BtGatt.GattService( 1457): onScanResult() - address=B8:F6:B1:11:A5:6A, rssi=-67
D/BluetoothAdapter(27151): onScanResult() - Device=B8:F6:B1:11:A5:6A RSSI=-67
D/BluetoothAdapter( 4913): onScanResult() - Device=B8:F6:B1:11:A5:6A RSSI=-67
W/QuickConnect( 4913): BleHelper.getSConnectDataFromBLE - can not resolve length info
E/AndroidRuntime(27151): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(27151): at android.os.AsyncTask$3.done(AsyncTask.java:300)
E/AndroidRuntime(27151): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime(27151): at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime(27151): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime(27151): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/AndroidRuntime(27151): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(27151): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(27151): at java.lang.Thread.run(Thread.java:841)
E/AndroidRuntime(27151): Caused by: java.lang.NullPointerException
E/AndroidRuntime(27151): at org.altbeacon.beacon.BeaconParser.fromScanData(BeaconParser.java:244)
E/AndroidRuntime(27151): at org.altbeacon.beacon.BeaconParser.fromScanData(BeaconParser.java:203)
E/AndroidRuntime(27151): at org.altbeacon.beacon.service.BeaconService$ScanProcessor.doInBackground(BeaconService.java:610)
E/AndroidRuntime(27151): at org.altbeacon.beacon.service.BeaconService$ScanProcessor.doInBackground(BeaconService.java:602)
E/AndroidRuntime(27151): at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/AndroidRuntime(27151): at java.util.concurrent.FutureTask.run(FutureTask.java:237)

Here are code snips;

activity = context.getActivity();

verifyBluetooth();
beaconManager = org.altbeacon.beacon.BeaconManager.getInstanceForApplication(activity.getApplicationContext());
beaconManager.getBeaconParsers().add(new BeaconParser().
           setBeaconLayout("**THIS STRING REDACTED SEE COMMENT BELOW**"));
beaconManager.bind(this);

....

@override
public boolean bindService(android.content.Intent intent, android.content.ServiceConnection connection, int code) {
Log.d(TAG, "bindService");
Toast.makeText(activity.getApplicationContext(),
"bind service called", Toast.LENGTH_LONG).show();
return activity.getApplicationContext().bindService(intent, connection,code);
}

@justinodwyer

This comment has been minimized.

Show comment
Hide comment
@justinodwyer

justinodwyer Aug 21, 2014

Hi there. What type of beacon are you trying to detect? As you're probably already aware, this string will match iBeacons "THIS STRING REDACTED SEE COMMENT BELOW", and you don't need to specifically construct a BeaconParser to match AltBeacons, the SDK will just find them straight out of the box.

justinodwyer commented Aug 21, 2014

Hi there. What type of beacon are you trying to detect? As you're probably already aware, this string will match iBeacons "THIS STRING REDACTED SEE COMMENT BELOW", and you don't need to specifically construct a BeaconParser to match AltBeacons, the SDK will just find them straight out of the box.

@davidgyoung

This comment has been minimized.

Show comment
Hide comment
@davidgyoung

davidgyoung Aug 21, 2014

Contributor

Apologies, @justinodwyer and @nospaceleftondevice , but in order to keep AltBeacon free of third-party intellectual property, I had to edit your comments to remove the specifics of the matching string. We are not at liberty to host information about third-party beacon implementation details without their permission.

Contributor

davidgyoung commented Aug 21, 2014

Apologies, @justinodwyer and @nospaceleftondevice , but in order to keep AltBeacon free of third-party intellectual property, I had to edit your comments to remove the specifics of the matching string. We are not at liberty to host information about third-party beacon implementation details without their permission.

@davidgyoung

This comment has been minimized.

Show comment
Hide comment
@davidgyoung

davidgyoung Aug 21, 2014

Contributor

@nospaceleftondevice, can you please tell me the version of the library you are using? It appears you have found a bug in the BeaconParser.

Contributor

davidgyoung commented Aug 21, 2014

@nospaceleftondevice, can you please tell me the version of the library you are using? It appears you have found a bug in the BeaconParser.

@nospaceleftondevice

This comment has been minimized.

Show comment
Hide comment
@nospaceleftondevice

nospaceleftondevice Aug 21, 2014

@davidgyoung, I am using android-beacon-library-2.0-beta3

nospaceleftondevice commented Aug 21, 2014

@davidgyoung, I am using android-beacon-library-2.0-beta3

@justinodwyer

This comment has been minimized.

Show comment
Hide comment
@justinodwyer

justinodwyer Aug 21, 2014

Sorry David, I completely understand, I should have linked to this Stack Overflow post in which the iBeacon string is referenced: http://stackoverflow.com/questions/25027983/is-this-the-correct-layout-to-detect-ibeacons-with-altbeacons-android-beacon-li

justinodwyer commented Aug 21, 2014

Sorry David, I completely understand, I should have linked to this Stack Overflow post in which the iBeacon string is referenced: http://stackoverflow.com/questions/25027983/is-this-the-correct-layout-to-detect-ibeacons-with-altbeacons-android-beacon-li

@nospaceleftondevice

This comment has been minimized.

Show comment
Hide comment
@nospaceleftondevice

nospaceleftondevice Aug 21, 2014

Thanks for all the good feedback, turns out I had the wrong string in setBeaconLayout. It is working now.

nospaceleftondevice commented Aug 21, 2014

Thanks for all the good feedback, turns out I had the wrong string in setBeaconLayout. It is working now.

@davidgyoung

This comment has been minimized.

Show comment
Hide comment
@davidgyoung

davidgyoung Aug 21, 2014

Contributor

It looks like the problem is caused by not specifying a power offset in your BeaconParser string. This is the offset specified by the "p" prefix below:

"m:2-3:beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"

Make sure you have a 'p' term in your expression, as it is required. Additional error checking for these required fields has been added in a1597e1

Contributor

davidgyoung commented Aug 21, 2014

It looks like the problem is caused by not specifying a power offset in your BeaconParser string. This is the offset specified by the "p" prefix below:

"m:2-3:beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"

Make sure you have a 'p' term in your expression, as it is required. Additional error checking for these required fields has been added in a1597e1

@galaxyfeeder

This comment has been minimized.

Show comment
Hide comment
@galaxyfeeder

galaxyfeeder Aug 26, 2014

Hi,
I'm having the same strackTrace, but not always. I've been working with the android-beacon-library-2.0-beta3 for 4 days more or less and it's the first time that I get this error, and I haven't changed the code that ranges the beacons or the BeaconParser implementation.

My beaconLayout implementation is the same as justinodwyer points to stackOverFlow, and I have the "p:" prefix add it.

Here is my strack trace, I think that is the same, but maybe you see something different.

E/AndroidRuntime(5193): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(5193):     at android.os.AsyncTask$3.done(AsyncTask.java:300)
E/AndroidRuntime(5193):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime(5193):     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime(5193):     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime(5193):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/AndroidRuntime(5193):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(5193):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(5193):     at java.lang.Thread.run(Thread.java:841)
E/AndroidRuntime(5193): Caused by: java.util.ConcurrentModificationException
E/AndroidRuntime(5193):     at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
E/AndroidRuntime(5193):     at org.altbeacon.beacon.service.BeaconService$ScanProcessor.doInBackground(BeaconService.java:609)
E/AndroidRuntime(5193):     at org.altbeacon.beacon.service.BeaconService$ScanProcessor.doInBackground(BeaconService.java:602)
E/AndroidRuntime(5193):     at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/AndroidRuntime(5193):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime(5193):     ... 4 more

galaxyfeeder commented Aug 26, 2014

Hi,
I'm having the same strackTrace, but not always. I've been working with the android-beacon-library-2.0-beta3 for 4 days more or less and it's the first time that I get this error, and I haven't changed the code that ranges the beacons or the BeaconParser implementation.

My beaconLayout implementation is the same as justinodwyer points to stackOverFlow, and I have the "p:" prefix add it.

Here is my strack trace, I think that is the same, but maybe you see something different.

E/AndroidRuntime(5193): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(5193):     at android.os.AsyncTask$3.done(AsyncTask.java:300)
E/AndroidRuntime(5193):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime(5193):     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime(5193):     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime(5193):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/AndroidRuntime(5193):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(5193):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(5193):     at java.lang.Thread.run(Thread.java:841)
E/AndroidRuntime(5193): Caused by: java.util.ConcurrentModificationException
E/AndroidRuntime(5193):     at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
E/AndroidRuntime(5193):     at org.altbeacon.beacon.service.BeaconService$ScanProcessor.doInBackground(BeaconService.java:609)
E/AndroidRuntime(5193):     at org.altbeacon.beacon.service.BeaconService$ScanProcessor.doInBackground(BeaconService.java:602)
E/AndroidRuntime(5193):     at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/AndroidRuntime(5193):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime(5193):     ... 4 more

davidgyoung added a commit that referenced this issue Aug 26, 2014

@davidgyoung

This comment has been minimized.

Show comment
Hide comment
@davidgyoung

davidgyoung Aug 26, 2014

Contributor

Thanks for reporting this intermittent synchronization issue. I cannot reproduce, but I have put an attempted fix in fb8a985

Contributor

davidgyoung commented Aug 26, 2014

Thanks for reporting this intermittent synchronization issue. I cannot reproduce, but I have put an attempted fix in fb8a985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment