java.lang.RuntimeException:无法实例化活动

时间:2011-11-23 09:00:02

标签: java android eclipse

对不起,我见过类似的帖子,但是对于我找到的所有帖子,他们没有帮助。当我重新格式化我的笔记本电脑并使用几个工具来恢复代码时,我丢失了我的项目,但这并不是我的方式。再次修复之后我不断收到这些错误,我对java有点新意,请解释一下。

    11-23 00:36:53.805: ERROR/Zygote(33): setreuid() failed. errno: 2
11-23 00:37:01.734: ERROR/Zygote(33): setreuid() failed. errno: 17
11-23 00:37:03.025: ERROR/BatteryService(59): usbOnlinePath not found
11-23 00:37:03.025: ERROR/BatteryService(59): batteryVoltagePath not found
11-23 00:37:03.025: ERROR/BatteryService(59): batteryTemperaturePath not found
11-23 00:37:03.054: ERROR/SurfaceFlinger(59): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
11-23 00:37:09.384: ERROR/EventHub(59): could not get driver version for /dev/input/mouse0, Not a typewriter
11-23 00:37:09.384: ERROR/EventHub(59): could not get driver version for /dev/input/mice, Not a typewriter
11-23 00:37:09.654: ERROR/System(59): Failure starting core service
11-23 00:37:09.654: ERROR/System(59): java.lang.SecurityException
11-23 00:37:09.654: ERROR/System(59):     at android.os.BinderProxy.transact(Native Method)
11-23 00:37:09.654: ERROR/System(59):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
11-23 00:37:09.654: ERROR/System(59):     at android.os.ServiceManager.addService(ServiceManager.java:72)
11-23 00:37:09.654: ERROR/System(59):     at com.android.server.ServerThread.run(SystemServer.java:184)
11-23 00:37:10.406: ERROR/SoundPool(59): error loading /system/media/audio/ui/Effect_Tick.ogg
11-23 00:37:10.414: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressStandard.ogg
11-23 00:37:10.414: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressSpacebar.ogg
11-23 00:37:10.414: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressDelete.ogg
11-23 00:37:10.414: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressReturn.ogg
11-23 00:37:12.275: ERROR/ThrottleService(59): Could not open GPS configuration file /etc/gps.conf
11-23 00:37:13.605: ERROR/logwrapper(150): executing /system/bin/tc failed: No such file or directory
11-23 00:37:13.635: ERROR/logwrapper(151): executing /system/bin/tc failed: No such file or directory
11-23 00:37:13.685: ERROR/logwrapper(152): executing /system/bin/tc failed: No such file or directory
11-23 00:37:24.969: ERROR/HierarchicalStateMachine(59): TetherMaster - unhandledMessage: msg.what=3
11-23 00:37:39.699: ERROR/AndroidRuntime(293): FATAL EXCEPTION: main
11-23 00:37:39.699: ERROR/AndroidRuntime(293): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.sundaypsalmdoy/com.sundaypsalmdoy.SundayPsalmody}: java.lang.ClassNotFoundException: com.sundaypsalmdoy.SundayPsalmody in loader dalvik.system.PathClassLoader[/data/app/com.sundaypsalmdoy-1.apk]
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.os.Looper.loop(Looper.java:123)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.app.ActivityThread.main(ActivityThread.java:4627)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at java.lang.reflect.Method.invokeNative(Native Method)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at java.lang.reflect.Method.invoke(Method.java:521)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at dalvik.system.NativeStart.main(Native Method)
11-23 00:37:39.699: ERROR/AndroidRuntime(293): Caused by: java.lang.ClassNotFoundException: com.sundaypsalmdoy.SundayPsalmody in loader dalvik.system.PathClassLoader[/data/app/com.sundaypsalmdoy-1.apk]
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
11-23 00:37:39.699: ERROR/AndroidRuntime(293):     ... 11 more




package com.sundaypsalmody;

import com.sundaypsalmdoy.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.view.View.OnClickListener;

public class SundayPsalmody extends Activity implements OnClickListener {
    Button commemoration;
    Button conclusionadam;
    Button conclusionbatos;
    Button first;
    Button fourth;
    Button friday;
    Button glossory;
    Button intro;
    Button midnightdoxology;
    Button monday;
    Button morningdoxology;
    Button praiseofangels;
    Button psalies;
    Button resurrectionhymn;
    Button saturday;
    Button seasonalDoxology;
    Button second;
    Button stDoxology;
    Button sundaypsali;
    Button sundaytheotokia;
    Button sundaytheotokiaGospel;
    Button third;
    Button thursday;
    Button tuesday;
    Button verses;
    Button wednesday;

    public void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.main);

        intro = (Button) findViewById(R.id.btnIntro);
        first = (Button) findViewById(R.id.btnFirstHoos);
        second = (Button) findViewById(R.id.btnSeconHoos);
        third = (Button) findViewById(R.id.btnThirdHoos);
        fourth = (Button) findViewById(R.id.btnFirstHoos);
        commemoration = (Button) findViewById(R.id.btnCommemoration);
        sundaypsali = (Button) findViewById(R.id.btnSundayPsaliforvirgin);
        sundaytheotokia = (Button) findViewById(R.id.btnSundayTheotokia);
        sundaytheotokiaGospel = (Button) findViewById(R.id.btnSundayTheotokia2);
        conclusionadam = (Button) findViewById(R.id.btnConclusionAdam);
        monday = (Button) findViewById(R.id.btnMonday);
        tuesday = (Button) findViewById(R.id.btnTuesday);
        thursday = (Button) findViewById(R.id.btnWednesday);
        thursday = (Button) findViewById(R.id.btnThursday);
        friday = (Button) findViewById(R.id.btnFriday);
        saturday = (Button) findViewById(R.id.btnSaturday);
        conclusionbatos = (Button) findViewById(R.id.btnConclusionBatos);
        morningdoxology = (Button) findViewById(R.id.btnMorningDoxology);
        praiseofangels = (Button) findViewById(R.id.btnPraiseofAngel);
        verses = (Button) findViewById(R.id.btnVerses);
        stDoxology = (Button) findViewById(R.id.btnDoxologySaints);
        seasonalDoxology = (Button) findViewById(R.id.btnDoxologySeason);
        psalies = (Button) findViewById(R.id.btnPsali);
        glossory = (Button) findViewById(R.id.btnGlossory);
        resurrectionhymn = (Button) findViewById(R.id.btnHymnofResurrection);

        intro.setOnClickListener(this);
        first.setOnClickListener(this);
        second.setOnClickListener(this);
        third.setOnClickListener(this);
        fourth.setOnClickListener(this);
        commemoration.setOnClickListener(this);
        sundaypsali.setOnClickListener(this);
        sundaytheotokia.setOnClickListener(this);
        sundaytheotokiaGospel.setOnClickListener(this);
        conclusionadam.setOnClickListener(this);
        monday.setOnClickListener(this);
        tuesday.setOnClickListener(this);
        wednesday.setOnClickListener(this);
        thursday.setOnClickListener(this);
        friday.setOnClickListener(this);
        saturday.setOnClickListener(this);
        conclusionbatos.setOnClickListener(this);
        morningdoxology.setOnClickListener(this);
        praiseofangels.setOnClickListener(this);
        verses.setOnClickListener(this);
        stDoxology.setOnClickListener(this);
        seasonalDoxology.setOnClickListener(this);
        psalies.setOnClickListener(this);
        glossory.setOnClickListener(this);
        resurrectionhymn.setOnClickListener(this);

    }

    public void onClick(View v) {
        switch (v.getId()) {
        case R.id.btnIntro:
            startActivity(new Intent(this, Intro.class));
            break;
        case R.id.btnFirstHoos:
            startActivity(new Intent(this, First.class));
            break;
        case R.id.btnSeconHoos:
            startActivity(new Intent(this, Second.class));
            break;
        case R.id.btnThirdHoos:
            startActivity(new Intent(this, Third.class));
            break;
        case R.id.btnFourthHoos:
            startActivity(new Intent(this, Fourth.class));
            break;
        case R.id.btnCommemoration:
            startActivity(new Intent(this, Commemoration.class));
            break;
        case R.id.btnSundayPsaliforvirgin:
            startActivity(new Intent(this, SundayPsali.class));
            break;
        case R.id.btnSundayTheotokia:
            startActivity(new Intent(this, SundayTheotokia.class));
            break;
        case R.id.btnSundayTheotokia2:
            startActivity(new Intent(this, SundayTheotokiaGospel.class));
            break;
        case R.id.btnConclusionAdam:
            startActivity(new Intent(this, ConclusionAdam.class));
            break;
        case R.id.btnMonday:
            startActivity(new Intent(this, Monday.class));
            break;
        case R.id.btnTuesday:
            startActivity(new Intent(this, Tuesday.class));
            break;
        case R.id.btnWednesday:
            startActivity(new Intent(this, Wednesday.class));
            break;
        case R.id.btnThursday:
            startActivity(new Intent(this, Thursday.class));
            break;
        case R.id.btnFriday:
            startActivity(new Intent(this, Friday.class));
            break;
        case R.id.btnSaturday:
            startActivity(new Intent(this, Saturday.class));
            break;
        case R.id.btnConclusionBatos:
            startActivity(new Intent(this, ConclusionBatos.class));
            break;
        case R.id.btnMorningDoxology:
            startActivity(new Intent(this, MorningDoxology.class));
            break;
        case R.id.btnPraiseofAngel:
            startActivity(new Intent(this, PraiseOfAngels.class));
            break;
        case R.id.btnVerses:
            startActivity(new Intent(this, VersesOfCymbals.class));
            break;
        case R.id.btnDoxologySaints:
            startActivity(new Intent(this, SaintsDoxology.class));
            break;
        case R.id.btnDoxologySeason:
            startActivity(new Intent(this, SeasonalDoxology.class));
            break;
        case R.id.btnPsali:
            startActivity(new Intent(this, Psalis.class));
            break;
        case R.id.btnGlossory:
            startActivity(new Intent(this, Glossary.class));
            break;
        case R.id.btnHymnofResurrection:
            startActivity(new Intent(this, ResurrectionHymn.class));
            break;
        }
    }
}

以防有人在清单中看到我看不到的东西。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sundaypsalmdoy" android:versionCode="4"
    android:versionName="2.2" android:installLocation="preferExternal">
    <application android:label="@string/app_name" android:icon="@drawable/icon"
        android:debuggable="true" android:restoreNeedsApplication="true">
        <activity android:label="@string/app_name" android:name=".SundayPsalmody">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".AbbaKirDoxology" />
        <activity android:name=".AbbaSarapamonDoxology" />
        <activity android:name=".AnnunciationAdamPsali" />
        <activity android:name=".AnnunciationBatosPsali" />
        <activity android:name=".Wednesday" />

                About 144 more activities with the same style

    </application>
    <uses-sdk android:minSdkVersion="8" />
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

1 个答案:

答案 0 :(得分:0)

尝试:

  1. import com.sundaysalmody.R;活动
  2. 的导入列表中删除SundayPsalmody
  3. 检查Activities文件中是否正确声明了所有Manifest.xml
  4. 清理并构建项目。
  5. 运行应用程序