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

ClassNotFoundException: com.yasirkula.unity.NativeFilePickerPermissionReceiver #31

Closed
jakedowns opened this issue Dec 2, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@jakedowns
Copy link

Description of the bug

I tried using the Asset Store version of the plugin, and downloading from this repo.

When I try to trigger the file-picker on Android, I get the following error:

public void promptUserFilePicker()
    {
#if UNITY_ANDROID
        // Use MIMEs on Android
        string[] fileTypes = new string[] { "video/*" };
#else
		// Use UTIs on iOS
		string[] fileTypes = new string[] { "public.movie" };
#endif

        // Pick image(s) and/or video(s)
        NativeFilePicker.Permission permission = NativeFilePicker.PickFile((path) =>
        {
            if (path == null)
                Debug.Log("Operation cancelled");
            else
            {
                Debug.Log("Picked file: " + path);
                Open(path);
            }
        }, fileTypes);

        _ShowAndroidToastMessage($"Permission result: {permission}");
        Debug.Log("Permission result: " + permission);
    }

Reproduction steps

If possible, providing reproduction steps would be very helpful while pinpointing the issue. You can also post screenshots if you think they would be helpful.

Platform specs

Please provide the following info if this is a Unity 3D repository.

  • Unity version: 2021.3.11f1*
  • Platform: Android
  • Device: Samsung Galaxy S10 5G UW, SM-G981V, Android 12, One UI 4.1
  • How did you download the plugin: tried Asset Store, and Github
12-01 18:12:46.955: E/Unity(19439): AndroidJavaException: java.lang.ClassNotFoundException: com.yasirkula.unity.NativeFilePickerPermissionReceiver
12-01 18:12:46.955: E/Unity(19439): java.lang.ClassNotFoundException: com.yasirkula.unity.NativeFilePickerPermissionReceiver
12-01 18:12:46.955: E/Unity(19439): 	at java.lang.Class.classForName(Native Method)
12-01 18:12:46.955: E/Unity(19439): 	at java.lang.Class.forName(Class.java:454)
12-01 18:12:46.955: E/Unity(19439): 	at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
12-01 18:12:46.955: E/Unity(19439): 	at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
12-01 18:12:46.955: E/Unity(19439): 	at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
12-01 18:12:46.955: E/Unity(19439): 	at android.os.Handler.dispatchMessage(Handler.java:102)
12-01 18:12:46.955: E/Unity(19439): 	at android.os.Looper.loopOnce(Looper.java:226)
12-01 18:12:46.955: E/Unity(19439): 	at android.os.Looper.loop(Looper.java:313)
12-01 18:12:46.955: E/Unity(19439): 	at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
12-01 18:12:46.955: E/Unity(19439): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.yasirkula.unity.NativeFilePickerPermissionReceiver" on path: DexPathList[[zip file "/data/app/~~2SxF3bRkAF4GEX2SPy-XmA==/com.jakedowns.nrealDemo-zZGyxBZwlPgN4jf7VdhXbw==/base.apk"],nativeLibraryDirectories=[/data/app/~~2SxF3bRkAF4GEX2SPy-XmA==/com.jakedow
@jakedowns jakedowns added the bug Something isn't working label Dec 2, 2022
@yasirkula
Copy link
Owner

Looks like the class is stripped but I don't know how because the embedded Proguard file specifically tells the Gradle compiler not to strip any of the classes. I don't believe you can reproduce this issue on a new project, so something is interfering with Gradle build pipeline in a way I'm unfamiliar with.

@jakedowns
Copy link
Author

Ah, thank you, that was the issue, added to my Exported proguard-unity.txt

-keep class com.yasirkula.unity.* { *; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants