Unable to recreate missing debug keystore?

Brandroid picture Brandroid · Jan 28, 2014 · Viewed 14.6k times · Source

I'm a newbie to programming in Android, and I just tried to run my build and got this message

Execution failed for task ':app:validateDebugSigning'.
> Unable to recreate missing debug keystore.

What does this mean? I'm using Android Studio.

Answer

Andy Obusek picture Andy Obusek · Apr 2, 2014

I just resolved this same problem, the permissions on my ~/.android folder were wrong.

Specifically, Android Studio needs to be able to write to that folder. By default, my installation created that directory as owned by root, and only writable by root. This was a problem because Android Studio was running as me, and thus did not have permissions to write there.

You can confirm this by executing these commands in Terminal.app (or whatever terminal app you run):

You'll probably see permissions like this:

> cd ~
> ls -la
...cut...
drwxr-xr-x    7 root  andyo      238 Mar 31 14:00 .android
...cut...

The problem is that, since root owns the directory and the permissions are set as 755, then the non-root user cannot write to the directory.

To fix this, just change the ownership of the directory to be yourself (there shouldn't be any root owned directories in your home directory anyway).

> sudo chown -R andyo .android
> ls -la
...cut...
drwxr-xr-x    7 andyo  andyo      238 Mar 31 14:00 .android
...cut...