我是 Android 编程新手,我尝试在我的 AndroidManifest.xml 中添加第二个活动,但现在我的应用程序不再启动。错误是:
04-04 07:42:13.154: D/AndroidRuntime(809): Shutting down VM
04-04 07:42:13.154: W/dalvikvm(809): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
04-04 07:42:13.294: E/AndroidRuntime(809): FATAL EXCEPTION: main
04-04 07:42:13.294: E/AndroidRuntime(809): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.evo_soft/com.example.evo_soft.MainActivity}: java.lang.NullPointerException
04-04 07:42:13.294: E/AndroidRuntime(809): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.os.Handler.dispatchMessage(Handler.java:99)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.os.Looper.loop(Looper.java:137)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-04 07:42:13.294: E/AndroidRuntime(809): at java.lang.reflect.Method.invokeNative(Native Method)
04-04 07:42:13.294: E/AndroidRuntime(809): at java.lang.reflect.Method.invoke(Method.java:511)
04-04 07:42:13.294: E/AndroidRuntime(809): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-04 07:42:13.294: E/AndroidRuntime(809): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-04 07:42:13.294: E/AndroidRuntime(809): at dalvik.system.NativeStart.main(Native Method)
04-04 07:42:13.294: E/AndroidRuntime(809): Caused by: java.lang.NullPointerException
04-04 07:42:13.294: E/AndroidRuntime(809): at android.content.ContextWrapper.getPackageName(ContextWrapper.java:135)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.content.ComponentName.<init>(ComponentName.java:75)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.content.Intent.<init>(Intent.java:3491)
04-04 07:42:13.294: E/AndroidRuntime(809): at com.example.evo_soft.MainActivity.<init>(MainActivity.java:220)
04-04 07:42:13.294: E/AndroidRuntime(809): at java.lang.Class.newInstanceImpl(Native Method)
04-04 07:42:13.294: E/AndroidRuntime(809): at java.lang.Class.newInstance(Class.java:1319)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
04-04 07:42:13.294: E/AndroidRuntime(809): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
04-04 07:42:13.294: E/AndroidRuntime(809): ... 11 more
我的 AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.evo_soft"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.evo_soft.MainActivity"
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="group.pals.android.lib.ui.filechooser.FileChooserActivity"
android:configChanges="orientation|screenSize|keyboard|keyboardHidden"
android:screenOrientation="user" >
</activity>
<service android:name="group.pals.android.lib.ui.filechooser.services.LocalFileProvider"></service>
</application>
感谢帮助
马库斯