0

大家好,我开发了一个简单的应用程序,该应用程序使用 SAX 从 Internet 读取 XML 文件,但我在 logcat 上收到此错误任何帮助可能会有所帮助

清单文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reaf.xml"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.read.xml.DataHandler"
        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>
    <activity android:name=".MainActivity" >
    </activity>
</application>

日志猫

10-06 07:38:00.014: D/dalvikvm(543): newInstance failed: no <init>()
10-06 07:38:00.054: D/AndroidRuntime(543): Shutting down VM
10-06 07:38:00.054: W/dalvikvm(543): threadid=1: thread exiting with uncaught exception (group=0x40015560)
10-06 07:38:00.064: E/AndroidRuntime(543): FATAL EXCEPTION: main
10-06 07:38:00.064: E/AndroidRuntime(543): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.reaf.xml/com.read.xml.DataHandler}: java.lang.InstantiationException: com.read.xml.DataHandler
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.os.Looper.loop(Looper.java:123)
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.app.ActivityThread.main(ActivityThread.java:3683)
10-06 07:38:00.064: E/AndroidRuntime(543):  at java.lang.reflect.Method.invokeNative(Native Method)
10-06 07:38:00.064: E/AndroidRuntime(543):  at java.lang.reflect.Method.invoke(Method.java:507)
10-06 07:38:00.064: E/AndroidRuntime(543):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-06 07:38:00.064: E/AndroidRuntime(543):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-06 07:38:00.064: E/AndroidRuntime(543):  at dalvik.system.NativeStart.main(Native Method)
10-06 07:38:00.064: E/AndroidRuntime(543): Caused by: java.lang.InstantiationException: com.read.xml.DataHandler
10-06 07:38:00.064: E/AndroidRuntime(543):  at java.lang.Class.newInstanceImpl(Native Method)
10-06 07:38:00.064: E/AndroidRuntime(543):  at java.lang.Class.newInstance(Class.java:1409)
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
10-06 07:38:00.064: E/AndroidRuntime(543):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
10-06 07:38:00.064: E/AndroidRuntime(543):  ... 11 more

我不知道错误是什么

请帮忙

4

2 回答 2

1

您的包裹是com.reaf.xml,您的活动名称是com.read.xml.DataHandler(您的包裹名称有误)。

请通过将包设置为com.read.xml并将活动名称设置为来给予它们.DataHandler

于 2012-10-06T07:54:41.517 回答
0

DataHandler当您调用方法时,它无法初始化newInstance。请确保您提供nullary constructor上课DataHandler。出于其他原因,请查看API 文档

于 2012-10-06T07:55:46.833 回答