Xamarin Forms Android AppCompat 主题启动问题注释
Xamarin Forms Android startup issue with AppCompat Theme note
我在应用程序启动时得到以下信息:
Java.Lang.RuntimeException: Unable to start activity ComponentInfo{ ... .SplashActivity}:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme
(or descendant) with this activity.
但是,这是我的 SplashScreen activity 定义:
[Activity(NoHistory = true, Theme = "@style/Theme.Splash", MainLauncher = true)]
[IntentFilter(new[] { Android.Content.Intent.ActionView }, DataScheme = "wоwоnder", Categories = new[] { Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable })]
[IntentFilter(new[] { Android.Content.Intent.ActionView }, Categories = new[]{ Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable}, DataScheme = "http",DataPathPrefix = "/Wowonder/",DataHost = "demo.Wоwоnder.com")]
public class SplashActivity : AppCompatActivity
另外,我的样式主题如下:
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
以及 AppTheme:
所以,我完全被它卡住了!
这个问题真的很奇怪,我不完全确定到底有什么帮助,但我所做的是:
- 正在删除 obj/bin 个文件夹;
- "Clean Solution" 选项;
- 正在重新启动 Visual Studio。
对活动(视图)类 和 style
文件的任何操作都不太有效。我的意思是,在此类操作之后异常确实停止出现,但是在完全恢复更改的文件(样式文件)之后,异常无论如何都消失了(可能是因为上面提到的一些清理)。
同时我也做了 re-installed 一些 older/newer 版本的 XF,但是同样,在将所有文件(源文件)恢复为我开始时的文件后,问题就消失了,这意味着 bin/obj 文件夹内容存在一些问题。
很好,你可以修复它 ;)
- 删除 obj/bin 个文件夹;
- "Build Solution";
- Unload/Reload 项目
我在应用程序启动时得到以下信息:
Java.Lang.RuntimeException: Unable to start activity ComponentInfo{ ... .SplashActivity}:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme
(or descendant) with this activity.
但是,这是我的 SplashScreen activity 定义:
[Activity(NoHistory = true, Theme = "@style/Theme.Splash", MainLauncher = true)]
[IntentFilter(new[] { Android.Content.Intent.ActionView }, DataScheme = "wоwоnder", Categories = new[] { Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable })]
[IntentFilter(new[] { Android.Content.Intent.ActionView }, Categories = new[]{ Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable}, DataScheme = "http",DataPathPrefix = "/Wowonder/",DataHost = "demo.Wоwоnder.com")]
public class SplashActivity : AppCompatActivity
另外,我的样式主题如下:
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
以及 AppTheme:
所以,我完全被它卡住了!
这个问题真的很奇怪,我不完全确定到底有什么帮助,但我所做的是:
- 正在删除 obj/bin 个文件夹;
- "Clean Solution" 选项;
- 正在重新启动 Visual Studio。
对活动(视图)类 和 style
文件的任何操作都不太有效。我的意思是,在此类操作之后异常确实停止出现,但是在完全恢复更改的文件(样式文件)之后,异常无论如何都消失了(可能是因为上面提到的一些清理)。
同时我也做了 re-installed 一些 older/newer 版本的 XF,但是同样,在将所有文件(源文件)恢复为我开始时的文件后,问题就消失了,这意味着 bin/obj 文件夹内容存在一些问题。
很好,你可以修复它 ;)
- 删除 obj/bin 个文件夹;
- "Build Solution";
- Unload/Reload 项目