focus-creative-games / hybridclr

HybridCLR是一个特性完整、零成本、高性能、低内存的Unity全平台原生c#热更新解决方案。 HybridCLR is a fully featured, zero-cost, high-performance, low-memory solution for Unity's all-platform native c# hotupdate.
https://code-philosophy.com/
MIT License
6.6k stars 670 forks source link

在 Mumu 12 模拟器上调用网络状态相关接口时发生崩溃 #120

Closed ilinchunjie closed 9 months ago

ilinchunjie commented 9 months ago

Describe the bug | 描述问题 使用 HybridCLR 热更方案打出来的包体,在 MuMu 12 模拟器(最新版本)上发生崩溃,触发时机为调用 Android 底层网络状态接口

经测试,在以下环境能够正常运行不崩溃: 1.小米手机:Android 13 2.一加 8 Pro:Android 9 3.Mumu 模拟器 2.7.34 4.雷电模拟器 5.使用 HybridCLR 热更前的包体

Enviroment | 环境 Unity Version:2021.3.33f1 com.code-philosophy.hybridclr Version: 5.0.0 Platform: Android

To Reproduce | 复制步骤 1.使用 HybridCLR 热更方案打出 Android 包体 2.启动后在 AOT 程序集或者热更程序集调用 Application.internetReachability 接口 3.触发崩溃

Expected behavior | 期望的结果 正常运行不会崩溃

Screenshots | 截图或者日志 02-01 09:44:11.613  2419  2580 E AndroidRuntime: FATAL EXCEPTION: ConnectivityThread02-01 09:44:11.613  2419  2580 E AndroidRuntime: Process: com.xxx.xxx, PID: 2419 02-01 09:44:11.613 2419 2580 E AndroidRuntime: java.lang.NullPointerException 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at java.util.Objects.requireNonNull(Objects.java:220) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.net.NetworkCapabilities$1.createFromParcel(NetworkCapabilities.java:1965) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.net.NetworkCapabilities$1.createFromParcel(NetworkCapabilities.java:1944) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.Parcel.readParcelable(Parcel.java:3333) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.Parcel.readValue(Parcel.java:3226) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.Parcel.readArrayMapInternal(Parcel.java:3623) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.BaseBundle.unparcel(BaseBundle.java:236) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.Bundle.getParcelable(Bundle.java:1002) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.net.ConnectivityManager$CallbackHandler.getObject(ConnectivityManager.java:3906) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.net.ConnectivityManager$CallbackHandler.handleMessage(ConnectivityManager.java:3839) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288) 02-01 09:44:11.613 2419 2580 E AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:67)

Additional context | 补充信息

pirunxi commented 9 months ago

提供复现代码