5

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

Community
  • 1
  • 1
user2742736
  • 51
  • 1
  • 3
  • 3
    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 Sep 05 '13 at 11:07
  • Clean the project and check, also check restarting eclipse. – Charan Sep 05 '13 at 11:14
  • @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 Sep 06 '13 at 02:31
  • @Charan I had tried those steps earlier but it didn't work. – user2742736 Sep 06 '13 at 02:33
  • I'm also facing the same issue, this happened after I updated ADT plugin and Android SDK. That post can be found at http://stackoverflow.com/questions/18473014/error-executing-aapt-cannot-run-program-createprocess-error-5-access-is-denie . I still have not got a solution to this. – Samik Bandyopadhyay Sep 06 '13 at 15:52
  • I added this same project on a different laptop, and it had no errors. It compiled and ran successfully. However I have no idea why I'm getting these errors in my current laptop. – user2742736 Sep 07 '13 at 04:59
  • @SamikBandyopadhyay For the first problem...it got solved by changing the permission of the parent folder. Right click the main folder > properties > security > users > full control > apply. – user2742736 Sep 07 '13 at 11:20
  • possible duplicate of [R cannot be resolved to a variable](http://stackoverflow.com/questions/5592806/r-cannot-be-resolved-to-a-variable) – donfuxx Feb 24 '14 at 19:27

1 Answers1

0

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.

Barry Staes
  • 3,890
  • 4
  • 24
  • 30