1

アプリのいくつかの要素をテストアプリに組み込み、それらの要素をメインアプリにコピーしましたが、実行するとアプリが爆発します。

マニフェストに問題があるような気がしますが、正確に特定できません。これは私のマニフェストです:-

 <?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
4

4 に答える 4

1

このエラーは、アクティビティのメイン スレッドでネットワーク操作を実行しようとしていることを示しています。ApplicationNotResponding 例外が発生する前にインタラクションに応答する時間が 5 秒しかないため、お勧めしません。

サービスまたはAsyncTaskなどを介して、ネットワーク操作をバックグラウンド スレッドに移動することを検討してください。

于 2013-04-24T10:29:00.183 に答える