xamarin-android-migration
/xamarin-android-migration
Prowadzi migrację natywnych aplikacji Xamarin.Android do .NET for Android: konwersja projektu SDK-style, target framework monikers, właściwości MSBuild, AndroidManifest.xml i zgodność NuGet.
- Autor
- davidortinau ↗
- Repozytorium
- maui-skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 06.07.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 2
- Skrypty
- 0
- Komentarze HTML
- 2
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 06.07.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- SKILL.md zawiera komentarze HTML (2). Nie widać ich w podglądzie Markdown, a model je czyta.
Co robi i kiedy
Prowadzi migrację natywnych aplikacji Xamarin.Android do .NET for Android: konwersja projektu SDK-style, target framework monikers, właściwości MSBuild, AndroidManifest.xml i zgodność NuGet.
Wyzwalacze z opisu
Oryginalny opis (EN)
**WORKFLOW SKILL** - Guide for migrating Xamarin.Android native apps to .NET for Android. Covers SDK-style project conversion, target framework monikers, MSBuild property changes, AndroidManifest.xml updates, NuGet dependency compatibility, Android binding library migration, Xamarin.Essentials in native apps, .NET CLI support, and platform-specific gotchas. USE FOR: "migrate Xamarin.Android", "upgrade Xamarin.Android to .NET", "Xamarin.Android to .NET for Android", "Android project migration", "Android binding library migration", "convert Android project to SDK-style", "AndroidSupportedAbis to
Jak działa
- Migration Workflow
- Critical Gotchas
- Platform-Specific Pitfalls
- NuGet Compatibility Note
- API Currency Warning
- Quick Checklist
Podgląd SKILL.md
---
name: xamarin-android-migration
description: >
**WORKFLOW SKILL** - Guide for migrating Xamarin.Android native apps to .NET for Android. Covers
SDK-style project conversion, target framework monikers, MSBuild property changes,
AndroidManifest.xml updates, NuGet dependency compatibility, Android binding library
migration, Xamarin.Essentials in native apps, .NET CLI support, and platform-specific
gotchas.
USE FOR: "migrate Xamarin.Android", "upgrade Xamarin.Android to .NET",
"Xamarin.Android to .NET for Android", "Android project migration",
"Android binding library migration", "convert Android project to SDK-style",
"AndroidSupportedAbis to RuntimeIdentifiers".
DO NOT USE FOR: migrating Xamarin.Forms apps (use xamarin-forms-migration),
migrating Xamarin.iOS apps (use xamarin-ios-migration),
creating new MAUI apps from scratch (use feature-specific MAUI skills).
---
# Xamarin.Android → .NET for Android Migration
For SDK-style project templates, MSBuild property tables, ABI conversion, namespace mappings, and CLI commands, see `references/android-migration-api.md`.
> ⚠️ **Field-tested advice:** Android migration is significantly harder than iOS.
> Expect more UI bugs, OEM-specific rendering differences, and issues not
> reproducible on emulators. **Test on physical devices.**
## Migration Workflow
1. Create new .NET for Android project (`dotnet new android`)
2. Copy code and resources into the new project
3. Update MSBuild properties (see `references/android-migration-api.md`)
4. Update AndroidManifest.xml — remove `<uses-sdk>`, use csproj properties
5. Delete `Resource.designer.cs` (regenerated automatically)
6. Update NuGet dependencies
7. Migrate binding libraries (if applicable)
8. Replace Xamarin.Essentials with `<UseMauiEssentials>true</UseMauiEssentials>`
9. Handle encoding changes
10. Delete `bin/`/`obj/`, build, test on physical devices
> **Strategy:** Create a new project and copy code into it — don't edit the existing project file in place.
## Critical Gotchas
### ⚠️ Remove `<uses-sdk>` from AndroidManifest.xml
```xml
<!-- ❌ Xamarin-style — causes build warnings/errors -->
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<!-- ✅ Use MSBuild properties instead -->
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
```
### ⚠️ Delete `Resource.designer.cs`
This file is auto-generated. Leftover copies from Xamarin cause duplicate symbol errors. **Delete it** — it will be regenerated.
### ⚠️ No `.dll.config` or `.exe.config` Support
`.dll.config` and `<dllmap>` are not supported in .NET Core. If your app uses `System.Configuration.ConfigurationManager`, migrate to `appsettings.json` or platform preferences.
### ⚠️ Essentials: Override Permissions in Every Activity
```csharp
// ❌ Forgetting this → permissions silently fail
// ✅ Required in EVERY Activity that uses Essentials
public override void OnRequestPermissionsResult(
int requestCode, string[] permissions, Permission[] grantResults)
{
Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
```
### ⚠️ AndroidManifest.xml Location Changed
`AndroidManifest.xml` is now in the **project root** (not `Properties/`). The SDK-style project finds it there by default.
## Platform-Specific Pitfalls
| Pitfall | Impact | Mitigation |
|---------|--------|------------|
| OEM rendering differences | UI bugs not visible on emulators | Test on physical devices from multiple vendors |
| Shadow rendering varies by OEM/API level | Inconsistent shadow appearance | Implement shadows in platform-specific handler code |
| Android Wear references | Not supported in .NET for Android | Remove Wear project references |
| `MAndroidI18n` removed | Encoding errors at runtime | Replace with `System.Text.Encoding.CodePages` NuGet |
| `AotAssemblies` deprecated | Build warnings | Use `RunAOTCompilation` instead |
| `jar2xml` not supported | Binding library build failures | Use default `class-parse` parser |
| `DebugType=full` not supported | Build errors | Use default `portable` |
## NuGet Compatibility Note
Android is unique: packages targeting `monoandroid` **still work** on .NET for Android. No recompilation needed for most Android-specific packages. This is NOT true for iOS/Mac.
If no compatible version exists:
1. Recompile with .NET TFMs (if you own it)
2. Look for a preview .NET version
3. Replace with a .NET-compatible alternative
## API Currency Warning
If your migrated app will also adopt .NET MAUI controls (e.g., via `UseMaui`), check the **maui-current-apis** skill for deprecated MAUI APIs to avoid (ListView, Frame, Device.*, etc.).
## Quick Checklist
1. ☐ Created new .NET for Android project (`dotnet new android`)
2. ☐ Set `TargetFramework` to `net8.0-android` (or later)
3. ☐ Set `SupportedOSPlatformVersion` for minimum SDK
4. ☐ Converted `AndroidSupportedAbis` → `RuntimeIdentifiers`
5. ☐ Removed `<uses-sdk>` from AndroidManifest.xml
6. ☐ Copied source, resources, and project properties
7. ☐ Deleted `Resource.designer.cs`, `bin/`, `obj/`
8. ☐ Updated NuGet dependencies
9. ☐ Added `UseMauiEssentials` + `Platform.Init()` if using Essentials
10. ☐ Overridden `OnRequestPermissionsResult` in every Activity
11. ☐ Replaced `MAndroidI18n` with `System.Text.Encoding.CodePages`
12. ☐ Verified AOT settings (`RunAOTCompilation`, not `AotAssemblies`)
13. ☐ Tested on physical Android device(s) from multiple vendors
Pliki w paczce (2)
- SKILL.md 6 KB
- references/android-migration-api.md 6 KB
Wersje
W bazie nie ma innych skilli o nazwie xamarin-android-migration.
Migawka bazy z 28.10.2026 · wersja paczki 7cef4288182d (skrót SHA-256 całej paczki)
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100xamarin-ios-migration
Prowadzi migrację aplikacji Xamarin.iOS, Xamarin.Mac i Xamarin.tvOS do .NET for iOS, macOS i tvOS: konwersja projektu, MSBuild, Info.plist, biblioteki bindingu i podpisywanie kodu. - 100xamarin-forms-migration
Prowadzi migrację aplikacji Xamarin.Forms do .NET MAUI: struktura projektu, zmiany nazw przestrzeni, zachowanie layoutów, renderery na handlery, efekty na behaviors i zgodność NuGet. - 100xamarin
Wspiera pracę z Xamarin: Xamarin.Forms, migracja do .NET MAUI, XAML data binding, custom renderery i usługi zależne od platformy. - 100scandit-xamarin-to-net-migration
Migruje integrację SDK Scandit po przejściu aplikacji Xamarin na .NET, .NET for Android, .NET for iOS lub MAUI: pakiety, przestrzenie nazw i inicjalizację. - 100dotnet-maui-doctor
Diagnozuje i naprawia problemy ze środowiskiem programistycznym .NET MAUI: sprawdza .NET SDK, workloady, JDK, Android SDK, Xcode i Windows SDK, a wymagane wersje pobiera dynamicznie z NuGet. - 90dotnet
Pomaga w pracy z .NET: C#, MSBuild, ASP.NET Core, EF Core, MAUI, NuGet, testami i narzędziami SDK.