简体   繁体   中英

java.lang.RuntimeException:Unable to instantiate activity

I'm sorry I've seen similar post but they didn't help, for all the ones I found. I lost my project when I reformatted my laptop and used several tools to recover the code but it wasn't exactly the way I had it. After fixing it up again I keep getting these errors, I'm kind of new to java so please explain.

    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;
        }
    }
}

Just in case someone see's something wrong in the manifest that I dont see.

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

Try :

  1. Remove import com.sundaysalmody.R; from your list of imports in your SundayPsalmody Activity
  2. Check whether all your Activities are properly declared in Manifest.xml file.
  3. Clean and Build your project.
  4. Run the Application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM