Reputation: 1269
Could not find android.jar for API Level 26. This means the Android SDK platform for API Level 26 is not installed. Either install it in the Android SDK Manager (Tools > Open Android SDK Manager...), or change your Xamarin.Android project to target an API version that is installed. (C:\Program Files (x86)\Android\android-sdk\platforms\android-O\android.jar missing.)
As you can see from below that I have the correct api sdk platforms installed but as you will notice on the error message, it is searching for an android-O directory.
Here is my directory which you will notice has everything in it but doesn't contain android-O
I looked in my visual studio project settings and here is what it shows for target framework
Does this mean that Visual Studio 2017 doesn't support Android SDK 26+?
Upvotes: 8
Views: 23687
Reputation: 21719
I was getting a similar issue.
Severity Code Description Project File Line Suppression State Error Could not find android.jar for API level 29. This means the Android SDK platform for API level 29 is not installed. Either install it in the Android SDK Manager (Tools > Android > Android SDK Manager...), or change the Xamarin.Android project to target an API version that is installed. (C:\Program Files (x86)\Android\android-sdk\platforms\android-29\android.jar missing.)
The easy fix was to follow the steps mentioned in the error itself from your Visual Studio
(I was using Visual Studio 2019).
Click on the Apply Changes button and then reload the project.
Upvotes: 1
Reputation: 657
If you're building for a Xamarin project, you may need to rename the folder in the SDK folder from "android-{alphabetOSVersion}" to "android-{numericOSVersion}" (IE change the folder "android-o" to "android-27").
This should be done in the C:\Program Files (x86)\Android\android-sdk\platforms folder.
Upvotes: 1
Reputation: 11
MVS 2017 does support Android SDK 26+, Im using it with v15.3.3.
If you have MVS 2017 installed on your machine,make sure it's up to date then download and install the Xamarin update extension. Check out this guide https://developer.xamarin.com/recipes/cross-platform/ide/change_updates_channel/extension-gallery/
And as a rule of thumb,whenever you get the error "Resolve the “Could not find android.jar for API Level XX” in Xamarin Studio" this are steps to follow to solve such an error
This happens when you target your project to a non-installed Android SDK platform, to fix this you have to install the right components.
Step 1:Target another Android Framework On the project you have created right-click the project > Options Go to the Xamarin project configurations
Then go to Build > General > Target framework, and select other Android target framework. Xamarin project Android target framework
Step 2:Install the Android SDK you need As the second option you can install the missing components needed to debug on the SDK Android platform; for this you have to go to:
Tools > Open Android SDK Manager
Then look at the API Level number on the error or look at the version of the target framework as stated at the previous steps; then select to install the “SDK Platform” and press the “Install 1 package” button. Choose the right Android SDK Platform
Accept license agreements
With this you are ready, press F5 and you can debug now.
Upvotes: 0
Reputation: 1269
I discovered that you can fix this issue with 2 steps:
Download and install Visual Studio 2017 Preview by going to https://www.visualstudio.com/vs/preview/
Download and install the Xamarin update extension on both versions of Visual Studio 2017 installed by going to https://developer.xamarin.com/recipes/cross-platform/ide/change_updates_channel/extension-gallery/ and follow the steps
Upvotes: 2