On creating a new Android Application Project, MainActivity.java
under its package name should be generated automatically in src folder & activity_main.xml
should be created inside layout folder. But it is not created.
关于创建一个新的Android应用程序项目,MainActivity。它的包名称下的java应该在src文件夹和activity_main中自动生成。xml应该在布局文件夹中创建。但它并没有被创造出来。
And also in manifest it doesn`t generate this POC
而且显然它不会生成POC。
<activity
android:name="info.androidhive.slidingmenu.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However, I added all these things manually.
但是,我手动添加了所有这些东西。
-
activity_main.xml then shows this error
activity_main。然后,xml显示这个错误。
Eclipse is loading framework information and the layout library from the SDK folder. activity_main.xml will refresh automatically once the process is finished.
-
MainActivity.java doesn't recognize the layout field in
setContentView(R.layout.activity_main)
MainActivity。java不承认setContentView(R.layout.activity_main)中的布局字段。
And yesterday I downloalded the updates from SDK Manager these tools are installed /updated
昨天,我从SDK管理器中删除了这些工具的更新。
I tried cleaning the project,changing the workspace,restarting the eclipse & windows but it doesn't helps :(
我尝试了清理项目、更改工作空间、重新启动eclipse和windows,但这并没有帮助:(
9 个解决方案
#1
6
As one guy said
一个人说过
I had the same problem even though I downloaded the Android SDK and did a clean install, but I just resolved it. I tried to click "Help" -> "Check for updates", and then I got a pop-up message saying everything was up to date, but after further research it appeared to me it wasn't up to date. What you need to do is click "Help" -> "Install new software" and install (this will update it) from this url: https://dl-ssl.google.com/android/eclipse/
我也有同样的问题,尽管我下载了Android SDK并进行了一个干净的安装,但我只是解决了它。我试着点击“帮助”->“检查更新”,然后我得到一个弹出消息,说一切都是最新的,但在进一步的研究之后,我发现它不是最新的。你需要做的是点击“帮助”->“安装新软件”并安装(这将更新它)从这个url: https://dl-ssl.google.com/android/eclipse/ !
See here thread https://code.google.com/p/android/issues/detail?id=66647
在这里看到的线程https://code.google.com/p/android/issues/detail?id=66647
#2
13
I solved problem by changing method while creating new project... Don't know why but after updating ADT to latest version, when we create "blank activity", it generates empty src and res folders but if we create new "Empty activity", it generates default hello world program like in previous versions of ADT.... SO just click on create empty activity when new android project is to be added
我在创建新项目时通过改变方法解决了问题……不知道为什么但ADT更新为最新版本后,当我们创建“空白活动”时,它生成空src和res文件夹但是如果我们创建新的“空活动”,它生成默认的hello world程序在早期版本的ADT ....因此,当新的android项目被添加时,点击创建空活动。
#3
2
Same thing happened to me couple days ago after updating SDK through android SDK Manager. When I rebooted eclipse, I got a pop-up saying my Android Development Tool (ADT) or a plugin for Eclipse needs update to version 22.6.2
同样的事情发生在几天前,更新了SDK通过android SDK管理器。当我重启eclipse时,我得到了一个弹出式说我的Android开发工具(ADT)或一个eclipse的插件需要更新到版本22.6.2。
Here is the information http://developer.android.com/tools/sdk/eclipse-adt.html
这里是http://developer.android.com/tools/sdk/eclipseadt.html。
and click updating ADT, the download instructions are in there.
点击更新ADT,下载说明就在里面。
I copied it out here just in case,
我把它复制到这里,以防万一,
Download the ADT Plugin Start Eclipse, then select Help > Install New Software. Click Add, in the top-right corner. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/ Note: The Android Developer Tools update site requires a secure connection. Make sure the update site URL you enter starts with HTTPS. Click OK. In the Available Software dialog, select the checkbox next to Developer Tools and click Next. In the next window, you'll see a list of the tools to be downloaded. Click Next. Read and accept the license agreements, then click Finish. If you get a security warning saying that the authenticity or validity of the software can't be established, click OK. When the installation completes, restart Eclipse.
下载ADT插件启动Eclipse,然后选择帮助>安装新软件。点击添加,在右上角。在出现的“添加存储库”对话框中,输入“ADT插件”的名称和以下URL地址:https://dl-ssl.google.com/android/eclipse/注意:Android开发工具更新站点需要一个安全连接。确保您输入的更新站点URL以HTTPS开始。单击OK。在可用的软件对话框中,选择开发工具旁边的复选框,然后单击next。在下一个窗口中,您将看到要下载的工具列表。单击Next。阅读并接受许可协议,然后单击Finish。如果你得到一个安全警告,说软件的真实性或有效性无法建立,点击确定。安装完成后,重新启动Eclipse。
Hope this helps.
希望这个有帮助。
#4
0
There is an option to select whether to generate MainActivity
and activity_main.xml
. Are you sure that you have selected those ? Make sure to select that.
可以选择是否生成MainActivity和activity_main.xml。你确定你已经选好了吗?一定要选择那个。
Without that, my project looks the same as yours:
没有这个,我的项目和你的一样:
#5
0
Those solutions didn't work for me too, but what resolve the problem for me was deleting the appcompat projects that are auto-created when we create a new android application project.
这些解决方案对我也没用,但是解决问题的方法是在创建新的android应用程序项目时删除自动创建的appcompat项目。
#6
0
I was having the same problem. I tried creating the project with a different Target SDK. I used API 16 Android 4.1 and that worked.
我也有同样的问题。我尝试用一个不同的目标SDK来创建项目。我使用了API 16 Android 4.1,这很有效。
#7
0
I was also facing the same problem, had the adt and sdk tool updated to v23 which was released on 6/24. Created a project with Target SDK - AP1 16 and compile with API 19 and activity was created.
我也面临同样的问题,adt和sdk工具更新到v23,在6/24发布。创建了一个目标SDK - AP1 16的项目,并创建了API 19和活动。
#8
0
I have solved this problem in the following way.
我用下列方法解决了这个问题。
- Download Eclipse from official site ( current version 4.4.0 Luna).
- 从官方网站下载Eclipse(当前版本4.4.0 Luna)。
- Install it.
- 安装它。
- Run Eclipse Help->Install new software
- 运行Eclipse帮助->安装新软件。
- Enter in empty top field `https://dl-ssl.google.com/android/eclipse/ click add and name it as you want , for instance AndroidPlugin
- 输入空的*域名https://dl-ssl.google.com/android/eclipse/点击添加并命名为你想要的,例如AndroidPlugin。
- Install all software( Developes tools)
- 安装所有软件(开发工具)
- Restart Eclipse
- 重新启动Eclipse
- Eclipse should show error message that your sdk is not found
- Eclipse应该显示您的sdk未找到的错误消息。
- Specify your SDK in Use existing sdk .
- 在使用现有SDK中指定SDK。
- Restart Eclipse.
- 重新启动Eclipse。
#9
0
Since this query isn't solved, I would like to add from my experience;
由于这个查询没有被解决,我想从我的经验中添加;
I agree with "SK17" 's advice.. The latest eclipse software somehow generates the MainActivity.xml file by choosing 'Empty Activity' instead of 'Blank Activity'.
我同意“SK17”的建议。最新的eclipse软件以某种方式生成了主要活动。xml文件选择“空活动”而不是“空白活动”。
Nevertheless, for some systems, you might also try changing the target SDK to Android 'JellyBean' or 'KitKat' rather than 'API21'.
不过,对于某些系统,你也可以尝试将目标SDK改为Android“JellyBean”或“KitKat”,而不是“API21”。
#1
6
As one guy said
一个人说过
I had the same problem even though I downloaded the Android SDK and did a clean install, but I just resolved it. I tried to click "Help" -> "Check for updates", and then I got a pop-up message saying everything was up to date, but after further research it appeared to me it wasn't up to date. What you need to do is click "Help" -> "Install new software" and install (this will update it) from this url: https://dl-ssl.google.com/android/eclipse/
我也有同样的问题,尽管我下载了Android SDK并进行了一个干净的安装,但我只是解决了它。我试着点击“帮助”->“检查更新”,然后我得到一个弹出消息,说一切都是最新的,但在进一步的研究之后,我发现它不是最新的。你需要做的是点击“帮助”->“安装新软件”并安装(这将更新它)从这个url: https://dl-ssl.google.com/android/eclipse/ !
See here thread https://code.google.com/p/android/issues/detail?id=66647
在这里看到的线程https://code.google.com/p/android/issues/detail?id=66647
#2
13
I solved problem by changing method while creating new project... Don't know why but after updating ADT to latest version, when we create "blank activity", it generates empty src and res folders but if we create new "Empty activity", it generates default hello world program like in previous versions of ADT.... SO just click on create empty activity when new android project is to be added
我在创建新项目时通过改变方法解决了问题……不知道为什么但ADT更新为最新版本后,当我们创建“空白活动”时,它生成空src和res文件夹但是如果我们创建新的“空活动”,它生成默认的hello world程序在早期版本的ADT ....因此,当新的android项目被添加时,点击创建空活动。
#3
2
Same thing happened to me couple days ago after updating SDK through android SDK Manager. When I rebooted eclipse, I got a pop-up saying my Android Development Tool (ADT) or a plugin for Eclipse needs update to version 22.6.2
同样的事情发生在几天前,更新了SDK通过android SDK管理器。当我重启eclipse时,我得到了一个弹出式说我的Android开发工具(ADT)或一个eclipse的插件需要更新到版本22.6.2。
Here is the information http://developer.android.com/tools/sdk/eclipse-adt.html
这里是http://developer.android.com/tools/sdk/eclipseadt.html。
and click updating ADT, the download instructions are in there.
点击更新ADT,下载说明就在里面。
I copied it out here just in case,
我把它复制到这里,以防万一,
Download the ADT Plugin Start Eclipse, then select Help > Install New Software. Click Add, in the top-right corner. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/ Note: The Android Developer Tools update site requires a secure connection. Make sure the update site URL you enter starts with HTTPS. Click OK. In the Available Software dialog, select the checkbox next to Developer Tools and click Next. In the next window, you'll see a list of the tools to be downloaded. Click Next. Read and accept the license agreements, then click Finish. If you get a security warning saying that the authenticity or validity of the software can't be established, click OK. When the installation completes, restart Eclipse.
下载ADT插件启动Eclipse,然后选择帮助>安装新软件。点击添加,在右上角。在出现的“添加存储库”对话框中,输入“ADT插件”的名称和以下URL地址:https://dl-ssl.google.com/android/eclipse/注意:Android开发工具更新站点需要一个安全连接。确保您输入的更新站点URL以HTTPS开始。单击OK。在可用的软件对话框中,选择开发工具旁边的复选框,然后单击next。在下一个窗口中,您将看到要下载的工具列表。单击Next。阅读并接受许可协议,然后单击Finish。如果你得到一个安全警告,说软件的真实性或有效性无法建立,点击确定。安装完成后,重新启动Eclipse。
Hope this helps.
希望这个有帮助。
#4
0
There is an option to select whether to generate MainActivity
and activity_main.xml
. Are you sure that you have selected those ? Make sure to select that.
可以选择是否生成MainActivity和activity_main.xml。你确定你已经选好了吗?一定要选择那个。
Without that, my project looks the same as yours:
没有这个,我的项目和你的一样:
#5
0
Those solutions didn't work for me too, but what resolve the problem for me was deleting the appcompat projects that are auto-created when we create a new android application project.
这些解决方案对我也没用,但是解决问题的方法是在创建新的android应用程序项目时删除自动创建的appcompat项目。
#6
0
I was having the same problem. I tried creating the project with a different Target SDK. I used API 16 Android 4.1 and that worked.
我也有同样的问题。我尝试用一个不同的目标SDK来创建项目。我使用了API 16 Android 4.1,这很有效。
#7
0
I was also facing the same problem, had the adt and sdk tool updated to v23 which was released on 6/24. Created a project with Target SDK - AP1 16 and compile with API 19 and activity was created.
我也面临同样的问题,adt和sdk工具更新到v23,在6/24发布。创建了一个目标SDK - AP1 16的项目,并创建了API 19和活动。
#8
0
I have solved this problem in the following way.
我用下列方法解决了这个问题。
- Download Eclipse from official site ( current version 4.4.0 Luna).
- 从官方网站下载Eclipse(当前版本4.4.0 Luna)。
- Install it.
- 安装它。
- Run Eclipse Help->Install new software
- 运行Eclipse帮助->安装新软件。
- Enter in empty top field `https://dl-ssl.google.com/android/eclipse/ click add and name it as you want , for instance AndroidPlugin
- 输入空的*域名https://dl-ssl.google.com/android/eclipse/点击添加并命名为你想要的,例如AndroidPlugin。
- Install all software( Developes tools)
- 安装所有软件(开发工具)
- Restart Eclipse
- 重新启动Eclipse
- Eclipse should show error message that your sdk is not found
- Eclipse应该显示您的sdk未找到的错误消息。
- Specify your SDK in Use existing sdk .
- 在使用现有SDK中指定SDK。
- Restart Eclipse.
- 重新启动Eclipse。
#9
0
Since this query isn't solved, I would like to add from my experience;
由于这个查询没有被解决,我想从我的经验中添加;
I agree with "SK17" 's advice.. The latest eclipse software somehow generates the MainActivity.xml file by choosing 'Empty Activity' instead of 'Blank Activity'.
我同意“SK17”的建议。最新的eclipse软件以某种方式生成了主要活动。xml文件选择“空活动”而不是“空白活动”。
Nevertheless, for some systems, you might also try changing the target SDK to Android 'JellyBean' or 'KitKat' rather than 'API21'.
不过,对于某些系统,你也可以尝试将目标SDK改为Android“JellyBean”或“KitKat”,而不是“API21”。