Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 不幸的是';app&x27;已停止工作-无错误_Android_Debugging - Fatal编程技术网

Android 不幸的是';app&x27;已停止工作-无错误

Android 不幸的是';app&x27;已停止工作-无错误,android,debugging,Android,Debugging,我的应用程序“不幸停止工作”,但在调试中似乎没有错误。到目前为止,它只是几个按钮和一个按钮的文本,我试图连接到一个新的活动。 这是正在运行的控制台 Waiting for device. Target device: Nexus_6_API_22 [emulator-5554] Uploading file local path: C:\Users\CALLUM\AndroidStudioProjects\Switch-game2\app\build\outputs\apk\app-debug.

我的应用程序“不幸停止工作”,但在调试中似乎没有错误。到目前为止,它只是几个按钮和一个按钮的文本,我试图连接到一个新的活动。 这是正在运行的控制台

Waiting for device.
Target device: Nexus_6_API_22 [emulator-5554]
Uploading file
local path: C:\Users\CALLUM\AndroidStudioProjects\Switch-game2\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/gameswitch.switch_game
No apk changes detected. Skipping file upload, force stopping package instead.
DEVICE SHELL COMMAND: am force-stop gameswitch.switch_game
Launching application: gameswitch.switch_game/gameswitch.switch_game.MainActivity.
DEVICE SHELL COMMAND: am start -D -n "gameswitch.switch_game/gameswitch.switch_game.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=gameswitch.switch_game/.MainActivity }
Connected to the target VM, address: 'localhost:8610', transport: 'socket'
Disconnected from the target VM, address: 'localhost:8610', transport: 'socket'
这是我的密码

<?xml version="1.0" encoding="utf-8"?>
其余的类和co都是标准字符串之类的东西。 我对Android Studio中的编程非常陌生,我真的不确定发生了什么,因为我看不到下划线或错误

由于再次运行,出现的错误如下

Process: gameswitch.switch_game, PID: 2774
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=GamePlay }
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1781)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1501)
        at android.app.Activity.startActivityForResult(Activity.java:3745)
        at android.app.Activity.startActivityForResult(Activity.java:3706)
        at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:820)
        at android.app.Activity.startActivity(Activity.java:4016)
        at android.app.Activity.startActivity(Activity.java:3984)
        at gameswitch.switch_game.MainActivity$1.onClick(MainActivity.java:32)
        at android.view.View.performClick(View.java:4780)
        at android.view.View$PerformClick.run(View.java:19866)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5257)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
你的意图是错误的。 您应该明确地设置活动

 Intent intent = new Intent(this, GamePlay.class);
或者使用您在清单中声明的操作

 Intent intent = new Intent();
 intent.setAction("in.wptrafficanalyzer.AnotherActivity");

您的代码失败,因为您启动了一个未声明的操作。

您是否尝试查看日志猫?此外,应用程序是否挂起?如果你在启动其他活动时在UI线程上做了大量工作,那么可能会导致崩溃。好吧,我再次运行了它,这次它挂起的时间稍长,我有一个崩溃错误,这更好。然而,在我的实际代码中,仍然没有任何东西被下划线为错误。啊,是的,我现在可以看到,这是有意义的。谢谢你澄清这一点。
 Intent intent = new Intent(this, GamePlay.class);
 Intent intent = new Intent();
 intent.setAction("in.wptrafficanalyzer.AnotherActivity");