gree / unity-webview

zlib License
2.26k stars 689 forks source link

Exception: JNI: Init'd AndroidJavaClass with null ptr! #252

Open rpassareti opened 6 years ago

rpassareti commented 6 years ago

I copy the project, open the example, but when i hit play, gives me this error:

JNI: Init'd AndroidJavaClass with null ptr! UnityEngine.AndroidJavaClass..ctor (IntPtr jclass) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:622) UnityEngine.AndroidJavaObject.get_JavaLangClass () (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:600) UnityEngine.AndroidJavaObject.FindClass (System.String name) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:591) UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String className, System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:193) UnityEngine.AndroidJavaObject..ctor (System.String className, System.Object[] args) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/AndroidJavaBindings.gen.cs:18) WebViewObject.Init (System.Action1 cb, Boolean transparent, System.String ua, System.Action1 err, System.Action`1 ld, Boolean enableWKWebView) (at Assets/Plugins/WebViewObject.cs:298) SampleWebView+c__Iterator0.MoveNext () (at Assets/Scripts/SampleWebView.cs:33) UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

KojiNakamaru commented 6 years ago

You cannot run in the Android mode on Editor. Especially Windows Editor is currently unsupported. You should still be able to build and run your code for Android (actual devices).

rpassareti commented 6 years ago

there is no way to configure the way that the browse would be on the mobile? or see how it would be? like, i'm creating an app with web and unity, and I want that the web communicate with unity and disable, and active other things is that possible?

KojiNakamaru commented 6 years ago

You can utilize Unity.call() to send a string from w to unity. From unity to web, you can utilize EvaluateJS(). Could you please check the sample app.