简体   繁体   English

我在 Android Studio 上的 Create 上运行错误

[英]I have run error at on Create on Android studio

I get a massage says "app is keep stopping" when I run the project on my mobile.当我在我的手机上运行项目时,我得到一个按摩说“应用程序一直在停止”。 the error at on Create(MainActivity.java:16) at the line 16 set Content View method help me第 16 行的 Create(MainActivity.java:16) 上的错误设置内容视图方法帮助我

The method setContentView() sets the View that your MainActivity should display.方法setContentView()设置您的MainActivity应该显示的View

The View is usually declared in layout/activity_main.xml . View通常在layout/activity_main.xml中声明。

Some error seems to appear when trying to call this method in your application.尝试在应用程序中调用此方法时似乎出现了一些错误。


A common reason why android applications crash there is calling some methods in the overridden method onCreate(Bundle savedInstanceState) in a wrong order. android 应用程序崩溃的一个常见原因是在被覆盖的方法onCreate(Bundle savedInstanceState)中以错误的顺序调用某些方法。

Check if your code follows this pattern:检查您的代码是否遵循以下模式:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // setContentView call
    
    // other things
}

I cannot help you further now, please copy and paste the stacktrace (crash information) into your question.我现在无法进一步帮助您,请将堆栈跟踪(崩溃信息)复制并粘贴到您的问题中。 When your application just crashed on an emulator, you can see it in the Run-section (usually red text).当您的应用程序刚刚在模拟器上崩溃时,您可以在运行部分看到它(通常是红色文本)。

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

相关问题 我在Android Studio中出现“膨胀异常”错误 - I have an “inflate exception” error in Android Studio 我在Android Studio中遇到错误“无法解决junit:4.12” - I have an error in Android studio “Failed to resolve junit:4.12” 我在 android studio 上有一个 R.Layout.main 错误 - I have an R.Layout.main error on android studio 在Android Studio中,关于onBackPressed()有一些错误 - In Android Studio, I have some error about onBackPressed() 升级到新的Android Studio后,我一直遇到错误 - After upgrading to the new Android Studio I have been having error 当我尝试在模拟器android studio上运行app时出错 - error when i try to run app on emulator android studio Android Studio,运行我的应用程序时出现系统错误 - Android Studio, System error when i run my application 在 android studio 中运行代码时出现错误 - I am having an error when run code in android studio 当我在智能手机上运行该应用程序时出现错误,但如果我在Android Studio上运行该应用程序,则该错误是正确的 - Error when I run the app on my smartphone, but its correct If I run the app on Android Studio 简单的 android 工作室应用程序在我运行时崩溃。 它没有错误 - Simple android studio app is crashing when i run it. it have no errors
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM