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

can't run in android platform, report null pointer error, how to fix it #355

Open
zhouzh1800 opened this issue Sep 18, 2018 · 2 comments
Open

Comments

@zhouzh1800
Copy link

09-18 11:09:58.346 16305-16305/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.star.webviewtest, PID: 16305
java.lang.Error: FATAL EXCEPTION [main]
Unity version : 5.6.1p4
Device model : samsung SM-N920S
Device fingerprint: samsung/noblelteskt/noblelteskt:7.0/NRD90M/N920SKSU2DQL1:user/release-keys

                                               Caused by: java.lang.RuntimeException: Unable to resume activity {com.star.webviewtest/net.gree.unitywebview.CUnityPlayerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.unity3d.player.k.b(boolean)' on a null object reference
                                                   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3791)
                                                   at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3832)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2994)
                                                   at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:154)
                                                   at android.app.ActivityThread.main(ActivityThread.java:6682)
                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
                                                Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.unity3d.player.k.b(boolean)' on a null object reference
                                                   at com.unity3d.player.UnityPlayer.resume(Unknown Source)
                                                   at com.unity3d.player.UnityPlayerActivity.onResume(Unknown Source)
                                                   at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1277)
                                                   at android.app.Activity.performResume(Activity.java:7088)
                                                   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3768)
                                                   at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3832) 
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2994) 
                                                   at android.app.ActivityThread.-wrap14(ActivityThread.java) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:154) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:6682) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) 
@KojiNakamaru
Copy link
Member

As 5.6.1p4 should have the fix and should not need net.gree.unitywebview.CUnityPlayerActivity, could you please adjust UnityWebViewPostprocessBuild.cs as below.

--- UnityWebViewPostprocessBuild.cs.orig	2018-09-18 13:31:47.000000000 +0900
+++ UnityWebViewPostprocessBuild.cs	2018-09-18 13:32:07.000000000 +0900
@@ -69,14 +69,14 @@
                 doc.Save(manifest);
                 Debug.LogError("adjusted AndroidManifest.xml about android:hardwareAccelerated. Please rebuild the app.");
             }
-#if UNITY_5_6_0 || UNITY_5_6_1
-            if (activity != null
-                && activity.GetAttribute("android:name") == "com.unity3d.player.UnityPlayerActivity") {
-                activity.SetAttribute("name", "http://schemas.android.com/apk/res/android", "net.gree.unitywebview.CUnityPlayerActivity");
-                doc.Save(manifest);
-                Debug.LogError("adjusted AndroidManifest.xml about android:name. Please rebuild the app.");
-            }
-#endif
+// #if UNITY_5_6_0 || UNITY_5_6_1
+//             if (activity != null
+//                 && activity.GetAttribute("android:name") == "com.unity3d.player.UnityPlayerActivity") {
+//                 activity.SetAttribute("name", "http://schemas.android.com/apk/res/android", "net.gree.unitywebview.CUnityPlayerActivity");
+//                 doc.Save(manifest);
+//                 Debug.LogError("adjusted AndroidManifest.xml about android:name. Please rebuild the app.");
+//             }
+// #endif
         }
 #endif
         if (buildTarget == BuildTarget.iOS) {

cf. #212 (comment)
cf. https://unity3d.com/unity/qa/patch-releases?version=5.6&page=2

Patch 5.6.1p4
Fixes
(916119) - Android: Fixed a regression where Banner Ads are invisible, but still clickable.

@zhouzh1800
Copy link
Author

yeah, thank you, it work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants