Error on running new project in Android studio

6.4k views Asked by At

I just installed Android Studio 0.3. After creating a new Project (I've not changed the code) I get error on R.layout.activity_main and every line that uses R class saying

Cannot resolve symbol R

. Also on the bottom of the screen in warning/console segment I get this error:

Gradle: Execution failed for task ":First_Test:mergeDebugResources". /home/alireza/AndroidStudioProjects/First_TestProject/First_Test/src/main/res/drawable-xhdpi/ic_launcher.png: Error: Cannot run program "/home/alireza/IDEs/android-studio/sdk/build-tools/android-4.4/aapt": error=2, No such file or directory

It's my first time I use Android studio and I'm new to Linux (mint Olivia) so I would be very greatful if you help me this issue

4

There are 4 answers

0
Alireza Farahani On BEST ANSWER

This is funny but solution was restarting computer! After reboot android studio worked perfectly and I was able to run "Hello world!" app on my device.

1
Tina Roh On

The R resolution error is due to not having built the class files yet. It will go away after you build once.

The second error is likely due to your Android SDK Tools not being updated. Go to your SDK Manager (within Android, Tools > Android > SDK Manager) and update "Android SDK Build-tools". Restart Android Studio and try again.

0
Alec Holmes On

If you are having this issue on a 64bit version of linux (ubuntu/mint) rebooting does not help.

This answer however worked for me on Linux mint 16: https://stackoverflow.com/a/19623295/183091

0
mimetist On

This error has something to do with the amount of free RAM in your system.

Freeing some RAM (closing other programs) can solve this problem.