小编nin*_*edt的帖子

Protobuf-net错误:不期望类型,也不能推断出合同:BlockHeader

尝试通过以下来自此线程以及其他来源的信息来正确运行openstreetmap pbf文件的反序列​​化:

Protobuf-net反序列化开放街道地图

我目前正在使用r480的protobug dll.我使用protogen从osm proto创建了csharp类文件,但是当我在代码中点击这一点时,我试图从流中读入:

BlockHeader header;
using (var tmp = new LimitedStream(file, length))
{
    header = Serializer.Deserialize<BlockHeader>(tmp); // exception occurs here
}
Run Code Online (Sandbox Code Playgroud)

它抛出以下异常:

InnerException: System.InvalidOperationException
Message=Type is not expected, and no contract can be inferred: BlockHeader
Source=protobuf-net
StackTrace:
  at ProtoBuf.Meta.TypeModel.ThrowUnexpectedType(Type type) in C:\Dev\protobuf-net\protobuf-net\Meta\TypeModel.cs:line 1115
  at ProtoBuf.Meta.TypeModel.TryDeserializeAuxiliaryType(ProtoReader reader, DataFormat format, Int32 tag, Type type, Object& value, Boolean skipOtherFields, Boolean asListItem, Boolean autoCreate, Boolean insideList) in C:\Dev\protobuf-net\protobuf-net\Meta\TypeModel.cs:line 848
  at ProtoBuf.Meta.TypeModel.DeserializeCore(ProtoReader reader, Type type, Object value, Boolean noAutoCreate) in C:\Dev\protobuf-net\protobuf-net\Meta\TypeModel.cs:line 582 …
Run Code Online (Sandbox Code Playgroud)

c# protobuf-net openstreetmap

9
推荐指数
1
解决办法
1万
查看次数

Android Studio AVD 导致 avd 崩溃,AS 无警告关闭

我正在运行最新的测试版 Android Studio 4.2 Beta 3。每次我尝试单击运行按钮启动我的 AVD 时,AVD 都不会启动,并且会导致 Android Studio 崩溃。我没有安装 HAXM,我正在运行 MacOS Catalina (10.15.7 (19H114))

尝试从终端运行模拟器会导致打印出来:

emulator: Android emulator version 30.4.1.0 (build_id 7075546) (CL:N/A)
handleCpuAcceleration: feature check for hvf
cannot add library /Users/weijie/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libvulkan.dylib: failed
added library /Users/weijie/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib
cannot add library /Users/weijie/Library/Android/sdk/emulator/qemu/darwin-x86_64/lib64/vulkan/libMoltenVK.dylib: failed
added library /Users/weijie/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
zsh: terminated  ./emulator -avd Pixel_3a_API_30_x86
Run Code Online (Sandbox Code Playgroud)

我将不胜感激来自社区的任何建议。谢谢。

android android-virtual-device android-studio

9
推荐指数
1
解决办法
2433
查看次数

在 Android 11 (API 30) 中以编程方式更改状态栏文本颜色

我目前可以使用基本活动中的以下内容将状态栏文本颜色从浅色更新为深色:

private fun toggleStatusBarTextColor(light: Boolean) {
    // clear any existing flags
    window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
    if(light) {
        window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
    } else {
        window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
    }
}
Run Code Online (Sandbox Code Playgroud)

systemUiVisibility 现在在 API 30 上显示已弃用,尽管已弃用的方法暂时仍将起作用,但我更愿意用更新的方法替换它们来实现此目的。我读到我们现在应该使用 WindowInsetsController 函数,但尚不清楚如何从文档中完成此操作。有人能指出我正确的方向吗?

java android android-theme kotlin android-statusbar

6
推荐指数
2
解决办法
1万
查看次数