locked
The type name 'Widget' does not exist in the the type 'Android' - in multitarget library? RRS feed

  • Question

  • User372105 posted

    I am unable to build my multitarget library due to some problem with android. For some reason I get UIKit complaints due to some problem with android:

    We all now UIKit is part iOS. NativeObject is the project name.


    However I have included MonoAndroid90 as a target platform in the .csproj file. And when trying to to use something in the android namespace:

    ... there is some problem with Android indeed.

    In the Android SDK Manager I have installed everything in Android 9.0 api 28. What could be the problem?


    My csproj is near identical to: https://montemagno.com/converting-xamarin-libraries-to-sdk-style-multi-targeted-projects/

    Friday, August 16, 2019 10:29 AM

Answers

  • User372105 posted

    I set up my csproj to get access to iOS and Android in the same file. So for building it was necessary to use condition compile directives: https://forums.xamarin.com/discussion/120165/vs2017-conditional-compilation-for-platforms-not-working

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, August 16, 2019 3:20 PM

All replies

  • User379860 posted

    Please close the VS, then delete all of the bin and obj folders in your project, re-open your VS, build it, if you will get the same error, I tried new a CheckBox, it running normally.

    Friday, August 16, 2019 12:58 PM
  • User372105 posted

    I set up my csproj to get access to iOS and Android in the same file. So for building it was necessary to use condition compile directives: https://forums.xamarin.com/discussion/120165/vs2017-conditional-compilation-for-platforms-not-working

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, August 16, 2019 3:20 PM
  • User379860 posted

    Did you solve your issue by above link?

    Tuesday, August 20, 2019 2:45 AM