当我重新启动手机时,我的应用程序崩溃了

时间:2014-04-07 13:13:50

标签: java android

正在开发GPS跟踪应用程序。当我们重新启动手机时,它正在崩溃。并请帮助我使应用程序与所有Android设备兼容。 这是我的Manifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.gpstracking"
    android:versionCode="1"
    android:versionName="1.0"
     >

    <uses-sdk android:minSdkVersion="4" 
        android:targetSdkVersion="19"
        />        
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" android:exported="true"/>   

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@id/btnShowLocation"
        android:allowBackup="true" android:theme="@style/gps">
        <activity
            android:name=".AndroidGPSTrackingActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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


</manifest>

1 个答案:

答案 0 :(得分:0)

  <compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="large" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="xlarge" android:screenDensity="xhdpi" />


<!-- support for Xperia Z, Galaxy S4 and HTC One -->
<screen android:screenDensity="480" android:screenSize="normal" /> 
<screen android:screenDensity="480" android:screenSize="large" /> 
</compatible-screens> 

在清单中尝试此代码我认为这将有效..其他明智在res文件夹中创建单独的文件夹,如layout-small,layout-large,layout-normal,并在drawable文件夹drawable-hdpi中使用适当的图像,drawable -ldpi,drawable-mdpi ...我相信这会帮助你进行各种屏幕定位..

用于GPS问题use this link