Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Crash with Unity as a library on Android 11 #155

Open
Panicch opened this issue Nov 23, 2022 · 1 comment
Open

Crash with Unity as a library on Android 11 #155

Panicch opened this issue Nov 23, 2022 · 1 comment

Comments

@Panicch
Copy link

Panicch commented Nov 23, 2022

(Android 11, Xiaomi Redmi 9T)
Using the package in a Unity application exported as a library, the Unity activity in Android crashes when I tempt to share an image. When I'm in landscape mode the activity does not crash but it throw an exception:

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference at com.yasirkula.unity.NativeShareContentProvider.parsePathStrategy(NativeShareContentProvider.java:257) at com.yasirkula.unity.NativeShareContentProvider.getPathStrategy(NativeShareContentProvider.java:233) at com.yasirkula.unity.NativeShareContentProvider.getUriForFile(NativeShareContentProvider.java:88) at com.yasirkula.unity.NativeShare.CreateIntentFromBundle(NativeShare.java:175) at com.yasirkula.unity.NativeShareCustomShareDialog.onCreateDialog(NativeShareCustomShareDialog.java:82) at android.app.DialogFragment.onGetLayoutInflater(DialogFragment.java:417) at android.app.Fragment.performGetLayoutInflater(Fragment.java:1322) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1303) at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2436) at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2215) at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2171) at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2072) at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3062) at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:3014) at android.app.FragmentController.dispatchStart(FragmentController.java:195) at android.app.Activity.performStart(Activity.java:8185) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3603) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2181) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:8071) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011) 2022-11-23 10:47:59.932 27946-28031 I/FA: Tag Manager is not found and thus will not be used

@yasirkula
Copy link
Owner

In your merged AndroidManifest.xml, is this android:authorities value the same as your bundle identifier:

<provider
android:name="com.yasirkula.unity.NativeShareContentProvider"
android:authorities="${applicationId}.NativeShareContentProvider"
android:exported="false"
android:grantUriPermissions="true" />

And can you check if replacing NativeShare.aar with the one inside this zip archive resolves the issue without any side effects?

yasirkula added a commit that referenced this issue Dec 10, 2022
… some apps on newest Android versions

- Potential bugfix for crash in Unity as a Library apps (#155)
- Added NativeShare.Clear function
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants