簡體   English   中英

java.lang.RuntimeException:無法實例化活動

[英]java.lang.RuntimeException:Unable to instantiate activity

很抱歉,我看到過類似的帖子,但是對於我發現的所有帖子,它們都沒有幫助。 重新格式化筆記本電腦並使用多種工具來恢復代碼時,我丟失了項目,但這並不是我的正確方式。 再次修復后,我仍然收到這些錯誤,我是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. 刪除import com.sundaysalmody.R; 從您的SundayPsalmody活動中的進口清單中
  2. 檢查是否在Manifest.xml文件中正確聲明了所有Activities
  3. 清理並構建您的項目。
  4. 運行應用程序

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM