google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.95k stars 1.22k forks source link

ARCore-LocationProvider: Exception during FLP api client construction: com.google.android.gms.location.LocationServices #1186

Closed agGitHub closed 3 years ago

agGitHub commented 3 years ago

SPECIFIC ISSUE ENCOUNTERED

My app doesn't use Location services. I get the following very weird bug that happens randomly. I have no memory issues.

Anybody can tell how to solve this issue ?

Thanks!

Other developers had this issue: https://stackoverflow.com/questions/61723670/getting-location-service-error-while-using-ar-core

2021-01-12 21:00:59.008 17243-17243/? E/ARCore-LocationProvider: Exception during FLP api client construction: com.google.android.gms.location.LocationServices
    java.lang.ClassNotFoundException: com.google.android.gms.location.LocationServices
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at com.google.ar.core.services.LocationProvider.loadClass(PG:1)
        at com.google.ar.core.services.LocationProvider.setupFusedLocationProviderApi(PG:1)
        at com.google.ar.core.services.LocationProvider.<init>(PG:7)
        at com.google.ar.core.Session.nativeCreateSessionAndWrapperWithFeatures(Native Method)
        at com.google.ar.core.Session.<init>(Session.java:11)
        at com.google.ar.core.Session.<init>(Session.java:4)
        at com.xxxxxxxxxx.HelloArActivity.onResume(HelloArActivity.java:1139)
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1456)
        at android.app.Activity.performResume(Activity.java:8317)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4835)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4878)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2276)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:246)
        at android.app.ActivityThread.main(ActivityThread.java:8414)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.location.LocationServices" on path: DexPathList[[zip file "/data/app/~~81LzmRYpMRyk0mO630dUUw==/com.xxxxxxxxxx-u1R8ib6Vt3giSSorKLWHfQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~81LzmRYpMRyk0mO630dUUw==/com.xxxxxxxxxx-u1R8ib6Vt3giSSorKLWHfQ==/lib/arm64, /data/app/~~81LzmRYpMRyk0mO630dUUw==/com.xxxxxxxxxx-u1R8ib6Vt3giSSorKLWHfQ==/base.apk!/lib/arm64-v8a, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:454) 
        at com.google.ar.core.services.LocationProvider.loadClass(PG:1) 
        at com.google.ar.core.services.LocationProvider.setupFusedLocationProviderApi(PG:1) 
        at com.google.ar.core.services.LocationProvider.<init>(PG:7) 
        at com.google.ar.core.Session.nativeCreateSessionAndWrapperWithFeatures(Native Method) 
        at com.google.ar.core.Session.<init>(Session.java:11) 
        at com.google.ar.core.Session.<init>(Session.java:4) 
        at com.xxxxxxxxxx.HelloArActivity.onResume(HelloArActivity.java:1139) 
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1456) 
        at android.app.Activity.performResume(Activity.java:8317) 
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4835) 
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4878) 
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) 
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2276) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:246) 
        at android.app.ActivityThread.main(ActivityThread.java:8414) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) 
2021-01-12 21:00:59.187 723-723/? E/ExynosCamera: Build Date is (Dec 23 2020) (10:44:06) Process 64 bit
2021-01-12 21:00:59.191 723-723/? E/FMQ: grantorIdx must be less than 3
2021-01-12 21:00:59.192 723-723/? E/FMQ: grantorIdx must be less than 3
2021-01-12 21:00:59.192 895-15061/? E/FMQ: grantorIdx must be less than 3
2021-01-12 21:00:59.193 895-15061/? E/FMQ: grantorIdx must be less than 3
2021-01-12 21:00:59.193 895-15061/? E/Camera2-FrameProcessorBase: FrameProcessorBase: created
2021-01-12 21:00:59.193 895-15061/? E/Camera2-FrameProcessorBase: registerListener: Registering listener for frame id range 0 - 2147483647
2021-01-12 21:00:59.197 7080-7080/? E/SecHAL: nfc_hal_write: [Cmd]Send EVT data_sending_flag = true, return size=4!!
2021-01-12 21:00:59.226 7080-8489/? E/SecHAL: nfc_data_callback: [Cmd]Received a response packet : data_sending_flag = false!!
2021-01-12 21:00:59.228 6949-8430/? E/libnfc_nci: [ERROR:nfc_ncif.cc(1487)] nfc_ncif_proc_deactivate - evt_data.deactivate.reason 0, nfc_cb.deact_reason = 0
2021-01-12 21:00:59.230 7080-7080/? E/SecHAL: nfc_hal_write: [Cmd]Send EVT data_sending_flag = true, return size=a!!
2021-01-12 21:00:59.241 7080-8489/? E/SecHAL: nfc_data_callback: [Cmd]Received a response packet : data_sending_flag = false!!
2021-01-12 21:00:59.463 723-18436/? E/ExynosCameraParameters: [CAM(0)][Back_0]-(m_getSetfileYuvRange_Flagship[2895]):CurrentState (0x 100), currentSetfile(67), currentScenario(0)
2021-01-12 21:00:59.463 723-18436/? E/ExynosCameraParameters: [CAM(0)][Back_0]-(m_getSetfileYuvRange_Flagship[2895]):CurrentState (0x 101), currentSetfile(69), currentScenario(0)
2021-01-12 21:00:59.465 1149-6842/? E/JavaBinder: *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
    java.lang.RuntimeException: android.os.RemoteException: Couldn't get ApplicationInfo for package android.frameworks.sensorservice@1.0::ISensorManager
        at android.os.Parcel.writeException(Parcel.java:2170)
        at android.os.Binder.execTransactInternal(Binder.java:1214)
        at android.os.Binder.execTransact(Binder.java:1159)
     Caused by: android.os.RemoteException: Couldn't get ApplicationInfo for package android.frameworks.sensorservice@1.0::ISensorManager
        at com.android.server.pm.PackageManagerService$PackageManagerNative.getTargetSdkVersionForPackage(PackageManagerService.java:29331)
        at android.content.pm.IPackageManagerNative$Stub.onTransact(IPackageManagerNative.java:255)
        at android.os.Binder.execTransactInternal(Binder.java:1195)
        at android.os.Binder.execTransact(Binder.java:1159) 
2021-01-12 21:00:59.473 723-18436/? E/SensorListener: Sensor(16) is not enabled yet!
2021-01-12 21:00:59.473 723-18436/? E/SensorListener: Sensor(16) is not enabled yet!
2021-01-12 21:00:59.474 723-18436/? E/SensorListener: Sensor(16) is not enabled yet!
2021-01-12 21:00:59.474 723-18436/? E/SensorListener: Sensor(16) is not enabled yet!
2021-01-12 21:00:59.475 723-18436/? E/SensorListener: Sensor(16) is not enabled yet!
2021-01-12 21:00:59.485 723-18437/? E/SensorListener: ERR(initSensor[908]):failed to open hrm alc sensor's name
2021-01-12 21:00:59.632 7219-7219/? E/pageboostd: Received HALT command code 2
2021-01-12 21:01:00.007 17243-18383/? E/native: motion_tracking_context.cc:1064 Unable to find measurements corresponding to VIO status at timestamp 36442995907742.

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

Random issue with an app using ARCore.

WORKAROUNDS (IF ANY)

No found.

ADDITIONAL COMMENTS

Please fix this problem!

devbridie commented 3 years ago

Does this error lead to a crash? I think it's noisy logcat output that looks scary because it's tagged as an Error.

jainet commented 3 years ago

I have a similar event. The app crashes when launched in an emulator (Pixel 4).

Comtister commented 3 years ago

Hello, I have the same problem, you could find a solution ?

adjeiv commented 3 years ago

Hi, I was running into this issue earlier today and managed to fix it (perhaps fix - or perhaps just use the right configuration) I'm running this on the emulator also - Pixel 3a API 29. In build.gradle (app) I have included:

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'

It is interesting that the quickstart does not mention location services, though. I hope this helps.

devbridie commented 3 years ago

If this is a crash, please upload a crash log and stack trace. I see this stack trace in normal app operation.

Although including the play-services-location jar solves the message, there isn't an apparent link to the ClassNotFoundException and a crash.

I can't reproduce the crash you've mentioned on the API 29 emulator either; could you share the AVD details?

agGitHub commented 3 years ago

It seems that this bug doesn't induce a crash. By the way, you can see in my log that there is another exception :

2021-01-12 21:00:59.465 1149-6842/? E/JavaBinder: *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
    java.lang.RuntimeException: android.os.RemoteException: Couldn't get ApplicationInfo for package android.frameworks.sensorservice@1.0::ISensorManager
        at android.os.Parcel.writeException(Parcel.java:2170)
        at android.os.Binder.execTransactInternal(Binder.java:1214)
        at android.os.Binder.execTransact(Binder.java:1159)
     Caused by: android.os.RemoteException: Couldn't get ApplicationInfo for package android.frameworks.sensorservice@1.0::ISensorManager
        at com.android.server.pm.PackageManagerService$PackageManagerNative.getTargetSdkVersionForPackage(PackageManagerService.java:29331)
        at android.content.pm.IPackageManagerNative$Stub.onTransact(IPackageManagerNative.java:255)
        at android.os.Binder.execTransactInternal(Binder.java:1195)
        at android.os.Binder.execTransact(Binder.java:1159) 

What is this exception (that doesn't induce a crash also) ? How to fix it?

Thanks!

Note that adding the permissions mentioned by @adjeiv didn't remove these two exceptions for me. I also tried to add:

implementation 'com.google.android.gms:play-services-auth:19.0.0'

and it didn't solve the issue either.

devbridie commented 3 years ago

Couldn't get ApplicationInfo for package android.frameworks.sensorservice@1.0::ISensorManager

I'm seeing this exception in logs during normal operation as well (unfortunately none I can share besides this filament issue, so I don't think this is a issue that needs to be solved.

We're continuing to work on the noisiness of ARCore logging to make sure that relevant info isn't drowned out by non-problems like these.

GiacomoRavaioli commented 3 years ago

@agGitHub I'm encountering the same exception that I believe is raised when the ARCore Session is created by the ArFragment or by calling: Session(context)

Here what it logs in my case:

W/ARCore-ContextUtils: The API key for use with the Google AR service could not be obtained! E/ARCore-LocationProvider: Exception during FLP api client construction: com.google.android.gms.location.LocationServices java.lang.ClassNotFoundException: com.google.android.gms.location.LocationServices at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at com.google.ar.core.services.LocationProvider.loadClass(PG:1) at com.google.ar.core.services.LocationProvider.setupFusedLocationProviderApi(PG:1) at com.google.ar.core.services.LocationProvider.(PG:7) at com.google.ar.core.Session.nativeCreateSessionAndWrapperWithFeatures(Native Method) at com.google.ar.core.Session.(SourceFile:11) at com.google.ar.core.Session.(SourceFile:4)

I think the problem is in the warning, with ARCore not being able to obtain the key; although I'm using implementation 'com.google.android.gms:play-services-auth:19.0.0' and I've tried to define the APIKey in the Manifest.

kanoe92 commented 3 years ago

I had similar problem with LocationProvider and I didn't use location inside my application. Accidentally while adding image into augmented image database, I was using name which was null.

AugmentedImageDatabase augmentedImageDatabase = new AugmentedImageDatabase(session);
augmentedImageDatabase.addImage(name /*was null*/, bitmap, size);
Liu-ming-hui commented 3 years ago

I had this problem too, and although it didn't crash, it caused me a lot of trouble. My App has been online for a long time. One day, I suddenly received feedback that the model I identified was not the expected Angle. It was sudden, and the surprise was that it hadn't happened before. And it runs fine on the iPhone. 2021-02-26 13:09:02.080 2045-2074/com.qianxi.AF E/AR: Cannot setMode to AR before Camera is initialized 2021-02-26 13:09:02.416 2045-2074/com.qianxi.AF E/AR: VideoBackgroundConfig with screen size of zero received, skipping config step 2021-02-26 13:09:04.391 2045-2074/com.qianxi.AF E/ARCore-LocationProvider: Exception during FLP api client construction: com.google.android.gms.location.LocationServices What's also interesting is that Vuforia's watermark placement has become a bit weird WechatIMG434

1UCodes commented 3 years ago

I have a similar event. The app crashes when launched in an emulator (Pixel 4).

Do you got resolved? I am too facing same problem.....App closes upon opening

Berenice2018 commented 3 years ago

I get the same error while running my app on a real device. My app uses location services and the ARCore in Unity (ARFoundation) and crashes. Has anyone found a solution? arloc-2020_1_17-loc3_5-warn.pdf

UPDATE: I think my crash was not caused by that error message, because it occured later. After disabling multi-threaded rendering, I have not been able to reproduce my crash. It does not work well with ARCore.

1UCodes commented 3 years ago

Still issue is opened not yet solved. I didn't use any location services in my app though it closes immediately

Liu-ming-hui commented 3 years ago

If I import both the ARCore and Vuforia packages in Unity, I get the same error when I package the APK to run. If you have only one of these two, you won't get an error. This error causes Vuforia to skip screen adaption errors and some other problems

devbridie commented 3 years ago

Exception during FLP api client construction: com.google.android.gms.location.LocationServices will always appear if you do not have a com.google.android.gms.location on your classpath. However, this will not cause a crash. There is no reason to add this dependency if you do not need it.

I'm working to remove this error in the next release, since it seems to cause a bunch of confusion. To be clear: if your app is crashing, this message is unrelated. If you have an error that leads to a crash, please feel free to open a new issue with the relevant information and the crash logs.

1UCodes commented 3 years ago

Yes it's asking location dependencies and I did a experiment for larger app I mean I have added 24 3D models in my app

And then I tried only 2 models for new project of same 3D models and it worked for smaller app and it didn't crash/closed app. Works fine for limited assets app

Both used same gradle versions and same dependencies and same classpaths with no gms services.

Arcore SDK used is 1.18.0 also tried with 1.23.0 Gradle : 3.5.4 (latest) Sceneform tools : 1.15.0

BoxedFruits commented 3 years ago

I get the same error when trying to run the Hello_Ar_Java example program in the android emulator.

ddalai-pk commented 3 years ago

I am getting the same issue. why this ticket closed.

ghost commented 3 years ago

I have this very problem and the only exception in logcat is this message about LocationServices. using different solutions in this thread or others in stackoverflow and other websites just didn't work! As I can see this issue is not stably fixed so is not closed! I get this error on a sample project without any modification, but I get the same error in both Fresh project and Google's sample "HelloAr Java"

1UCodes commented 3 years ago

Yeah I am developing 3 different ARCore projects past three months. Due to this problem they all are in pending. No words for now🙁

Actually google have to regret their words "hardware is hard" bcoz for them software is also hard

ghost commented 3 years ago

Yeah I am developing 3 different ARCore projects past three months. Due to this problem they all are in pending. No words for nowslightly_frowning_face

Actually google have to regret their words "hardware is hard" bcoz for them software is also hard

Are you even able to run "HelloAr Java" app provided by arcore-android-sdk/samples ? It has got me days and no clue!

1UCodes commented 3 years ago

No...the same location services issue

devbridie commented 3 years ago

To reiterate:

alireza021 commented 3 years ago

I am still facing this issue

1UCodes commented 3 years ago

I stopped my #ARCore app development 😐 due to that issue

alireza021 commented 3 years ago

To reiterate:

  • This message should not affect how your app behaves. Though it appears in logcat as a red message, this can be a part of normal app behavior. This message will be level I in the next release of ARCore.
  • Though adding a dependency on gms may hide the message, you probably won't see a change in behavior in the app.

If you're experiencing a crash or other problem, please open a new issue containing a detailed crash trace.

Unfortunately, it is affecting the way my app behaves. Even though it is not causing the app to crash, it is still causing issues on Android that I do not have on iOS.

devbridie commented 3 years ago

The reported message will become logged as level I in the next release of ARCore, instead of E.

When this message appears, it means that location services cannot be found. However, ARCore only uses it in select conditions and does not require them to function. Though adding a dependency on gms may hide the message, you probably won't see a change in behavior in the app.

If you're experiencing a crash or other problem, please open a new issue following the issue guidelines that contains a detailed crash trace.