我在调试 Android 项目时遇到问题。我可以部署到设备并运行它,一切正常,但如果我尝试调试,应用程序将部署到设备并非常短暂地打开,启动画面显示但应用程序随后关闭。

我在 Visual Studio 2015 上使用 Xamarin Forms。

设备正在运行 Android Oreo (8.0.0)。另一台运行 Android 6.0.1 的设备调试正常。

输出显示如下:

InspectorDebugSession(11): StateChange: Start -> EntryPointBreakpointRegistered 
InspectorDebugSession(11): Constructed 
Android application is debugging. 
InspectorDebugSession(11): HandleTargetEvent: TargetExited 
InspectorDebugSession(11): Disposed 
Couldn't connect to logcat, GetProcessId returned: 0 

我检查了 Logcat,它似乎在查找 FFImageLoading 库时遇到问题:
Time    Device Name Type    PID Tag Message 
09-18 14:35:52.361  Huawei Nexus 6P Debug   1560    Mono    AOT:  
image '/usr/local/lib/mono/aot-cache/arm/FFImageLoading.Platform.dll.so'  
not found: dlopen failed: library "/data/app/myapp.android.dev- 
WEb1bz8edgF7vwx6uCoZ-A==/lib/arm/libaot-FFImageLoading.Platform.dll.so" not found 

我已将 FFImageLoading 的 Nuget 包添加到我的项目中,Droid 项目引用如下图所示:

请您参考如下方法:

这对我有用:-

Deselecting the 'Use Shared Runtime' in Project Properties > Android Options > Packaging properties


评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!