gpt4 book ai didi

javascript - 当方向改变时,Phonegap App 在 Galaxy Note 上崩溃

转载 作者:行者123 更新时间:2023-11-29 01:59:08 27 4
gpt4 key购买 nike

我有几个完整的 phonegap 应用程序,功能齐全。我已经尝试了我可以访问的整套设备,但它不能在我的 galaxy note 上运行。这是一个全新的设备,我可以运行 native 应用程序,但是每当我运行任何 phonegap 应用程序时,我都会黑屏并且应用程序关闭。没有崩溃,没有警报,什么都没有。

(我删除了这里的日志,因为它们不相关)

编辑

我已经找到了这个问题,它在方向改变时有效。一旦我统计我的 Activity ,它就会将方向设置为纵向。

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

所以我删除了那条车道,激活了旋转设备时更改方向的选项。现在,当我启动应用程序时,它会运行,但当我旋转它时,它会崩溃。我不知道为什么。我的 js 代码中有几个警报,但没有一个被触发。有趣的是,当我旋转设备时,cordova 默认应用程序也会崩溃。您可以在下面找到这两个日志。

关于如何解决这个问题有什么建议吗?

Droidgap 示例日志:

11-27 12:41:15.750: D/DroidGap(9129): Paused the application!
11-27 12:41:15.750: D/CordovaWebView(9129): Handle the pause
11-27 12:41:15.750: D/CordovaWebView(9129): >>> loadUrlNow()
11-27 12:41:15.750: D/webkit(9129): Firewall not null
11-27 12:41:15.750: D/webkit(9129): euler: isUrlBlocked = false
11-27 12:41:15.760: D/DroidGap(9129): onDestroy()
11-27 12:41:15.760: D/CordovaWebView(9129): >>> loadUrlNow()
11-27 12:41:15.760: D/webkit(9129): Firewall not null
11-27 12:41:15.765: D/webkit(9129): euler: isUrlBlocked = false
11-27 12:41:15.765: D/CordovaWebView(9129): >>> loadUrlNow()
11-27 12:41:15.765: D/webkit(9129): Firewall not null
11-27 12:41:15.765: D/webkit(9129): euler: isUrlBlocked = false
11-27 12:41:15.775: D/DroidGap(9129): DroidGap.onCreate()
11-27 12:41:15.780: I/webclipboard(9129): clipservice: android.sec.clipboard.ClipboardExManager@4149bc80
11-27 12:41:15.785: D/CordovaWebView(9129): Origin to allow: http://127.0.0.1*
11-27 12:41:15.785: D/CordovaWebView(9129): Origin to allow: .*
11-27 12:41:15.785: I/CordovaLog(9129): Found log level DEBUG
11-27 12:41:15.785: I/CordovaLog(9129): Changing log level to DEBUG(3)
11-27 12:41:15.785: I/CordovaLog(9129): Found preference for useBrowserHistory=false
11-27 12:41:15.785: D/CordovaLog(9129): Found preference for useBrowserHistory=false
11-27 12:41:15.785: I/CordovaLog(9129): Found preference for exit-on-suspend=false
11-27 12:41:15.785: D/CordovaLog(9129): Found preference for exit-on-suspend=false
11-27 12:41:15.785: D/JsMessageQueue(9129): Set native->JS mode to 1
11-27 12:41:15.785: D/DroidGap(9129): DroidGap.init()
11-27 12:41:15.790: D/CordovaWebView(9129): >>> loadUrl(file:///android_asset/www/index.html)
11-27 12:41:15.790: D/PluginManager(9129): init()
11-27 12:41:15.795: D/CordovaWebView(9129): >>> loadUrlNow()
11-27 12:41:15.800: D/DroidGap(9129): Resuming the App
11-27 12:41:15.800: D/CordovaLog(9129): JSCallback Error: Request failed with status 0
11-27 12:41:15.800: D/CordovaLog(9129): file:///android_asset/www/cordova-2.1.0.js: Line 3743 : JSCallback Error: Request failed with status 0
11-27 12:41:15.800: I/Web Console(9129): JSCallback Error: Request failed with status 0 at file:///android_asset/www/cordova-2.1.0.js:3743
11-27 12:41:15.800: D/JsMessageQueue(9129): Set native->JS mode to 0
11-27 12:41:15.800: D/WML_SISO(9129): InitPasteboardJni
11-27 12:41:15.805: D/SoftKeyboardDetect(9129): Ignore this event
11-27 12:41:15.810: D/SoftKeyboardDetect(9129): Ignore this event
11-27 12:41:15.810: D/JsMessageQueue(9129): Set native->JS mode to 1
11-27 12:41:15.810: D/DroidGap(9129): onMessage(onPageStarted,about:blank)
11-27 12:41:15.820: W/webcore(9129): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
11-27 12:41:15.820: W/webcore(9129): at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:2681)
11-27 12:41:15.820: W/webcore(9129): at android.webkit.WebViewCore$EventHub.access$13000(WebViewCore.java:1365)
11-27 12:41:15.820: W/webcore(9129): at android.webkit.WebViewCore.removeMessages(WebViewCore.java:2793)
11-27 12:41:15.820: W/webcore(9129): at android.webkit.WebView.sendOurVisibleRect(WebView.java:4046)
11-27 12:41:15.820: W/webcore(9129): at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:1024)
11-27 12:41:15.820: W/webcore(9129): at android.webkit.ZoomManager.access$2100(ZoomManager.java:57)
11-27 12:41:15.820: W/webcore(9129): at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:1595)
11-27 12:41:15.820: W/webcore(9129): at android.os.Handler.handleCallback(Handler.java:605)
11-27 12:41:15.820: W/webcore(9129): at android.os.Handler.dispatchMessage(Handler.java:92)
11-27 12:41:15.820: W/webcore(9129): at android.os.Looper.loop(Looper.java:137)
11-27 12:41:15.820: W/webcore(9129): at android.app.ActivityThread.main(ActivityThread.java:4517)
11-27 12:41:15.820: W/webcore(9129): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 12:41:15.820: W/webcore(9129): at java.lang.reflect.Method.invoke(Method.java:511)
11-27 12:41:15.820: W/webcore(9129): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:995)
11-27 12:41:15.820: W/webcore(9129): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
11-27 12:41:15.820: W/webcore(9129): at dalvik.system.NativeStart.main(Native Method)
11-27 12:41:15.820: D/SoftKeyboardDetect(9129): Ignore this event
11-27 12:41:15.825: I/GATE(9129): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
11-27 12:41:15.830: V/(9129): NotificationPresenterImpl::setSettingsValue 0
11-27 12:41:15.830: V/(9129): NotificationPresenterImpl::setSettingsValue 0
11-27 12:41:15.835: D/webkit(9129): Firewall not null
11-27 12:41:15.835: D/webkit(9129): euler: isUrlBlocked = false
11-27 12:41:15.845: D/Cordova(9129): onPageFinished(about:blank)
11-27 12:41:15.845: D/DroidGap(9129): onMessage(onPageFinished,about:blank)
11-27 12:41:15.845: D/DroidGap(9129): onMessage(exit,null)
11-27 12:41:15.900: I/GATE(9129): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
11-27 12:41:16.245: D/DroidGap(9129): onMessage(onPageStarted,file:///android_asset/www/index.html)
11-27 12:41:16.245: D/Cordova(9129): onPageFinished(file:///android_asset/www/index.html)
11-27 12:41:16.245: D/CordovaWebView(9129): >>> loadUrlNow()
11-27 12:41:16.245: D/webkit(9129): Firewall not null
11-27 12:41:16.245: D/webkit(9129): euler: isUrlBlocked = false
11-27 12:41:16.245: D/DroidGap(9129): onMessage(onNativeReady,null)
11-27 12:41:16.245: D/DroidGap(9129): onMessage(onPageFinished,file:///android_asset/www/index.html)
11-27 12:41:16.250: D/DroidGap(9129): Paused the application!
11-27 12:41:16.250: D/CordovaWebView(9129): Handle the pause
11-27 12:41:16.250: D/CordovaWebView(9129): >>> loadUrlNow()
11-27 12:41:16.360: D/DroidGap(9129): onMessage(networkconnection,wifi)
11-27 12:41:16.370: D/DroidGap(9129): onMessage(spinner,stop)
11-27 12:41:16.375: D/webkit(9129): Firewall not null
11-27 12:41:16.375: D/webkit(9129): euler: isUrlBlocked = false
11-27 12:41:16.380: D/CordovaLog(9129): Received Event: deviceready
11-27 12:41:16.380: D/CordovaLog(9129): file:///android_asset/www/js/index.js: Line 47 : Received Event: deviceready
11-27 12:41:16.380: I/Web Console(9129): Received Event: deviceready at file:///android_asset/www/js/index.js:47
11-27 12:41:17.635: D/DroidGap(9129): onDestroy()
11-27 12:41:17.635: D/CordovaWebView(9129): >>> loadUrlNow()
11-27 12:41:17.640: D/webkit(9129): Firewall not null
11-27 12:41:17.640: D/CordovaWebView(9129): >>> loadUrlNow()
11-27 12:41:17.640: D/webkit(9129): euler: isUrlBlocked = false
11-27 12:41:17.640: D/webkit(9129): Firewall not null
11-27 12:41:17.640: D/webkit(9129): euler: isUrlBlocked = false
11-27 12:41:17.650: D/CordovaLog(9129): JSCallback Error: Request failed with status 0
11-27 12:41:17.650: D/CordovaLog(9129): file:///android_asset/www/cordova-2.1.0.js: Line 3743 : JSCallback Error: Request failed with status 0
11-27 12:41:17.650: I/Web Console(9129): JSCallback Error: Request failed with status 0 at file:///android_asset/www/cordova-2.1.0.js:3743
11-27 12:41:17.650: D/JsMessageQueue(9129): Set native->JS mode to 0
11-27 12:41:17.650: D/JsMessageQueue(9129): Set native->JS mode to 1
11-27 12:41:17.660: D/DroidGap(9129): onMessage(onPageStarted,about:blank)
11-27 12:41:17.670: I/GATE(9129): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
11-27 12:41:17.670: D/Cordova(9129): onPageFinished(about:blank)
11-27 12:41:17.670: D/DroidGap(9129): onMessage(onPageFinished,about:blank)
11-27 12:41:17.670: D/DroidGap(9129): onMessage(exit,null)
11-27 12:41:18.255: D/DroidGap(9129): onMessage(spinner,stop)

我的应用日志:

11-27 12:36:41.810: D/DroidGap(10500): Paused the application!
11-27 12:36:41.810: D/CordovaWebView(10500): Handle the pause
11-27 12:36:41.810: D/CordovaWebView(10500): >>> loadUrlNow()
11-27 12:36:41.810: D/webkit(10500): Firewall not null
11-27 12:36:41.810: D/webkit(10500): euler: isUrlBlocked = false
11-27 12:36:41.815: D/DroidGap(10500): onDestroy()
11-27 12:36:41.850: D/CordovaWebView(10500): >>> loadUrlNow()
11-27 12:36:41.850: D/webkit(10500): Firewall not null
11-27 12:36:41.850: D/CordovaWebView(10500): >>> loadUrlNow()
11-27 12:36:41.850: D/webkit(10500): euler: isUrlBlocked = false
11-27 12:36:41.855: D/webkit(10500): Firewall not null
11-27 12:36:41.860: D/webkit(10500): euler: isUrlBlocked = false
11-27 12:36:41.865: D/DroidGap(10500): DroidGap.onCreate()
11-27 12:36:41.875: I/webclipboard(10500): clipservice: android.sec.clipboard.ClipboardExManager@4138e4e0
11-27 12:36:41.880: I/CordovaLog(10500): config.xml missing, reverting to cordova.xml
11-27 12:36:41.880: D/CordovaWebView(10500): Origin to allow: http://127.0.0.1*
11-27 12:36:41.880: I/CordovaLog(10500): Found log level DEBUG
11-27 12:36:41.880: I/CordovaLog(10500): Changing log level to DEBUG(3)
11-27 12:36:41.880: I/CordovaLog(10500): Found preference for classicRender=true
11-27 12:36:41.880: D/CordovaLog(10500): Found preference for classicRender=true
11-27 12:36:41.880: D/JsMessageQueue(10500): Set native->JS mode to 1
11-27 12:36:41.895: D/DroidGap(10500): DroidGap.init()
11-27 12:36:41.900: D/CordovaWebView(10500): >>> loadUrl(file:///android_asset/www/page_A_0.html)
11-27 12:36:41.900: D/PluginManager(10500): init()
11-27 12:36:41.900: I/PluginManager(10500): Using plugins.xml instead of config.xml. plugins.xml will eventually be deprecated
11-27 12:36:41.905: D/CordovaWebView(10500): >>> loadUrlNow()
11-27 12:36:41.910: D/DroidGap(10500): Resuming the App
11-27 12:36:41.915: I/GATE(10500): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
11-27 12:36:41.915: D/CordovaLog(10500): exception firing pause event from native
11-27 12:36:41.915: D/CordovaLog(10500): null: Line 1 : exception firing pause event from native
11-27 12:36:41.915: I/Web Console(10500): exception firing pause event from native at null:1
11-27 12:36:41.915: D/CordovaLog(10500): exception firing destroy event from native
11-27 12:36:41.915: D/CordovaLog(10500): null: Line 1 : exception firing destroy event from native
11-27 12:36:41.915: I/Web Console(10500): exception firing destroy event from native at null:1
11-27 12:36:41.915: W/System.err(10500): java.net.SocketException: Socket closed
11-27 12:36:41.915: W/System.err(10500): at libcore.io.Posix.accept(Native Method)
11-27 12:36:41.915: W/System.err(10500): at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:55)
11-27 12:36:41.915: W/System.err(10500): at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:98)
11-27 12:36:41.915: W/System.err(10500): at java.net.ServerSocket.implAccept(ServerSocket.java:202)
11-27 12:36:41.915: W/System.err(10500): at java.net.ServerSocket.accept(ServerSocket.java:127)
11-27 12:36:41.920: W/System.err(10500): at org.apache.cordova.CallbackServer.run(CallbackServer.java:195)
11-27 12:36:41.920: W/System.err(10500): at java.lang.Thread.run(Thread.java:856)
11-27 12:36:41.920: D/DroidGap(10500): onMessage(onPageStarted,about:blank)
11-27 12:36:41.920: D/WML_SISO(10500): InitPasteboardJni
11-27 12:36:41.920: D/SoftKeyboardDetect(10500): Ignore this event
11-27 12:36:41.920: V/(10500): NotificationPresenterImpl::setSettingsValue 0
11-27 12:36:41.920: V/(10500): NotificationPresenterImpl::setSettingsValue 0
11-27 12:36:41.925: D/webkit(10500): Firewall not null
11-27 12:36:41.925: D/webkit(10500): euler: isUrlBlocked = false
11-27 12:36:41.930: D/SoftKeyboardDetect(10500): Ignore this event
11-27 12:36:41.935: D/Cordova(10500): onPageFinished(about:blank)
11-27 12:36:41.935: D/DroidGap(10500): onMessage(onPageFinished,about:blank)
11-27 12:36:41.935: D/DroidGap(10500): onMessage(exit,null)
11-27 12:36:41.970: D/chromium(10500): Unknown chromium error: -6
11-27 12:36:42.315: D/DroidGap(10500): onMessage(onPageStarted,file:///android_asset/www/page_A_0.html)
11-27 12:36:42.315: D/SoftKeyboardDetect(10500): Ignore this event
11-27 12:36:42.360: D/DroidGap(10500): Paused the application!
11-27 12:36:42.360: D/CordovaWebView(10500): Handle the pause
11-27 12:36:42.360: D/CordovaWebView(10500): >>> loadUrlNow()
11-27 12:36:42.555: W/IInputConnectionWrapper(10500): showStatusIcon on inactive InputConnection
11-27 12:36:43.465: D/DroidGap(10500): onDestroy()
11-27 12:36:43.465: D/CordovaWebView(10500): >>> loadUrlNow()
11-27 12:36:43.465: D/CordovaWebView(10500): >>> loadUrlNow()
11-27 12:36:43.480: E/WindowManager(10500): Activity co.uk.precedent.tesco.CordovaTuxedoActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41449660 that was originally added here
11-27 12:36:43.480: E/WindowManager(10500): android.view.WindowLeaked: Activity co.uk.precedent.tesco.CordovaTuxedoActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41449660 that was originally added here
11-27 12:36:43.480: E/WindowManager(10500): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:414)
11-27 12:36:43.480: E/WindowManager(10500): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:282)
11-27 12:36:43.480: E/WindowManager(10500): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:218)
11-27 12:36:43.480: E/WindowManager(10500): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:143)
11-27 12:36:43.480: E/WindowManager(10500): at android.view.Window$LocalWindowManager.addView(Window.java:548)
11-27 12:36:43.480: E/WindowManager(10500): at android.app.Dialog.show(Dialog.java:337)
11-27 12:36:43.480: E/WindowManager(10500): at android.app.AlertDialog$Builder.show(AlertDialog.java:932)
11-27 12:36:43.480: E/WindowManager(10500): at org.apache.cordova.CordovaChromeClient.onJsAlert(CordovaChromeClient.java:119)
11-27 12:36:43.480: E/WindowManager(10500): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:628)
11-27 12:36:43.480: E/WindowManager(10500): at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 12:36:43.480: E/WindowManager(10500): at android.os.Looper.loop(Looper.java:137)
11-27 12:36:43.480: E/WindowManager(10500): at android.app.ActivityThread.main(ActivityThread.java:4517)
11-27 12:36:43.480: E/WindowManager(10500): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 12:36:43.480: E/WindowManager(10500): at java.lang.reflect.Method.invoke(Method.java:511)
11-27 12:36:43.480: E/WindowManager(10500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:995)
11-27 12:36:43.480: E/WindowManager(10500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
11-27 12:36:43.480: E/WindowManager(10500): at dalvik.system.NativeStart.main(Native Method)

最佳答案

首先,这不是设备兼容性问题 - 我这里有一台 Galaxy Note,它运行 PhoneGap 应用程序没有任何问题。

您是否尝试过运行默认的 Cordova 模板应用程序来排除更复杂的特定于应用程序的问题?

防火墙消息表明您的应用程序在启动期间试图通过网络加载某些内容 - 您的问题没有提供任何关于可能是什么的信息,但应该不难追踪。

关于javascript - 当方向改变时,Phonegap App 在 Galaxy Note 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13570262/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com