2

我在android中开发了一个手机间隙应用程序,当我改变方向时应用程序崩溃。是否需要在清单文件中添加任何设置?

当方向改变时,它会使应用程序崩溃。

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
  package="com.cordova.radiobiafranew" android:installLocation="preferExternal" android:versionName="1.0" android:versionCode="1">
<supports-screens
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:xlargeScreens="true"
    android:resizeable="true"
    android:anyDensity="true"
    />



<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />   
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />   
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17"/>

<application android:icon="@drawable/icon" android:label="@string/app_name"
            android:debuggable="true">
    <activity android:name="radiobiafranew" android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar" android:configChanges="keyboardHidden|orientation|screenLayout">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

LogCat输出:

08-06 05:47:52.305: D/CordovaActivity(1428): CordovaActivity.init()
08-06 05:47:52.334: D/CordovaWebView(1428): >>> loadUrl(file:///android_asset/www/index.html)
08-06 05:47:52.334: D/PluginManager(1428): init()
08-06 05:47:52.386: D/CordovaWebView(1428): >>> loadUrlNow()
08-06 05:47:52.386: D/CordovaActivity(1428): Setting integer properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml
08-06 05:47:52.494: D/dalvikvm(1428): GC_FOR_ALLOC freed 3639K, 38% free 5711K/9108K, paused 98ms, total 99ms
08-06 05:47:52.544: I/dalvikvm-heap(1428): Grow heap (frag case) to 9.205MB for 3686416-byte allocation
08-06 05:47:52.634: D/dalvikvm(1428): GC_FOR_ALLOC freed <1K, 27% free 9311K/12712K, paused 81ms, total 81ms
08-06 05:47:52.754: D/dalvikvm(1428): GC_CONCURRENT freed <1K, 27% free 9343K/12712K, paused 7ms+5ms, total 120ms
08-06 05:47:54.974: D/CordovaWebView(1428): loadUrlIntoView(file:///android_asset/www/index.html, 5000)
08-06 05:47:54.974: D/CordovaActivity(1428): onMessage(splashscreen,show)
08-06 05:47:54.984: D/CordovaWebView(1428): >>> loadUrl(file:///android_asset/www/index.html)
08-06 05:47:54.984: D/PluginManager(1428): init()
08-06 05:47:54.984: D/CordovaWebView(1428): >>> loadUrlNow()
08-06 05:47:54.994: D/Config(1428): Unlimited access to network resources
08-06 05:47:54.994: I/CordovaLog(1428): Found start page location: index.html
08-06 05:47:54.994: I/CordovaLog(1428): Changing log level to DEBUG(3)
08-06 05:47:55.024: D/CordovaActivity(1428): Resuming the App
08-06 05:47:55.024: D/CordovaActivity(1428): CB-3064: The errorUrl is null
08-06 05:47:55.044: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.044: D/CordovaActivity(1428): onMessage(onPageStarted,about:blank)
08-06 05:47:55.044: I/Choreographer(1428): Skipped 358 frames!  The application may be doing too much work on its main thread.
08-06 05:47:55.044: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.064: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.064: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.144: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.144: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.144: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.144: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.154: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.185: D/SoftKeyboardDetect(1428): Ignore this event
08-06 05:47:55.185: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.255: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.265: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.265: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.285: D/Cordova(1428): onPageFinished(about:blank)
08-06 05:47:55.295: D/CordovaActivity(1428): onMessage(onPageFinished,about:blank)
08-06 05:47:55.295: D/CordovaActivity(1428): onMessage(exit,null)
08-06 05:47:55.375: D/CordovaActivity(1428): onMessage(onPageStarted,file:///android_asset/www/index.html)
08-06 05:47:55.454: I/Choreographer(1428): Skipped 33 frames!  The application may be doing too much work on its main thread.
08-06 05:47:55.454: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.454: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.464: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.464: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.474: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:55.474: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:56.684: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:56.714: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:56.714: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:56.714: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:56.994: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.034: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.064: D/Cordova(1428): onPageFinished(file:///android_asset/www/index.html)
08-06 05:47:57.064: D/CordovaActivity(1428): onMessage(onPageFinished,file:///android_asset/www/index.html)
08-06 05:47:57.104: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.104: D/CordovaActivity(1428): Paused the application!
08-06 05:47:57.104: D/CordovaWebView(1428): Handle the pause
08-06 05:47:57.116: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.116: D/CordovaActivity(1428): onMessage(onPageStarted,file:///android_asset/www/index.html)
08-06 05:47:57.145: W/IInputConnectionWrapper(1428): showStatusIcon on inactive InputConnection
08-06 05:47:57.145: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.164: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.164: D/SoftKeyboardDetect(1428): Ignore this event
08-06 05:47:57.185: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.255: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.255: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.255: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.255: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:57.464: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:58.064: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:58.064: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:58.064: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:58.064: D/CordovaActivity(1428): CordovaActivity.onDestroy()
08-06 05:47:58.094: D/CordovaWebView(1428): >>> loadUrlNow()
08-06 05:47:58.134: W/Trace(1428): Unexpected value from nativeGetEnabledTags: 0
08-06 05:47:58.605: D/chromium(1428): Unknown chromium error: -6
08-06 05:47:58.614: D/chromium(1428): Unknown chromium error: -6
08-06 05:47:58.614: D/chromium(1428): Unknown chromium error: -6
08-06 05:47:59.135: D/CordovaActivity(1428): onMessage(spinner,stop)
08-06 05:48:00.814: D/Cordova(1428): onPageFinished(file:///android_asset/www/index.html)
08-06 05:48:00.814: D/CordovaActivity(1428): onMessage(onPageFinished,file:///android_asset/www/index.html)
08-06 05:48:00.834: D/CordovaActivity(1428): onMessage(onPageStarted,about:blank)
08-06 05:48:00.944: D/Cordova(1428): onPageFinished(about:blank)
08-06 05:48:00.944: D/CordovaActivity(1428): onMessage(onPageFinished,about:blank)
08-06 05:48:00.944: D/CordovaActivity(1428): onMessage(exit,null)
4

4 回答 4

5

试试这个,我想它会解决你的问题。

<activity android:name="radiobiafranew" android:label="@string/app_name"
          android:theme="@android:style/Theme.Black.NoTitleBar"
          android:configChanges="orientation|screenSize|keyboardHidden|keyboard|locale">
于 2013-08-06T06:12:09.483 回答
3

只需在清单文件中的活动标记内添加以下行。

android:configChanges="orientation|screenSize|keyboardHidden|keyboard|locale
于 2013-12-21T06:29:14.807 回答
1

这个对我有用。

android:configChanges="orientation|screenSize|keyboardHidden"

谢谢。

于 2013-10-22T11:23:00.707 回答
1
android:configChanges="orientation|screenSize|keyboardHidden|keyboard|locale

在您的 android 项目清单文件中添加上述行

于 2016-08-02T11:25:06.307 回答