R.java not generated after update - android

My generation of R.java is non-existent, but my BuildConfig.java is still generated when projects are rebuilt. This problem is not localized to a single project in my workspace, but to the entire workspace which has projects in ranging from gingerbread to jb, all of which exhibit this error. I have been working with the Android platform for over a year now, and the R.java generation has always been a little mystical, but would always seem to fix itself with a restart of eclipse or a rebuild of the project.
This started when I ran a java update to java 7, so did a changed back to the java 6 sdk, specifically 1.6.0_26, did a fresh install of eclipse(4.2), the android sdk and adt, but to no effect.
I am working on this project with other group members(working off of the same master git repo), and they are not having problems with R.java generating, so therefore I can say for certainty that there are no errors in files causing the R.java to not generate.
And as a disclaimer, yes I have read the plethora of material on here with R.java related issues.
Any suggestions? Thanks

I had the exact same symptoms.
Problem
R.java not getting build across the workspace, resulting in an error when trying to import it: The import <tld>.<project>.R cannot be resolved
The error reporting that the version of adb could not be determined despite existing:
Failed to get the adb version: Cannot run program "/home/dtk/.opt/android-sdk-linux/platform-tools/adb": java.io.IOException: error=2, No such file or directory from '/home/dtk/.opt/android-sdk-linux/platform-tools/adb' - exists=true`
dtk#humbee ~/.opt/android-sdk-linux/platform-tools % ll | grep adb
-rwxr-xr-x 1 dtk dtk 200K Sep 12 14:41 adb*
dtk#humbee ~/.opt/android-sdk-linux/platform-tools % file adb
adb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
dtk#humbee ~/.opt/android-sdk-linux/platform-tools % ./adb
zsh: no such file or directory: ./adb
127 dtk#humbee ~/.opt/android-sdk-linux/platform-tools %
Solution
Installing ia32-libs fixed it for me:
root#humbee:~# uname -m
x86_64
root#humbee:~# aptitude search ia32-libs
p ia32-libs - ia32 shared libraries for use on amd64 and ia64 systems
p ia32-libs-dev - ia32 development files for use on amd64 and ia64 systems
p ia32-libs-gtk - GTK+ ia32 shared libraries
v ia32-libs-static -
root#humbee:~# aptitude install ia32-libs
The following NEW packages will be installed:
ia32-libs lib32asound2 lib32bz2-1.0 lib32gcc1 lib32ncurses5 lib32stdc++6 lib32tinfo5{a} lib32v4l-0 lib32z1 libc6-i386{a}
[...]
dtk#humbee ~/.opt/android-sdk-linux/platform-tools % ./adb version
Android Debug Bridge version 1.0.29
dtk#humbee ~/.opt/android-sdk-linux/platform-tools %
HTH,
dtk

If you are using Eclipse, I would recommend to turn-on extended logging, it should display AAPT output, when AAPT is a tool for generating R.java.
To make this - go to Window->Preference->Android->Build and set BuildOutput to Verbose.
When you are done - make a clean build and pay a highest attention on COnsoleOutput tab in Eclipse. Every warning or message can guide you to the error.
Let us know if you'll notice something interesting.
Good luck

I encountered this with the latest update. Deleting then re-importing the project to my workspace fixed it.

Related

Exception in thread "png-cruncher_x" [duplicate]

I've installed Android Studio 1.2, and created a new project. When I attempt to build, it hangs. This is in the Gradle Console, along with about 20 other copies, with different numbers after png-cruncher_:
Exception in thread "png-cruncher_2" java.lang.RuntimeException: Timed out while waiting for slave aapt process, try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
at com.android.builder.png.AaptProcess.waitForReady(AaptProcess.java:104)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:107)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:204)
at java.lang.Thread.run(Thread.java:745)
I had the same problem with Debian Jessie for AMD64. I did this, and it works:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
I had the same issue whilst running Android Studio 1.5.1 for Windows 8.1 (64 bit), and what I did to solve the problem was by adding the following two system environment variables:
SLAVE_AAPT_TIMEOUT = 30
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_65
(Please note: The path for the JAVA_HOME system environment variable is dependant on where your JDK is located and that the version of your JDK may differ from the example above).
I had this problem on Windows 8.1 64 bits and what ended up solving everything was running gradle in the command line in debug mode, on the project folder:
gradlew -d assembleDebug
Running without the -d flag had the same problem.
After running the first time, everything was ok, I could even clean and rebuild my project.
I had this problem and what was missing were a library to be installed on the SDK.
Just installing the correct library immediately solved the problem.
In my case was the Android Support Library, as I was creating a navigation drawer.
The errors shown in the gradle console didn't give me a clue for the solution, and didn't helped me at all.
Click on SDK manager, and click on the tab SDK Tools, check "Android Support Library" and click apply.
This is a known bug reported here --> https://code.google.com/p/android/issues/detail?id=188627
The workaround on Mac is to reboot your computer.
If you are running on a Linux x64 machine you probably miss some required libraries. The offical sdk guide states:
Required libraries for 64-bit machines:
If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 lib32bz2-1.0
If you are running 64-bit Fedora, the command is:
sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686
of course don't forget to
sudo apt-get update
first.
By pausing the antivirus I don't have anymore that problem, or better by making a rule at the antivirus in order to accept a given '.class' filename recognized as trojan, then banned at compile-time.
Check your firewall if it is coming in your way. Disabling my firewall works for me but i don't know if it's the right fix.
I had the same problem with CentOS 6.5. Before this error, I found the cause of the error, as follows.
AAPT err(Facade for 1129807373): xxx/aapt: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by xxx/lib64/libc++.so)
“libc.so.6: version `GLIBC_2.14' not found” . The highest version of CentOS 6.5 is 2.12, and we need to upgrade to 2.14.
Display the installed glibc version:
# rpm -qa | grep glibc
To download the corresponding RPM package. -> ftp.redsleeve.org/pub/steam/
Install the RPM package as follows:
# rpm -Uvh glibc-2.15-60.el6.x86_64.rpm glibc-common-2.15-60.el6.x86_64.rpm glibc-devel-2.15-60.el6.x86_64.rpm glibc-headers-2.15-60.el6.x86_64.rpm --nodeps --force
I uninstalled 1.2 and installed 1.1, but it did't work.
Because I used local SDK installed previously, I uninstalled and reinstalled 1.1 and installed SDK to new path.
After I used SDK in new path, I don't have those errors any more.
And I upgraded Android Studio to 1.2, and also I don't have errors.
Downgrading Build Tools rescued me.

Android Studio fails to build new project, timed out while wating for slave aapt process

I've installed Android Studio 1.2, and created a new project. When I attempt to build, it hangs. This is in the Gradle Console, along with about 20 other copies, with different numbers after png-cruncher_:
Exception in thread "png-cruncher_2" java.lang.RuntimeException: Timed out while waiting for slave aapt process, try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
at com.android.builder.png.AaptProcess.waitForReady(AaptProcess.java:104)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:107)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:204)
at java.lang.Thread.run(Thread.java:745)
I had the same problem with Debian Jessie for AMD64. I did this, and it works:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
I had the same issue whilst running Android Studio 1.5.1 for Windows 8.1 (64 bit), and what I did to solve the problem was by adding the following two system environment variables:
SLAVE_AAPT_TIMEOUT = 30
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_65
(Please note: The path for the JAVA_HOME system environment variable is dependant on where your JDK is located and that the version of your JDK may differ from the example above).
I had this problem on Windows 8.1 64 bits and what ended up solving everything was running gradle in the command line in debug mode, on the project folder:
gradlew -d assembleDebug
Running without the -d flag had the same problem.
After running the first time, everything was ok, I could even clean and rebuild my project.
I had this problem and what was missing were a library to be installed on the SDK.
Just installing the correct library immediately solved the problem.
In my case was the Android Support Library, as I was creating a navigation drawer.
The errors shown in the gradle console didn't give me a clue for the solution, and didn't helped me at all.
Click on SDK manager, and click on the tab SDK Tools, check "Android Support Library" and click apply.
This is a known bug reported here --> https://code.google.com/p/android/issues/detail?id=188627
The workaround on Mac is to reboot your computer.
If you are running on a Linux x64 machine you probably miss some required libraries. The offical sdk guide states:
Required libraries for 64-bit machines:
If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 lib32bz2-1.0
If you are running 64-bit Fedora, the command is:
sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686
of course don't forget to
sudo apt-get update
first.
By pausing the antivirus I don't have anymore that problem, or better by making a rule at the antivirus in order to accept a given '.class' filename recognized as trojan, then banned at compile-time.
Check your firewall if it is coming in your way. Disabling my firewall works for me but i don't know if it's the right fix.
I had the same problem with CentOS 6.5. Before this error, I found the cause of the error, as follows.
AAPT err(Facade for 1129807373): xxx/aapt: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by xxx/lib64/libc++.so)
“libc.so.6: version `GLIBC_2.14' not found” . The highest version of CentOS 6.5 is 2.12, and we need to upgrade to 2.14.
Display the installed glibc version:
# rpm -qa | grep glibc
To download the corresponding RPM package. -> ftp.redsleeve.org/pub/steam/
Install the RPM package as follows:
# rpm -Uvh glibc-2.15-60.el6.x86_64.rpm glibc-common-2.15-60.el6.x86_64.rpm glibc-devel-2.15-60.el6.x86_64.rpm glibc-headers-2.15-60.el6.x86_64.rpm --nodeps --force
I uninstalled 1.2 and installed 1.1, but it did't work.
Because I used local SDK installed previously, I uninstalled and reinstalled 1.1 and installed SDK to new path.
After I used SDK in new path, I don't have those errors any more.
And I upgraded Android Studio to 1.2, and also I don't have errors.
Downgrading Build Tools rescued me.

R.java is not being generated because eclipse cannot run aapt

I use Ubuntu 11.10 and eclipse for Android development. I used to keep the android-sdk in my home folder, but because of low space, I copied it to the hard disk. When I moved the sdk to the hard disk, I did not have permissions to run adb, aapt or other platform tools. So, I edited the /etc/fstab file and added the following line
/dev/sda3 /media/hdisk ntfs-3g defaults 0 0
Now, when I execute the command ls -l | grep "sdk" in the terminal, i get this output
drwxrwxrwx 1 root root 4096 2012-10-20 16:07 android-sdk-linux
So, I have the permissions now, but when I run eclipse, the R.java file is still not generated, but the BuildConfig.java file is generated. I can run aapt from the terminal, but doing it every time I change the code is not practical. Any suggestions?
In case you have a 64bit Linux running, this command may help you:
sudo apt-get install ia32-libs
Had the same issue and that one did the trick. Found here.
Its a very basic check but have you changed the location of the Android SDK within Eclipse?
Preferences -> Android -> SDK Location
This problem seems have to solved itself after restarting my PC about 2-3 times. Thanks for all the help everybody.

Bash cannot find adb even though it's definitely there

I'm running ArchLinux, kernel 3.4.4, bash version 4.2.29. I downloaded the android sdk from here: http://developer.android.com/sdk/index.html
Once extracted I did, did ~/android-sdk-linux/tools/android and installed the SDK platform tools package.
From there I tried the following:
> ls -l ~/android-sdk-linux/platform-tools/adb
-rwxr-xr-x 1 mediocregopher mediocregopher 204436 Jun 28 13:20 /home/mediocregopher/android-sdk-linux/platform-tools/adb
> file ~/android-sdk-linux/platform-tools/adb
/home/mediocregopher/android-sdk-linux/platform-tools/adb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
> ~/android-sdk-linux/platform-tools/adb
bash: /home/mediocregopher/android-sdk-linux/platform-tools/adb: No such file or directory
Clearly the file is there and at the very least executable, why can't bash seem to find it? I've tried adding the platform-tools folder to my path as well as sudo and su-ing, but no matter what it seems like the file is not found. Does anyone know what could be happening?
You're running on a 64bit system and you do not have the 32bit compatibility libraries installed.
The error is actually coming from the fact that it can't find the 32bit ld.so.
If you're using ubuntu/debian, I think you just need to sudo apt-get install ia32-libs and it should work.
For 'modern' versions of Ubuntu (13.10 and higher), the accepted answer is not working anymore: They removed the '32 bit compability libraries' and instead you need to use multiarch packages that happily coexists next to each other. See What happened to the ia32-libs package? on AskUbuntu.
Instead you need to install the 32 bit version of libc:
sudo apt-get install libc6:i386
Next, I encounterd that a 32 bit version of libstdc++ is also required by adb:
sudo apt-get install libstdc++6:i386
Now adb should be working (again).
Android SDK on a 64-bit linux machine shows that some other libraries are required as well. I did not seem to require them as well, but might have had them installed already.

android eclipse plugin can't find valid paths

I just installed the latest galileo eclipse release. I added the
latest adt plugin and configured it to use my android sdk (r4).
Unfortunately, the eclipse plugin is wiggin out. for some reason, it
can't find(execute?) the android tools. I get this error on the
eclipse project:
Error executing aapt. Please check aapt is present at
~/android-sdk-linux_86/platforms/android-1.6/tools/aapt
but here is the output of ls:
ls -al ~/android-sdk-linux_86/platforms/android-1.6/tools/aapt
-rwxrwxrwx 1 solid solid 3416259 2009-12-18 21:02 /home/solid/android-sdk-linux_86/platforms/android-1.6/tools/aapt
When I try running the program directly, I see the following:
~/android-sdk-linux_86/platforms/android-1.6/tools/aapt
bash: /home/solid/android-sdk-linux_86/platforms/android-1.6/tools/aapt: No such file or directory
I just unzipped the sdk and installed the platforms and ls'd it so I know it is there.
I have tried recreating the project from the command line (which
works) but when I import it into eclipse I get the same error.
BTW this is linux amd 64
Something is very wrong here. These two lines contradict themselves:
$ ls -al ~/android-sdk-linux_86/platforms/android-1.6/tools/aapt
-rwxrwxrwx 1 solid solid 3416259 2009-12-18 21:02 /home/solid/android-sdk-linux_86/platforms/android-1.6/tools/aapt
$ ~/android-sdk-linux_86/platforms/android-1.6/tools/aapt
bash: /home/solid/android-sdk-linux_86/platforms/android-1.6/tools/aapt: No such file or directory
The file just can't exist one instant, then cease to exist in the next.
I don't think this is caused by running on amd64, since I'd suspect that would give you a different, more descriptive error. That being said, make sure you have the ia32-libs installed:
# Assuming you're on Ubuntu
$ apt-get install ia32-libs
My only advice would be to try completely deleting your SDK installation and re-installing it from scratch.

Categories

Resources