GodZza

导航

第一个VS2015 Xaramin Android项目(续)

上文说到已经第一个 App已经可以运行,但是并不能调试! 经过细心发现,我察觉到VS刚开始进入了调试模式,但是一闪而过。也就是说调试失败了,此时需要等待一段时间才能打开此App,如果立即打开App 会一直打开不到。

为此,我使用了adb logcat 查看调试信息,定位到无法调试的资讯如下:

 

 1 I/ActivityManager(  462): Start proc FirstAndroidTest.FirstAndroidTest for activity FirstAndroidTest.FirstAndroidTest/md5a8fa1d3a19e02983fd588fbbbd9c2a00.MainActivity: pid=1195 uid=10054 gids={50054, 3003, 1028}
 2 
 3 D/dalvikvm( 1195): Trying to load lib /data/app-lib/FirstAndroidTest.FirstAndroidTest-1/libmonodroid.so 0xa8ff53c0
 4 
 5 D/dalvikvm( 1195): Added shared lib /data/app-lib/FirstAndroidTest.FirstAndroidTest-1/libmonodroid.so 0xa8ff53c0
 6 
 7 W/monodroid( 1195): Using override path: /data/data/FirstAndroidTest.FirstAndroidTest/files/.__override__
 8 
 9 W/monodroid( 1195): Using override path: /storage/emulated/0/Android/data/FirstAndroidTest.FirstAndroidTest/files/.__override__
10 
11 W/monodroid( 1195): Trying to load sgen from: /data/data/FirstAndroidTest.FirstAndroidTest/files/.__override__/libmonosgen-2.0.so
12 
13 W/monodroid( 1195): Trying to load sgen from: /storage/emulated/0/Android/data/FirstAndroidTest.FirstAndroidTest/files/.__override__/libmonosgen-2.0.so
14 
15 W/monodroid( 1195): Trying to load sgen from: /data/app-lib/FirstAndroidTest.FirstAndroidTest-1/libmonosgen-2.0.so
16 
17 W/monodroid( 1195): Trying to load sgen from: /data/data/FirstAndroidTest.FirstAndroidTest/files/.__override__/links/libmonosgen-2.0.so
18 
19 W/monodroid-debug( 1195): Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8813,server=y,embedding=1
20 
21 W/monodroid-debug( 1195): Accepted stdout connection: 43
22 
23 D/Mono    ( 1195): Image addref mscorlib[0xb9023d60] -> mscorlib.dll[0xb9032210]: 1
24 
25 D/Mono    ( 1195): AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/FirstAndroidTest.FirstAndroidTest-1/libaot-mscorlib.dll.so" not found
26 
27 D/Mono    ( 1195): AOT module '/Users/builder/data/lanes/3511/77cb8568/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/FirstAndroidTest.FirstAndroidTest-1/libaot-mscorlib.dll.so" not found
28 
29 D/Mono    ( 1195): Config attempting to parse: 'mscorlib.dll.config'.
30 
31 D/Mono    ( 1195): Config attempting to parse: '/Users/builder/data/lanes/3511/77cb8568/source/monodroid/builds/install/mono-x86/etc/mono/assemblies/mscorlib/mscorlib.config'.
32 
33 D/Mono    ( 1195): Assembly mscorlib[0xb9023d60] added to domain RootDomain, ref_count=1
34 
35 D/Zygote  (  136): Process 1195 terminated by signal (11)
36 
37 D/dalvikvm( 1215): Late-enabling CheckJNI
38 
39 I/ActivityManager(  462): Process FirstAndroidTest.FirstAndroidTest (pid 1195) has died.

 

 

根据关键字"libaot-mscorlib.dll.so" not found" 搜索发现遇到此问题的人不少,也有个博客记录了此问题:【记录】解决VS2015调试Xamarin程序一闪而过(使用微软ANDROID模拟器)

 

同样的还有求助:libaot-mscorlib.dll.so not found

当然了还找到解决方案:Xamarin Android – Could not connect to the debugger – Resolved!

步骤如下:

 

  1. If the emulator is open, close it down
  2. Start Microsoft Hyper-V Manager
  3. Select the Virtual Emulator you are trying to work with
  4. In the Actions Menu select settings
  5. Expand processor under Hardware options
  6. Select Compatibility
  7. Make sure the checkbox is selected on “Migrate to a physical computer with a different processor version”
  8. Click “Ok” and close down Hyper-V Manager
  9. Try to debug again, you should be successful

开启Hyper-V管理器,在Win10上我不知道哪里找, 可以Ctrl+R  运行输入:【%windir%\System32\mmc.exe "%windir%\System32\virtmgmt.msc"】运行设置,也可以直接用创建此命令的快捷方式,以后直接打开就行了。

如果虚拟机正在打开,请先关闭虚拟机

其他步骤如下:

->

设置后再重新打开模拟器,现在可以真正调试了!

 

 

 

更新:找到了 Hyper-V Manager的位置了

虽然可以调试了,但是继续查看adb logcat 发现"libaot-mscorlib.dll.so"依然存在,但是 管他呢,毕竟调试器不再一闪而过了,以后真的因为这个问题卡住再解决好了~逃~

 

posted on 2017-02-19 16:12  GodZza  阅读(835)  评论(1编辑  收藏  举报