Saturday, January 8, 2011

Monodroid: Could not locate Android SDK

After installing monodroid and attempting to build a simple project I got the following build error:

C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(156,2): error : Could not locate Android SDK.


Turns out the problem had to do with where I had installed my Android SDK. Currently monodroid expects the android SDK directory to be located in either the %ProgramFiles(x86)%\Android directory or in the root directory. An easy way to work around this problem without changing your existing android dev environment is to create a symlink to the directory where monodroid expects to find it.

In order to build the project you can link your android SDK directory to either directory that monodroid checks. But, in order to deploy and/or debug the application you NEED to choose the root location.

Here is the command I used to create s symlink on my Win7 dev environment. Make sure you substitute your actual install directory for <installdir> and also be sure to run this command as an administrator.

mklink /D "c:\android-sdk-windows" "<installdir>\android-sdk-windows"