Skip to content

Commit

Permalink
Updated error docs and include aka.ms link
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Nov 30, 2023
1 parent cfad838 commit 80201de
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions Documentation/guides/messages/xa5207.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,33 @@ ms.date: 06/26/2019

## Example messages

```
```dotnetcli
XA5207: Could not find android.jar for API Level 28. This means the Android SDK platform for API Level 28 is not installed. Either install it in the Android SDK Manager (Tools > Android > Android SDK Manager...), or change your Xamarin.Android project to target an API version that is installed.
```

## Issue

In order to build a project, the Android SDK Platform matching the target API level must be installed.
In order to build a project, the Android SDK Platform matching the target API level must be installed.

## Solution

Use the Android SDK Manager to install the Android SDK Platform for the desired API level.
Use the Android SDK Manager (Tools > Android > Android SDK Manager...) to install the Android SDK Platform for the desired API level. Alternatively you can install the missing API level by running the following from a terminal or command prompt

`dotnet build -t:InstallAndroidDependencies -f net8.0-android -p:AndroidSdkDirectory=<path to sdk directory>`

Part of the new .net android system is when upgrading projects you will automatically be
upgraded to the latest API level. For example net7.0-android allowed you to target API 33,
but net8.0-android will automatically target API 34. If you want to keep your current
target API level you will need to add the 'uses-sdk' `android:targetSdkVersion` to your `AndroidManifest.xml` file.

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="com.companyname.myapp">
<uses-sdk android:targetSdkVersion="33">
<application android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" />
</manifest>
```

You might then need to run the `InstallAndroidDependencies` target as mentioned above to ensure that the required API level is installed.
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ Remove the '{0}' reference from your project and add the '{1}' NuGet package ins
{0} - The missing tool name</comment>
</data>
<data name="XA5207" xml:space="preserve">
<value>Could not find android.jar for API level {0}. This means the Android SDK platform for API level {0} is not installed. {2} ({1} missing.)</value>
<value>Could not find android.jar for API level {0}. This means the Android SDK platform for API level {0} is not installed. {2} ({1} missing.) See https://aka.ms/xa5207 for more details.</value>
<comment>The following are literal names and should not be translated: android.jar
{0} - The API level name
{1} - The expected path of the android.jar file
Expand Down

0 comments on commit 80201de

Please sign in to comment.