5
votes

I just started my first android project. Followed all the instructions given by google tutorials. However I'm getting following errors in my project

1) Error executing aapt: Cannot run program "D:\Development\adt-bundle-windows-x86_64-20130729\sdk\build-tools\android-4.3\aapt.exe": CreateProcess error=5, Access is denied: CreateProcess error=5, Access is denied UssEnt line 1 Android ADT Problem

2) R cannot be resolved to a variable

For the first problem I referred below link but it did not work

Error executing aapt: Cannot run program, CreateProcess error=5, Access is denied: CreateProcess error=5, Access is denied

I tried following solutions for the 2nd problem but none of them worked for me.

1] Getting rid of 'import android.R' line.

2] Cleaning the project and then building it again.

3] Closing project and then opening it again.

4] Going to Project Properties > Java Build Path > Tick Android Version Checkbox

5] Following the procedure: Uncheck Project->Build Automatically Project->Properties->Builders: Make sure all Android (3) and Java (1) builders are checked (and nothing more) Window->Preferences->Android->Build: Check "Automatically refresh Resources and Assets folder on build" Right-click on project->Android Tools->Fix Project Settings (not sure what it actually does, but it can't hurt)

6] Some users advice to check if .xml files are correct. I don't know how I could do that. I haven't even written a single line in my project - the code has been generated automatically.

7] Layout xml file is named using lower-case letters.

8] No error in resource files (no red-crosses).

The above 8 steps I got from 'R cannot be resolved to a variable' - gen folder is empty

1
For your second problem, make sure you don't have any errors in any of your XML files - otherwise the R class will not be generated. - Aleks G
Clean the project and check, also check restarting eclipse. - Charan
@AleksG as I mentioned in point 6, I don't have any errors in the XML files. All the files are autogenerated. Even then I rechecked my XML and did not find any errors there. - user2742736
@Charan I had tried those steps earlier but it didn't work. - user2742736
I'm also facing the same issue, this happened after I updated ADT plugin and Android SDK. That post can be found at stackoverflow.com/questions/18473014/… . I still have not got a solution to this. - Samik Bandyopadhyay

1 Answers

0
votes

This was a known issue with Android Studio back in september 2013 when you posted this. http://tools.android.com/knownissues

I experienced the same problems and an Android Studio update fixed the issue.

Using Android Studio v0.3.2 (Oct 2013) on Windows 7/8 i believe, i ultimately created a new project (that had correct auto-generated code) and re-implemented my (quite simple) app, then was able to compile that (no gradle resources errors there).

Cause was something along the lines of.. Compilation could not find resources: happened when creating a new project in a specific version, happened when having an OK project and then updating Android Studio to that specific version. It somehow inflicted Gradle.