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

Freak issue in Android #135

Open
Nicba1010 opened this issue Jul 24, 2017 · 1 comment
Open

Freak issue in Android #135

Nicba1010 opened this issue Jul 24, 2017 · 1 comment

Comments

@Nicba1010
Copy link

This is a freak issue I encountered during development of a certain android app.

This works:

return new BeaconScanner<>( // CODE CUT
                new BeaconScannerListener<Unit>() {
                    @Override
                    public void onBeaconFound(@NotNull BeaconScanner<? extends Unit> scanner,
                                              @NotNull BeaconMetaData metadata, Unit unit) {
                        //CODE CUT
                        Location location = LocationUtils.getInstance().getBestLocation();

                            LatLng latLng = new LatLng(location.getLatitude(), location
                                    .getLongitude());
                            Api.getAPI().updateData(
                                    address,
                                    location.getLongitude(),
                                    location.getLatitude()
                            ).enqueue(CALLBACK);
                        }
                    }
                });

This produces an error:

return new BeaconScanner<>( // CODE CUT
                (scanner, metadata, unit) -> {
                        //CODE CUT
                        Location location = LocationUtils.getInstance().getBestLocation();

                            LatLng latLng = new LatLng(location.getLatitude(), location
                                    .getLongitude());
                            Api.getAPI().updateData(
                                    address,
                                    location.getLongitude(),
                                    location.getLatitude()
                            ).enqueue(CALLBACK);
                });

Stacktrace:

Throwing new exception 'length=162; index=1404' with unexpected pending exception: java.lang.ArrayIndexOutOfBoundsException: length=162; index=1404
  at void project.service.SmartFindService.lambda$createScanner$0(project.service.SmartFindService, project.BeaconScanner, project.BeaconMetaData, kotlin.Unit) (SmartFindService.java:102)
  at void project.service.SmartFindService$$Lambda$1.onBeaconFound(project.BeaconScanner, project.BeaconMetaData, java.lang.Object) ((null):0)
  at void project.BeaconScanner$1.invoke(project.BeaconScanner, project.BeaconMetaData, java.lang.Object) (BeaconScanner.kt:30)
  at java.lang.Object project.BeaconScanner$1.invoke(java.lang.Object, java.lang.Object, java.lang.Object) (BeaconScanner.kt:16)
  at void project.BeaconScanner$callback$1.onScanResult(int, android.bluetooth.le.ScanResult) (BeaconScanner.kt:59)
  at void android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper$1.run() (BluetoothLeScanner.java:355)
  at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:739)
  at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
  at void android.os.Looper.loop() (Looper.java:234)
  at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:5526)
  at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
  at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:726)
  at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:616)
@luontola
Copy link
Owner

Can you create an SSCCE for reproducing this?

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

No branches or pull requests

2 participants