dotnet / android-samples

A collection of .NET for Android sample projects
https://dotnet.microsoft.com/apps/mobile
MIT License
2.21k stars 4.05k forks source link

AutofillFramework sample's SettingsActivity FindViewById always returns null #334

Closed ROODAY closed 4 months ago

ROODAY commented 2 years ago

Sample link

AutofillFramework

Issue description

After setting the Multi-Dataset Autofill Service as the autofill service for my emulator, I tried clicking it's setting to populate some autofill data, and I run into an error on this line. For some reason, FindViewById is returning null. I have absolutely no clue why it's doing that, as no other activity has this issue. The only changes I made to the code were changing the min and target API versions to 30 as per VS 2022 warnings (I tried making a Pixel 5 emulator on API 27, but that ran into a host of it's own issues, including this one again).

Steps to reproduce the issue

  1. Clone down the sample.
  2. Open with VS 2022.
  3. Fix warnings about targeting too low an API version.
  4. Run the app, and set it as the Autofill Service in settings.
  5. Try to click the gear icon next to the service in the Autofill Settings and get the error.

What's the expected result?

What's the actual result?