Android:ActivityThread.performLaunchActivity 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3008745/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:15:41  来源:igfitidea点击:

Android: ActivityThread.performLaunchActivity error

android

提问by Sachin

I'm getting an ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,Intent) error each time I boot up my program in the debugger. The program won't even start up! Any help would be greatly appreciated! I'm very new to this environment. Let me know if you need anymore information/code to help me out.

每次我在调试器中启动我的程序时,我都会收到 ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord,Intent) 错误。该程序甚至不会启动!任何帮助将不胜感激!我对这个环境很陌生。如果您需要更多信息/代码来帮助我,请告诉我。

Here is my logcat:

这是我的日志:

06-09 11:16:26.848: ERROR/vold(27): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
06-09 11:16:26.848: ERROR/vold(27): Error bootstrapping switch '/sys/class/switch/test2' (No such file or directory)
06-09 11:16:26.848: ERROR/vold(27): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
06-09 11:16:26.848: ERROR/vold(27): Error bootstrapping switch '/sys/class/switch/test' (No such file or directory)
06-09 11:16:37.887: ERROR/MemoryHeapBase(53): error opening /dev/pmem: No such file or directory
06-09 11:16:37.887: ERROR/SurfaceFlinger(53): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
06-09 11:16:37.927: ERROR/libEGL(53): couldn't load <libhgl.so> library (Cannot load library: load_library[984]: Library 'libhgl.so' not found)
06-09 11:16:38.407: ERROR/libEGL(64): couldn't load <libhgl.so> library (Cannot load library: load_library[984]: Library 'libhgl.so' not found)
06-09 11:16:41.358: ERROR/BatteryService(53): Could not open '/sys/class/power_supply/usb/online'
06-09 11:16:41.367: ERROR/BatteryService(53): Could not open '/sys/class/power_supply/battery/batt_vol'
06-09 11:16:41.367: ERROR/BatteryService(53): Could not open '/sys/class/power_supply/battery/batt_temp'
06-09 11:16:41.667: ERROR/EventHub(53): could not get driver version for /dev/input/mouse0, Not a typewriter
06-09 11:16:41.667: ERROR/EventHub(53): could not get driver version for /dev/input/mice, Not a typewriter
06-09 11:16:41.797: ERROR/System(53): Failure starting core service
06-09 11:16:41.797: ERROR/System(53): java.lang.SecurityException
06-09 11:16:41.797: ERROR/System(53):     at android.os.BinderProxy.transact(Native Method)
06-09 11:16:41.797: ERROR/System(53):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
06-09 11:16:41.797: ERROR/System(53):     at android.os.ServiceManager.addService(ServiceManager.java:72)
06-09 11:16:41.797: ERROR/System(53):     at com.android.server.ServerThread.run(SystemServer.java:162)
06-09 11:16:41.797: ERROR/AndroidRuntime(53): Crash logging skipped, no checkin service
06-09 11:16:42.777: ERROR/LockPatternKeyguardView(53): Failed to bind to GLS while checking for account
06-09 11:16:46.557: ERROR/ActivityThread(111): Failed to find provider info for com.google.settings
06-09 11:16:46.577: ERROR/ActivityThread(111): Failed to find provider info for com.google.settings 
06-09 11:16:49.087: ERROR/ApplicationContext(53): Couldn't create directory for SharedPreferences file shared_prefs/wallpaper-hints.xml
06-09 11:16:51.146: ERROR/ActivityThread(108): Failed to find provider info for android.server.checkin
06-09 11:16:54.266: ERROR/ActivityThread(108): Failed to find provider info for android.server.checkin
06-09 11:16:54.416: ERROR/ActivityThread(108): Failed to find provider info for android.server.checkin
06-09 11:16:56.336: ERROR/MediaPlayerService(31): Couldn't open fd for content://settings/system/notification_sound
06-09 11:16:56.356: ERROR/MediaPlayer(53): Unable to to create media player
06-09 11:16:56.637: ERROR/AndroidRuntime(201): Uncaught handler: thread main exiting due to uncaught exception
06-09 11:16:56.757: ERROR/AndroidRuntime(201): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.svgeeks.kidneytest/com.svgeeks.kidneytest.KidneyTest}: java.lang.ClassCastException: android.widget.EditText
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.app.ActivityThread.access00(ActivityThread.java:116)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.os.Looper.loop(Looper.java:123)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.app.ActivityThread.main(ActivityThread.java:4203)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at java.lang.reflect.Method.invokeNative(Native Method)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at java.lang.reflect.Method.invoke(Method.java:521)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at dalvik.system.NativeStart.main(Native Method)
06-09 11:16:56.757: ERROR/AndroidRuntime(201): Caused by: java.lang.ClassCastException: android.widget.EditText
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at com.svgeeks.kidneytest.KidneyTest.onCreate(KidneyTest.java:57)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
06-09 11:16:56.757: ERROR/AndroidRuntime(201):     ... 11 more
06-09 11:16:56.876: ERROR/dalvikvm(201): Unable to open stack trace file '/data/anr/traces.txt': Permission denied

回答by m6tt

Your problem is on line 57 of KidneyTest.

您的问题出在 KidneyTest 的第 57 行。

The error stack complaining of a ClassCastException which is thrown when a program attempts to cast an object to a type with which it is not compatible.

错误堆栈抱怨 ClassCastException 当程序尝试将对象强制转换为与其不兼容的类型时抛出该异常。

It looks like you are trying to cast and EditText as something it is not.

看起来您正在尝试将 EditText 转换为并非如此。

Edit: Good tip for decoding the error stack, look for the line that says Caused by:This line will give you a reason for the error and the line below will show you where the error is happening and will include a line reference so you can easily find the problem.

编辑:解码错误堆栈的好提示,查找显示原因的行此行将为您提供错误原因,下面的行将向您显示错误发生的位置并包含行引用,以便您可以很容易发现问题。

回答by Najaf Ali

yes exactly it is due to some missing id that you are not using in XML and try to initialize in your java file or somewhat keywords missing, name mismatch etc.

是的,正是由于缺少一些您没有在 XML 中使用的 id 并尝试在您的 java 文件中进行初始化,或者缺少一些关键字、名称不匹配等。

it is due to some widget that is not mention in XML and you are trying to get it in your layout i have experience this i was getting linear layout id , even that was not mention in XML or used in .

这是由于一些小部件在 XML 中未提及,而您正试图在您的布局中获取它