【发布时间】:2020-08-01 19:34:14
【问题描述】:
我有MvvmCross Xamarin Forms 项目。我右键单击 Android 项目并迁移到 AndroidX。现在,当我运行时,我得到了错误。请帮忙
Android.Content.Res.Resources+NotFoundException: '资源 ID #0x7f0b0047'
[Activity(Label = "MyApp", Icon = "@drawable/icon", MainLauncher = false, ScreenOrientation = ScreenOrientation.Portrait)]
public class MainActivity : MvxFormsAppCompatActivity
{
public static MainActivity Instanace;
protected override void OnCreate(Bundle bundle)
{
Instanace = this;
Xamarin.Essentials.Platform.Init(this, bundle);
base.Window.RequestFeature(WindowFeatures.ActionBar);
// Name of the MainActivity theme you had there before.
// Or you can use global::Android.Resource.Style.ThemeHoloLight
//base.SetTheme(Resource.Style.MainTheme);
base.OnCreate(bundle); *------------------Here I get error*
TabLayoutResource = Resource.Layout.tabs;
ToolbarResource = Resource.Layout.toolbar;
}
【问题讨论】:
-
即使我的项目不使用 MVVMCross,我也遇到了同样的问题。当我将目标 SDK 从 28 更新到 29 并且安装了很少的 AndroidX 包时,它出现了。
标签: xamarin xamarin.forms xamarin.android mvvmcross