3

I just updated to Ubuntu 12.04 LTS, and installed Eclipse (via Ubuntu Software Center). I also installed the Android SDK and the plugin on Eclipse, however, I imported an old project (which was working correctly before) to it, and it don't even has generated R.java file.

In gen/<my-package> directory there is only a file named BuildConfig.java.

I tryied removing all the warnings from my xml files, and Build, Clean, etc, but it doesn't work.

I dont know if I'm missing some lib or what, because this project was being executed corrected on Eclipse before I installed Ubuntu 12.04 LTS.

I tried creating a new project and check if it creates the R.java file, however, it wasn't created. Maybe the problem is with the eclipse.


UPDATE

The same problem is happening to IntelliJ.


Please help me with this issue. Thanks.

rogcg
  • 10,451
  • 20
  • 91
  • 133
  • 1
    try creating a new blank project and see if it creates and runs successfully. Every now and then I've had a project folder get broken for one reason or another and it will work if I create a new project and paste the source files from the other in to the new. If your new project works correctly I'd suggest going that route. – FoamyGuy Apr 25 '12 at 00:07
  • @Tim I just created a new project and it didnt generates the file automatically. It shows the same error, as if the R.java didnt exists. – rogcg Apr 25 '12 at 00:13
  • what's the version number of your sdk and adt plugin? – Hong Duan Apr 25 '12 at 01:05
  • @duanhong169 The ADT is 18.0.0.v201203301601-306762 and the SDK is 15. – rogcg Apr 25 '12 at 04:18
  • ADT 18.0.0 is designed for use with SDK Tools r18. see [here](http://developer.android.com/sdk/tools-notes.html). – Hong Duan Apr 25 '12 at 04:33
  • @duanhong169 I tried to look for SDK 18 in AVD Manager but its all updated already, the last is 15 (at least what I see). Where can I find to update it to 18. Thx – rogcg Apr 25 '12 at 05:05
  • I mean the SDK Tools, not SDK Platform. Check the SDK Tools in SDK Manager. – Hong Duan Apr 25 '12 at 05:19
  • @duanhong169 here is the link of AVD Manager screenshot, so you might see how it is. http://imgur.com/uCUra – rogcg Apr 25 '12 at 05:29
  • Ah, it's all right.. The Android docs also said `Eclipse Helios (Version 3.6.2) or higher is required for ADT 18.0.0.` If your Eclipse version is higher than 3.6.2, then I don't know what cause the problem, Sorry. – Hong Duan Apr 25 '12 at 05:39

3 Answers3

2

If it's not working and you think you tried everything, first blow out your eclipse installation(un-install and re-install).
If removing and re-installing plug-ins doesn't work, rename your ~/.eclipse folder and start again.
If that doesn't work, delete the .metadata folder in workspace...and start again.
(you're going to have to re-import all your projects)

Install Eclipse from repository(I'm using eclipse from software center and the openJDK).
If you're running x64: sudo apt-get install ia32-libs-multiarch

As root launch eclipse to get the latest platform/PDT updates(they're in /usr somewhere, so you need to be root).
Close eclipse(optionally delete the /root/.eclipse folder).

Launch eclipse as non-root.
Install plug-ins. They'll be in your ~/.eclipse directory.

If it's already installed
Remove all the components in Window->Android Manager
Update the plug-in through:
Help->Install Software->Already installed -> Show updates -> Install
Re-install all the components.

If it's not already installed
Install the ADT plugin through the Help install software menu. With this link.
Choose to install the SDKs during the ADT install.
If any part of installing gives you errors, un-install and install that part.

Install all the updates.
If any part of updating gives you errors, un-install and install that part.

This achieves the results below.
DDMS
yes it works
Versions:
version numbers

RobotHumans
  • 807
  • 10
  • 25
  • rename my ~/.eclipse folder to what? – rogcg Apr 25 '12 at 17:26
  • anything else, so you start with a clean one. – RobotHumans Apr 25 '12 at 17:33
  • I renamed the .eclipse folder in /home/user directory, however it always creates a new one automatically. Is it correct? But it didnt work. I've deleted the metadata folder, and re-imported the project but not working too. I'm on the ia32-libs part. Nothing yet. – rogcg Apr 25 '12 at 18:04
  • it's supposed to recreate it, that's the idea – RobotHumans Apr 25 '12 at 18:06
  • Yeah, but it recreates without the plugins, I should only copy the plugin folder from the old .eclipse to the new one? Or do I have to reinstall the plugin again? – rogcg Apr 25 '12 at 18:08
  • Install it again. If it wasn't working, it was broken. Don't copy it back. As of last night when I ran the upgrade, the Documentation part of the 4.0.3 was broken. That's why it shows as not installed – RobotHumans Apr 25 '12 at 18:14
  • Now, when I try to reinstall the plugin after deleting .eclipse folder, it shows an error: Cannot complete the install because one or more required items could not be found. Software being installed: Android Development Tools 18.0.0.v201203301601-306762 (com.android.ide.eclipse.adt.feature.group 18.0.0.v201203301601-306762) Missing requirement: Android Development Tools 18.0.0.v201203301601-306762 (com.android.ide.eclipse.adt.feature.group 18.0.0.v201203301601-306762) requires 'org.eclipse.wst.sse.core 0.0.0' but it could not be found – rogcg Apr 25 '12 at 18:18
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/10512/discussion-between-rogcg-and-aking1012) – rogcg Apr 25 '12 at 18:22
1

In my case it happened after I installed did a mistake at the beginning. I used 64-bit Linux Ubuntu machine

  1. Installed 32-bit eclipse
  2. Added platforms and packages following http://developer.android.com/sdk/installing/adding-packages.html
  3. Installed 64 bit eclipse because I had problems with 32 bit eclipse operation. But I didn't find that android-sdk-linux/platform tools/adb is a 32-bit executable. Trying to run from terminal it causes weird message: "No such file or directory"

The solution is to remove the step 2 results and start it again with 64 bit eclipse.

I just renamed android-sdk-linux and unpacked it again to remove results of step 2.

Mysticial
  • 464,885
  • 45
  • 335
  • 332
Rostislav
  • 11
  • 1
0

One of the reason this happens is usually the swap space....make sure you have a swap partition and it is of sufficient size Mine was showing similar problem but it was each time i would clean my project the R would disappear and not come back. Swap partition solved my aapt problem.

raihan ahmed
  • 541
  • 4
  • 3