gpt4 book ai didi

android - PhoneGap-在新设备上不起作用

转载 作者:行者123 更新时间:2023-12-03 08:01:07 24 4
gpt4 key购买 nike

您好,我正在使用PhoneGap Android,并且发布了一个应用程序,该应用程序将在虚拟设备和实际设备中在Android 2.3.3下运行。

但是,在虚拟设备和实际设备上在Android 4.1上运行时,该应用程序甚至都不会超过该应用程序的首页。

我无所适从,因为我将每段代码都放在了try块中,没有一个被触发,并且该应用在旧版本中运行良好。

这是我在Android 4.1下的日志记录

10-14 22:48:53.502: I/CordovaLog(871): Changing log level to DEBUG(3)
10-14 22:48:53.502: I/CordovaLog(871): Found preference for useBrowserHistory=false
10-14 22:48:53.512: D/CordovaLog(871): Found preference for useBrowserHistory=false
10-14 22:48:53.562: D/JsMessageQueue(871): Set native->JS mode to 1
10-14 22:48:53.694: D/DroidGap(871): DroidGap.init()
10-14 22:48:53.822: D/CordovaWebView(871): DroidGap.loadUrl(file:///android_asset/www/splash.html, 10000)
10-14 22:48:53.822: D/DroidGap(871): onMessage(splashscreen,show)
10-14 22:48:54.202: D/dalvikvm(871): GC_FOR_ALLOC freed 87K, 3% free 8080K/8259K, paused 335ms, total 339ms
10-14 22:48:54.312: I/dalvikvm-heap(871): Grow heap (frag case) to 9.111MB for 1228816-byte allocation
10-14 22:48:54.522: D/dalvikvm(871): GC_FOR_ALLOC freed 1K, 3% free 9278K/9479K, paused 201ms, total 201ms
10-14 22:48:55.032: D/dalvikvm(871): GC_CONCURRENT freed 4K, 3% free 9283K/9479K, paused 102ms+77ms, total 440ms
10-14 22:48:56.101: D/CordovaWebView(871): >>> loadUrl(file:///android_asset/www/splash.html)
10-14 22:48:56.101: D/PluginManager(871): init()
10-14 22:48:56.141: D/CordovaWebView(871): >>> loadUrlNow()
10-14 22:48:56.141: D/DroidGap(871): Resuming the App
10-14 22:48:56.192: I/Choreographer(871): Skipped 33 frames! The application may be doing too much work on its main thread.
10-14 22:48:56.532: D/SoftKeyboardDetect(871): Ignore this event
10-14 22:48:56.802: I/Choreographer(871): Skipped 75 frames! The application may be doing too much work on its main thread.
10-14 22:48:56.973: D/gralloc_goldfish(871): Emulator without GPU emulation detected.
10-14 22:48:57.764: D/SoftKeyboardDetect(871): Ignore this event
10-14 22:48:59.602: D/DroidGap(871): onMessage(onPageStarted,file:///android_asset/www/splash.html)
10-14 22:49:06.772: D/SoftKeyboardDetect(871): Ignore this event
10-14 22:49:16.172: E/CordovaWebView(871): CordovaWebView: TIMEOUT ERROR!
10-14 22:49:16.172: D/Cordova(871): CordovaWebViewClient.onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=file:///android_asset/www/splash.html
10-14 22:49:16.232: D/DroidGap(871): onMessage(onReceivedError,{"errorCode":-6,"url":"file:\/\/\/android_asset\/www\/splash.html","description":"The connection to the server was unsuccessful."})
10-14 22:49:16.764: I/Choreographer(871): Skipped 131 frames! The application may be doing too much work on its main thread.
10-14 22:49:16.764: D/SoftKeyboardDetect(871): Ignore this event
10-14 22:49:17.321: D/Cordova(871): onPageFinished(file:///android_asset/www/splash.html)
10-14 22:49:17.332: D/CordovaWebView(871): >>> loadUrlNow()
10-14 22:49:17.364: D/DroidGap(871): onMessage(onNativeReady,null)
10-14 22:49:17.364: D/DroidGap(871): onMessage(onPageFinished,file:///android_asset/www/splash.html)
10-14 22:49:17.386: I/Choreographer(871): Skipped 112 frames! The application may be doing too much work on its main thread.
10-14 22:49:49.262: D/DroidGap(871): Paused the application!
10-14 22:49:50.032: W/IInputConnectionWrapper(871): showStatusIcon on inactive InputConnection
10-14 22:49:51.446: D/DroidGap(871): onDestroy()
10-14 22:49:51.446: D/CordovaWebView(871): >>> loadUrlNow()
10-14 22:49:51.472: D/CordovaWebView(871): >>> loadUrlNow()
10-14 22:49:51.642: D/DroidGap(871): onMessage(onPageStarted,about:blank)
10-14 22:49:51.682: W/System.err(871): java.net.SocketException: Socket closed
10-14 22:49:51.682: W/System.err(871): at libcore.io.Posix.accept(Native Method)
10-14 22:49:51.702: W/System.err(871): at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:55)
10-14 22:49:51.702: W/System.err(871): at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:98)
10-14 22:49:51.702: W/System.err(871): at java.net.ServerSocket.implAccept(ServerSocket.java:202)
10-14 22:49:51.702: W/System.err(871): at java.net.ServerSocket.accept(ServerSocket.java:127)
10-14 22:49:51.702: W/System.err(871): at org.apache.cordova.CallbackServer.run(CallbackServer.java:195)
10-14 22:49:51.702: W/System.err(871): at java.lang.Thread.run(Thread.java:856)
10-14 22:49:52.302: D/Cordova(871): onPageFinished(about:blank)
10-14 22:49:52.312: D/DroidGap(871): onMessage(onPageFinished,about:blank)
10-14 22:49:52.312: D/DroidGap(871): onMessage(exit,null)

任何帮助将非常感激。

谢谢。

编辑:

我正在使用PhoneGap版本:cordova-2.1.0.js

通过更多阅读,我还将这一行添加到了MainActivity.java中
super.setIntegerProperty("loadUrlTimeoutValue", 60000); 

并且还将ADB连接超时从5000更改为10000

这是我的 list 文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.game.demo"
android:versionCode="2"
android:versionName="1.1" >

<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true" />

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

最佳答案

可能是link将帮助您检查它
警告:从Android 3.2(API级别13)开始,当设备在纵向和横向之间切换时,screen size也会更改。
因此,如果要防止在为API级别13或更高级别开发时(由于minSdkVersiontargetSdkVersion属性声明)方向改变而导致运行时重新启动,则除了“orientation”值外,还必须包括screenSize值。也就是说,您必须对android:configChanges="orientation|screenSize"进行decalare。
但是,如果您的应用程序以API级别12或更低级别为目标,则您的 Activity 始终会自行处理此配置更改(即使在Android 3.2或更高版本的设备上运行,此配置更改也不会重新启动您的 Activity )。
为每个 Activity 添加标签

   android:configChanges="orientation|screenSize|keyboardHidden"

关于android - PhoneGap-在新设备上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12890314/

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