Dev @ Work

take care

Android SDK path

with 2 comments


I had a hard time building a Mono for Android project a while back. I thought I should share this.

On building a Mono for Android project using MonoDevelop I got this cryptic error message:

C:\Program Files\MSBuild\Novell\Novell.MonoDroid.Common.targets(2,2): Error: Could not find android.jar for API Level 10.  This means the Android SDK platform for API Level 10 is not installed.  Either install it in the Android SDK Manager, or change your Mono for Android project to target an API version that is installed. (Hello)

Sure, I thought. I’ll just fire up the Android SDK Manager and install the Android SDK for version 2.3 (API Level 10). Easier thought than done, it was already installed. The SDK path reported by the SDK Manager was:

C:\Users\dkt\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\android-sdk-windows

It seems the installer for Mono for Android had messed up the Android SDK path, but where? I looked at the build log and that showed me where MonoDevelop was getting its SDK path:

Target _ResolveMonoAndroidSdks:
 Looking for Android SDK..
 Key HKCU\SOFTWARE\Xamarin\MonoAndroid\PrivateAndroidSdkPath not found.
 Key HKCU\SOFTWARE\Android SDK Tools\Path not found.
 Key HKLM\SOFTWARE\Android SDK Tools\Path found:
 Path contains adb.exe in \platform-tools (C:\Program Files\Android\android-sdk).

All right, so now I knew that the Android SDK was installed in two different folders. The build problem was easily solved after I changed the registry key at HKLM\SOFTWARE\Android SDK Tools\Path to point to the path that the Andoid SDK Manager was reporting.

Now, where was the Android SDK Manager getting its path from? I still don’t know. If any one does happen to know please comment below.

[Thanks to Paul who left a comment below, I discovered that Mono for Android setup added a shortcut to its copy of the Android SDK Manager. One less mystery...]

About these ads

Written by Devendra

March 9, 2012 at 5:12 pm

Posted in Android

2 Responses

Subscribe to comments with RSS.

  1. I just ran in to this same problem.
    My guess is you also have two copies of the Android SDK Manager installed.
    It is just pulling the SDK path from its own local path.
    Uninstall Mono4Android and reinstall making sure it uses your existing Android SDK path.

    Paul Peavyhouse

    March 11, 2012 at 3:43 am

  2. I also had the same problem. Like Paul suggested, I had two versions installed of the android SDK. Monodroid seems to default to the one in “C:\Program Files (x86)\Android” no matter what you set in the registery or elsewhere. Deleting/renaming this folder solved my issue as the xamian one is installed in “C:\Users\\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\android-sdk-windows”

    kj

    March 23, 2012 at 10:07 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 51 other followers

%d bloggers like this: