Eclipse不创建主活动和布局

时间:2022-08-12 21:12:49

I can't start new projects anymore. This is what I do...

我不能再开始新的项目了。这就是我所做的……

  • Start Eclipse.
  • 启动Eclipse。
  • New Android Application
    • min API 8
    • 分钟API 8
    • target API 18
    • 目标API 18
    • compile API 19
    • 编译API 19
    • create activity : checked
    • 创建活动:检查
    • activity name : MainActivity
    • 活动名称:MainActivity
    • layout name : activity_main
    • 布局名称:activity_main
    • finish
    • 完成
  • 新Android应用程序minapi 8目标API 18编译API 19创建活动:勾选活动名称:MainActivity layout name: activity_main finish。

When I open the project (it doesn't even open MainActivity.java as it should be) : - src folder is empty - res/layout folder is empty

当我打开项目时(它甚至不打开主活动。- src文件夹为空- res/layout文件夹为空

But AndroidManifest.xml exists. It was working perfectly before and I was able to create projects then it just suddenly broke.

但AndroidManifest。xml的存在。以前它运行得很好,我可以创建项目,但突然就坏了。

I'm using APIs 18 and 19 all installed and up to date.

我使用的api是18和19,都是最新安装的。

7 个解决方案

#1


8  

I had the same problem yesterday after updating the latest packages on the Android SDK Manager.

昨天我在Android SDK管理器上更新了最新的包后遇到了同样的问题。

Fixed it by updating the Eclipse plugin: Run Eclipse > Help > Install new software > Paste the URL https://dl-ssl.google.com/android/eclipse/ then press Enter. After updating the plugin, I created a test project with the main activity and menu was created by default as normal.

通过更新Eclipse插件来修复它:运行Eclipse >帮助>安装新的软件>粘贴URL https://dl-ssl.google.com/android/eclipse/然后按Enter。在更新插件之后,我创建了一个带有主活动的测试项目,菜单是默认创建的。

#2


2  

I have the same problem before.

我以前也有同样的问题。

Using this Eclipse Update http://dl-ssl.google.com/android/eclipse/ did not work for me. I notice this problem when I download the latest updated SDK

使用这个Eclipse更新http://dl-ssl.google.com/android/eclipse/对我来说不合适。我在下载最新更新的SDK时注意到了这个问题

Eclipse不创建主活动和布局

Luckily the solution to my problem is very easy. Eclipse不创建主活动和布局

幸运的是,我的问题的解决方法很简单。

By Selecting Empty Project instead of Blank Activity makes it working.

通过选择空项目而不是空活动,可以使其工作。

#3


0  

I had a problem with opening the layout folder. I needed a xml file with the contents as below:

打开布局文件夹有个问题。我需要一个包含以下内容的xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
</LinearLayout>

So,this is what I did.I tried updating eclipse but, the problem persisted. So,I just created a new xml file by right-clicking the layout folder.After creating the file,I just copy-pasted the aforementioned content.Hope it helps!

这就是我所做的。我尝试更新eclipse,但问题依然存在。因此,我只是通过右键单击布局文件夹创建了一个新的xml文件。创建文件之后,我只是复制了上述内容。希望它可以帮助!

#4


0  

It happened to me too. It suddenly stopped creating MainActivity.java and layout. I could fix it by updating Eclipse:
Help -> Check for updates -> Select all

这也发生在我身上。它突然停止了主要活动。java和布局。我可以通过更新Eclipse: Help ->检查更新->选择all来修复它

#5


0  

I had the same problema also. I fixed the problem follow the Werner recomendation. Eclipse --> Help --> Install new software --> Pasted URL http://dl-ssl.google.com/android/eclipse/ pressed Enter, but It's important check it out and remove before any copy of the plugin installed in available Software Sites.

我也有同样的问题。我在沃纳康复后修复了这个问题。Eclipse——>帮助——>安装新软件——>粘贴了URL http://dl-ssl.google.com/android/eclipse/ pressed Enter,但重要的是,在可用软件站点中安装插件之前,请检查并删除插件。

#6


0  

I had the same problem also. I fixed the problem follow the Werner recomendation. Eclipse --> Help --> Install new software --> Pasted URL http://dl-ssl.google.com/android/eclipse/ It fixed my problem.

我也有同样的问题。我在沃纳康复后修复了这个问题。Eclipse——>帮助——>安装新软件——>粘贴URL http://dl-ssl.google.com/android/eclipse/它解决了我的问题。

#7


0  

I've just had the same issue on Mac 10.9.1. For what appears to be no reason, when creating a new android project, the "src" directory is empty, and there's no activity_main.xml. I tried Werner's fix, but the URL had issues trying to download the files. Deleted Eclipse, and re-installed. This appears to have fixed the issue.

我刚刚在Mac 10.9.1上遇到了同样的问题。似乎没有理由,在创建一个新的android项目时,“src”目录是空的,并且没有activity_main.xml。我尝试了沃纳的修复,但URL有问题下载文件。删除Eclipse和安装。这似乎已经解决了这个问题。

Actually - still having this issue, even after re-installing Eclipse...

实际上——仍然有这个问题,即使在重新安装Eclipse之后…

#1


8  

I had the same problem yesterday after updating the latest packages on the Android SDK Manager.

昨天我在Android SDK管理器上更新了最新的包后遇到了同样的问题。

Fixed it by updating the Eclipse plugin: Run Eclipse > Help > Install new software > Paste the URL https://dl-ssl.google.com/android/eclipse/ then press Enter. After updating the plugin, I created a test project with the main activity and menu was created by default as normal.

通过更新Eclipse插件来修复它:运行Eclipse >帮助>安装新的软件>粘贴URL https://dl-ssl.google.com/android/eclipse/然后按Enter。在更新插件之后,我创建了一个带有主活动的测试项目,菜单是默认创建的。

#2


2  

I have the same problem before.

我以前也有同样的问题。

Using this Eclipse Update http://dl-ssl.google.com/android/eclipse/ did not work for me. I notice this problem when I download the latest updated SDK

使用这个Eclipse更新http://dl-ssl.google.com/android/eclipse/对我来说不合适。我在下载最新更新的SDK时注意到了这个问题

Eclipse不创建主活动和布局

Luckily the solution to my problem is very easy. Eclipse不创建主活动和布局

幸运的是,我的问题的解决方法很简单。

By Selecting Empty Project instead of Blank Activity makes it working.

通过选择空项目而不是空活动,可以使其工作。

#3


0  

I had a problem with opening the layout folder. I needed a xml file with the contents as below:

打开布局文件夹有个问题。我需要一个包含以下内容的xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
</LinearLayout>

So,this is what I did.I tried updating eclipse but, the problem persisted. So,I just created a new xml file by right-clicking the layout folder.After creating the file,I just copy-pasted the aforementioned content.Hope it helps!

这就是我所做的。我尝试更新eclipse,但问题依然存在。因此,我只是通过右键单击布局文件夹创建了一个新的xml文件。创建文件之后,我只是复制了上述内容。希望它可以帮助!

#4


0  

It happened to me too. It suddenly stopped creating MainActivity.java and layout. I could fix it by updating Eclipse:
Help -> Check for updates -> Select all

这也发生在我身上。它突然停止了主要活动。java和布局。我可以通过更新Eclipse: Help ->检查更新->选择all来修复它

#5


0  

I had the same problema also. I fixed the problem follow the Werner recomendation. Eclipse --> Help --> Install new software --> Pasted URL http://dl-ssl.google.com/android/eclipse/ pressed Enter, but It's important check it out and remove before any copy of the plugin installed in available Software Sites.

我也有同样的问题。我在沃纳康复后修复了这个问题。Eclipse——>帮助——>安装新软件——>粘贴了URL http://dl-ssl.google.com/android/eclipse/ pressed Enter,但重要的是,在可用软件站点中安装插件之前,请检查并删除插件。

#6


0  

I had the same problem also. I fixed the problem follow the Werner recomendation. Eclipse --> Help --> Install new software --> Pasted URL http://dl-ssl.google.com/android/eclipse/ It fixed my problem.

我也有同样的问题。我在沃纳康复后修复了这个问题。Eclipse——>帮助——>安装新软件——>粘贴URL http://dl-ssl.google.com/android/eclipse/它解决了我的问题。

#7


0  

I've just had the same issue on Mac 10.9.1. For what appears to be no reason, when creating a new android project, the "src" directory is empty, and there's no activity_main.xml. I tried Werner's fix, but the URL had issues trying to download the files. Deleted Eclipse, and re-installed. This appears to have fixed the issue.

我刚刚在Mac 10.9.1上遇到了同样的问题。似乎没有理由,在创建一个新的android项目时,“src”目录是空的,并且没有activity_main.xml。我尝试了沃纳的修复,但URL有问题下载文件。删除Eclipse和安装。这似乎已经解决了这个问题。

Actually - still having this issue, even after re-installing Eclipse...

实际上——仍然有这个问题,即使在重新安装Eclipse之后…