Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HelloWorld] Fix app install (#9822)
When I try installing `samples/HelloWorld`, installation fails: ./dotnet-local.sh build -t:Install samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj HelloWorld.DotNet failed with 2 error(s) (139.4s) → samples/HelloWorld/HelloWorld/bin/Debug/net10.0-android/HelloWorld.DotNet.dll /Users/jon/Developer/src/dotnet/android/bin/Debug/lib/packs/Microsoft.Android.Sdk.Darwin/35.99.0/tools/Xamarin.Android.Common.targets(2824,3): error MSB6006: "adb" exited with code 1. /Users/jon/Developer/src/dotnet/android/bin/Debug/lib/packs/Microsoft.Android.Sdk.Darwin/35.99.0/tools/Xamarin.Android.Common.targets(2824,3): error XAAADB0000: Serving... All files should be loaded. Notifying the device. adb: failed to install bin/Debug/net10.0-android/com.xamarin.android.helloworld-Signed.apk: Failure [INSTALL_FAILED_VERIFICATION_FAILURE: Install not allowed for file :///data/app/vmdl911578471.tmp] Performing Incremental Install Failure [INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 24, but found 21] Performing Streamed Install If I look at the device screen, it shows a dialog: ![⛨ Google Play Protect > **Unsafe app blocked**][2] > ⛨ Google Play Protect > **Unsafe app blocked** > ⬣ HelloWorld > This app was built for an older version of Android and doesn't > include the latest privacy protections > More options ˯ > Installing this app may put your device at risk. > Learn more about Play Protect > [Install anyway] > [**Got it**] [Developer Guidance for Google Play Protect Warnings][0] states: > **Reason for this notification**: These Play Protect warnings will > show only if the app's [targetSdkVersion][1] is more than 2 versions > lower than the current Android API level. Updating `Properties/AndroidManifest.xml` to *remove* the `<uses-sdk/>` element allows .NET for Android to use its default logic, causing the "final" `AndroidManifest.xml` to contain: <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35" /> This allows the app to install without error: % ./dotnet-local.sh build -t:Install samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj Restore complete (1.9s) HelloLibrary.DotNet succeeded (1.5s) → samples/HelloWorld/HelloLibrary/bin/Debug/net10.0-android/HelloLibrary.DotNet.dll HelloLibrary.DotNet succeeded (0.1s) → samples/HelloWorld/HelloLibrary/bin/Debug/net10.0-android/HelloLibrary.DotNet.dll HelloWorld.DotNet succeeded (52.9s) → samples/HelloWorld/HelloWorld/bin/Debug/net10.0-android/HelloWorld.DotNet.dll Build succeeded in 57.8s [0]: https://developers.google.com/android/play-protect/warning-dev-guidance [1]: https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#target [2]: https://private-user-images.githubusercontent.com/155958/415775310-ef784243-7f49-4a25-bed9-bad367fce873.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDAxNjIwNjYsIm5iZiI6MTc0MDE2MTc2NiwicGF0aCI6Ii8xNTU5NTgvNDE1Nzc1MzEwLWVmNzg0MjQzLTdmNDktNGEyNS1iZWQ5LWJhZDM2N2ZjZTg3My5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjIxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIyMVQxODE2MDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04MDNiM2EyZDQ5MmZjMjE2MmQzYTBjYmNiNTNmZGRkN2EzNGIzZDI3ZjViYzRkZTA2NzJmODEzNTM0NGRhNmViJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.neQf-WSFcmu4VKv-ueJku4RnvLMJo68sj3yt-djtFeo
- Loading branch information