我在测试应用程序中构建了我的应用程序的一些元素,并且我已将这些元素复制到我的主应用程序中,但是当我运行它时,应用程序会爆炸。
我感觉我的清单有问题,但我不能完全确定。这是我的清单:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="police.uk.greatermanchesterpoliceandroid"
android:versionCode="1"
android:versionName="1.0">
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CustomTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".CustomizedListView" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DetailsActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".FileCache"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ImageLoader"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LazyAdapter"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MemoryCache"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Utils"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".XMLParser"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ac2"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAioYkrj1Wl44z2LQvTCOw6GXPXdTroGng"/>
</application>
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk android:minSdkVersion="11" />
任何人都可以看到问题吗?
我的 LogCat 中的这一行让我担心:-
04-24 11:42:16.769: D/dalvikvm(18849): Late-enabling CheckJNI
04-24 11:42:16.794: I/dalvikvm(18849): Turning on JNI app bug workarounds for target SDK version 11...
04-24 11:42:16.799: E/jdwp(18849): Failed sending reply to debugger: Broken pipe
04-24 11:42:16.799: D/dalvikvm(18849): Debugger has detached; object registry had 1 entries
04-24 11:42:16.904: D/AbsListView(18849): Get MotionRecognitionManager
04-24 11:42:16.914: D/AndroidRuntime(18849): Shutting down VM
04-24 11:42:16.914: W/dalvikvm(18849): threadid=1: thread exiting with uncaught exception (group=0x41b082a0)
04-24 11:42:16.914: E/AndroidRuntime(18849): FATAL EXCEPTION: main
04-24 11:42:16.914: E/AndroidRuntime(18849): java.lang.RuntimeException: Unable to start activity ComponentInfo{police.uk.greatermanchesterpoliceandroid/police.uk.greatermanchesterpoliceandroid.CustomizedListView}: android.os.NetworkOnMainThreadException
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.app.ActivityThread.access$600(ActivityThread.java:140)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.os.Looper.loop(Looper.java:137)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.app.ActivityThread.main(ActivityThread.java:4898)
04-24 11:42:16.914: E/AndroidRuntime(18849): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 11:42:16.914: E/AndroidRuntime(18849): at java.lang.reflect.Method.invoke(Method.java:511)
04-24 11:42:16.914: E/AndroidRuntime(18849): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
04-24 11:42:16.914: E/AndroidRuntime(18849): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
04-24 11:42:16.914: E/AndroidRuntime(18849): at dalvik.system.NativeStart.main(Native Method)
04-24 11:42:16.914: E/AndroidRuntime(18849): Caused by: android.os.NetworkOnMainThreadException
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1118)
04-24 11:42:16.914: E/AndroidRuntime(18849): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
04-24 11:42:16.914: E/AndroidRuntime(18849): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
04-24 11:42:16.914: E/AndroidRuntime(18849): at java.net.InetAddress.getAllByName(InetAddress.java:214)
04-24 11:42:16.914: E/AndroidRuntime(18849): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
04-24 11:42:16.914: E/AndroidRuntime(18849): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
04-24 11:42:16.914: E/AndroidRuntime(18849): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
04-24 11:42:16.914: E/AndroidRuntime(18849): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
04-24 11:42:16.914: E/AndroidRuntime(18849): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:670)
04-24 11:42:16.914: E/AndroidRuntime(18849): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:509)
04-24 11:42:16.914: E/AndroidRuntime(18849): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
04-24 11:42:16.914: E/AndroidRuntime(18849): at police.uk.greatermanchesterpoliceandroid.XMLParser.getXmlFromUrl(XMLParser.java:45)
04-24 11:42:16.914: E/AndroidRuntime(18849): at police.uk.greatermanchesterpoliceandroid.CustomizedListView.onCreate(CustomizedListView.java:47)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.app.Activity.performCreate(Activity.java:5206)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-24 11:42:16.914: E/AndroidRuntime(18849): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
04-24 11:42:16.914: E/AndroidRuntime(18849): ... 11 more