sceneform-android icon indicating copy to clipboard operation
sceneform-android copied to clipboard

Support for Android 14 devices

Open carlos-garcia-alm-iberia opened this issue 1 year ago • 6 comments

App is crashing in Android 14 devices.

java.lang.RuntimeException: Unable to resume activity {com.example..debug/com.google.ar.core.InstallActivity}: java.lang.SecurityException: com.example..debug: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
                                                                                                    	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4962)
                                                                                                    	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4995)
                                                                                                    	at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57)
                                                                                                    	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:180)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
                                                                                                    Caused by: java.lang.SecurityException: com.example..debug: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
                                                                                                    	at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
                                                                                                    	at android.os.Parcel.createException(Parcel.java:3041)
                                                                                                    	at android.os.Parcel.readException(Parcel.java:3024)
                                                                                                    	at android.os.Parcel.readException(Parcel.java:2966)
                                                                                                    	at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684)
                                                                                                    	at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1852)
                                                                                                    	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792)
                                                                                                    	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1780)
                                                                                                    	at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755)
                                                                                                    	at com.google.ar.core.u.d(InstallService.java:5)
                                                                                                    	at com.google.ar.core.InstallActivity.startInstaller(InstallActivity.java:3)
                                                                                                    	at com.google.ar.core.InstallActivity.onResume(InstallActivity.java:3)
                                                                                                    	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1603)
                                                                                                    	at android.app.Activity.performResume(Activity.java:8743)
                                                                                                    	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4952)
                                                                                                    	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4995) 
                                                                                                    	at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57) 
                                                                                                    	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45) 
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:180) 
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98) 
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) 
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205) 
                                                                                                    	at android.os.Looper.loop(Looper.java:294) 
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8177) 
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) 
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) 
                                                                                                    Caused by: android.os.RemoteException: Remote stack trace:
                                                                                                    	at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:13927)
                                                                                                    	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
                                                                                                    	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2720)
                                                                                                    	at android.os.Binder.execTransactInternal(Binder.java:1339)
                                                                                                    	at android.os.Binder.execTransact(Binder.java:1275)

@GarciaCarlos0702 you should be able to upgrade the dependency by manually including com.google.ar:core:1.42.0 or later:

+--- com.gorisse.thomas.sceneform:sceneform:1.23.0
|    +--- com.gorisse.thomas.sceneform:core:1.23.0
|    |    \--- com.google.ar:core:1.31.0 -> 1.43.0 (*)

itsandreramon avatar Jun 12 '24 10:06 itsandreramon

@itsandreramon Yes, I just saw that, but couldn't this lead to any new side effect with the whole library expecting to work with the older version?

@GarciaCarlos0702 yes its more like a temporary fix until this lib gets updated. it should be an easy PR though. I think most of the library does not contain any breaking changes. i could not find any in the changelog of ar core

itsandreramon avatar Jun 12 '24 12:06 itsandreramon

@itsandreramon As expected, now is not crashing cause of the registerReceiver thing. Now after updating the ar core version seems like I'm having an incompatibility issue, the same as in this issue: https://github.com/SceneView/sceneform-android/issues/463

Since in that issue the person is also using a different version for ar core

Hey @GarciaCarlos0702 @itsandreramon I am also facing the same issues with Android 14. Did you find out any solution that works.

32501729 avatar Jun 29 '24 19:06 32501729

@32501729 Hi, sadly not.

The issue is coming from this method ArCoreApk.getInstance().requestInstall

so this crash when the AR services are not installed, cause the library is registering the receiver without specifying the RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED that Android 14 needs.

As a temporary solution, what I did was check if the AR services are installed with

return ArCoreApk.getInstance()
            .checkAvailability(requireContext()) == ArCoreApk.Availability.SUPPORTED_INSTALLED

and if this return false, then I'm creating an intent to the store so the user can install the AR services, of course displaying a dialog with the proper information

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 11 '24 05:10 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Oct 18 '24 05:10 github-actions[bot]