简体   繁体   English

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

[英]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. 再次修复后,我仍然收到这些错误,我是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;
        }
    }
}

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; 删除import com.sundaysalmody.R; from your list of imports in your SundayPsalmody Activity 从您的SundayPsalmody活动中的进口清单中
  2. Check whether all your Activities are properly declared in Manifest.xml file. 检查是否在Manifest.xml文件中正确声明了所有Activities
  3. Clean and Build your project. 清理并构建您的项目。
  4. Run the Application 运行应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.RuntimeException:无法实例化活动 - java.lang.RuntimeException: Unable to instantiate activity java.lang.RuntimeException:无法实例化活动 - java.lang.RuntimeException: Unable to instantiate activity java.lang.RuntimeException:无法实例化活动 - java.lang.RuntimeException: Unable to instantiate the activity java.lang.RuntimeException:无法实例化活动 ComponentInfo - 不是搜索活动 - java.lang.RuntimeException: Unable to instantiate activity ComponentInfo - not search activity java.lang.RuntimeException:无法实例化活动ComponentInfo - NFC访问 - java.lang.RuntimeException: Unable to instantiate activity ComponentInfo - NFC access 错误:java.lang.RuntimeException:无法实例化活动 - Error: java.lang.RuntimeException: Unable to instantiate activity java.lang.RuntimeException:无法实例化活动错误 - java.lang.RuntimeException: Unable to instantiate activity error java.lang.RuntimeException:无法为 Kotlin MainActivity 实例化活动 ComponentInfo - java.lang.RuntimeException: Unable to instantiate activity ComponentInfo for Kotlin MainActivity java.lang.RuntimeException:无法实例化活动…(Android Studio) - java.lang.RuntimeException: Unable to instantiate activity…(android studio) java.lang.RuntimeException:无法实例化活动ComponentInfo(PhoneGap) - java.lang.RuntimeException: Unable to instantiate activity ComponentInfo (PhoneGap)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM