当在eclipse上打开一个android项目时我遇到了一些错误

时间:2014-03-14 17:28:16

标签: java android eclipse

我更新我的操作系统赢得8.1。然后我安装了adt bundle。当我在eclipse上创建一个项目时,它创建没有任何活动的项目。我的意思是src文件是空的,也没有像main_activity.xml这样的xml文件。顺便说一句,我可以调试我在win7上开发的旧应用程序。 然后我更新我的sdk.This它创建活动但作为actionBarActivity.I意味着MainActivity extedns ActionBarActivity.Also当在我的工作区上自动创建文件夹appcompatv_7上创建的项目。然后我编码它在我的手机上不起作用,但我知道代码完全正确。请帮助我。 我删除了adt并重新安装。 我检查更新.Eclipse没有找到任何更新。 enter image description here

enter image description here

enter image description here enter image description here

我的sdk管理看起来像 enter image description here

1 个答案:

答案 0 :(得分:0)

您可以通过以下方式进行自己的活动:src> com.example.projectName。右键单击此按钮,然后创建一个新类。使该类扩展Activity。

如果您希望Eclipse为您制作main_activity,那么您可能没有"检查"与新的Android应用程序项目一起创建新活动的复选框之一。为此,请执行以下操作:

1. File > new > android project
2. A new window should appear. Name your android application as usual, and click next.
3. This step is important. You must check the "Create Activity" checkbox. You probably did not do this the first time, which was why
you had an empty android application project.
4. Click next until you see the "Create Activity" option. You can choose from either a blank activity, Fullscreen activity, or
Master/detail flow. Click the "blank activity" in order to get a
normal activity (and when I say normal activity, I mean the
MainActivity.java and the main_activity.xml)

此外,每当您在预先存在的项目中进行新活动时,请务必仔细阅读所有选项。右键单击src文件夹中的包,按new> android活动,并仔细阅读所有选项。

我希望这会对你有所帮助。

相关问题