【背景】
折腾了:
【记录】Android Studio中导入OsmAnd并编译
后,去编译,调试,运行OsmAnd。
【折腾过程】
1.Run->Run OsmAnd
弹出选择对话框:
2.然后窗口切换到:
Run的输出
C:\Users\Administrator\AppData\Local\Android\sdk\tools\emulator.exe -avd Nexus_5_API_21_x86 -netspeed full -netdelay none Creating filesystem with parameters: Size: 69206016 Block size: 4096 Blocks per group: 32768 Inodes per group: 4224 Inode size: 256 Journal blocks: 1024 Label: Blocks: 16896 Block groups: 1 Reserved block group size: 7 Created filesystem with 11/4224 inodes and 1302/16896 blocks emulator: device fd:1236 HAX is not working and emulator runs in emulation mode emulator: The memory needed by this VM exceeds the driver limit. emulator: warning: opening audio input failed creating window 61 83 462 820 emulator: emulator window was out of view and was recentered
然后虚拟机运行了半天都还是Android那几个字母的界面,根本进不去,所以直接关了。
3.猜测是不是由于当前这个虚拟机有问题,所以打算重新去建一个虚拟机AVD:
4.创建好AVD后,然后用这个虚拟机重新运行试试:
结果还是无法运行。
5.后来的后来,不管了,先去试试是否可以Android真机调试,结果试的结果是可以的:
把Android手机连接到电脑后,此处的AVD管理器可以看到新插入的设备,可以选择运行调试:
然后log是:
Waiting for device. Target device: huawei-h60_l03-X8QDU14A24009580 Uploading file local path: E:\crifan\DevRoot\Osmand-master\OsmAnd\build\outputs\apk\OsmAnd-free-legacy-armv5-debug.apk remote path: /data/local/tmp/net.osmand Installing net.osmand DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/net.osmand" pkg: /data/local/tmp/net.osmand Success Launching application: net.osmand/net.osmand.plus.activities.MapActivity. DEVICE SHELL COMMAND: am start -n "net.osmand/net.osmand.plus.activities.MapActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=net.osmand/.plus.activities.MapActivity }
然后跳转到:
然后就可以在Android手机上继续调试了。
对应的logcat输出:
04-15 11:07:41.050 28909-28909/net.osmand W/System.err﹕ Startup service btools.routingapp.BRouterServiceConnection took too long 33 ms 04-15 11:07:41.170 28909-28909/net.osmand I/net.osmand﹕ ResourceManager Tiles to load in memory : 144.0 04-15 11:07:41.170 28909-28909/net.osmand W/System.err﹕ Startup service net.osmand.plus.resources.ResourceManager took too long 113 ms 04-15 11:07:41.180 28909-28909/net.osmand I/System.out﹕ Time to start application 293 ms. Should be less < 800 ms 04-15 11:07:41.185 28909-28909/net.osmand I/System.out﹕ Time to init plugins 7 ms. Should be less < 800 ms 04-15 11:07:41.210 28909-28933/net.osmand E/net.osmand﹕ GPXUtilities Error reading gpx java.io.FileNotFoundException: /data/data/net.osmand/files/favourites_bak.gpx: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:402) at java.io.FileInputStream.<init>(FileInputStream.java:78) at net.osmand.plus.GPXUtilities.loadGPXFile(GPXUtilities.java:788) at net.osmand.plus.FavouritesDbHelper.loadGPXFile(FavouritesDbHelper.java:421) at net.osmand.plus.FavouritesDbHelper.loadFavorites(FavouritesDbHelper.java:68) at net.osmand.plus.AppInitializer.startApplicationBackground(AppInitializer.java:373) at net.osmand.plus.AppInitializer.access$200(AppInitializer.java:58) at net.osmand.plus.AppInitializer$8.run(AppInitializer.java:582) at java.lang.Thread.run(Thread.java:841) Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) at libcore.io.IoBridge.open(IoBridge.java:393) at java.io.FileInputStream.<init>(FileInputStream.java:78) at net.osmand.plus.GPXUtilities.loadGPXFile(GPXUtilities.java:788) at net.osmand.plus.FavouritesDbHelper.loadGPXFile(FavouritesDbHelper.java:421) at net.osmand.plus.FavouritesDbHelper.loadFavorites(FavouritesDbHelper.java:68) at net.osmand.plus.AppInitializer.startApplicationBackground(AppInitializer.java:373) at net.osmand.plus.AppInitializer.access$200(AppInitializer.java:58) at net.osmand.plus.AppInitializer$8.run(AppInitializer.java:582) at java.lang.Thread.run(Thread.java:841) 04-15 11:07:41.210 28909-28933/net.osmand E/net.osmand﹕ GPXUtilities Error reading gpx java.io.FileNotFoundException: /storage/emulated/0/osmand/favourites.gpx: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:402) at java.io.FileInputStream.<init>(FileInputStream.java:78) at net.osmand.plus.GPXUtilities.loadGPXFile(GPXUtilities.java:788) at net.osmand.plus.FavouritesDbHelper.loadGPXFile(FavouritesDbHelper.java:421) at net.osmand.plus.FavouritesDbHelper.loadFavorites(FavouritesDbHelper.java:69) at net.osmand.plus.AppInitializer.startApplicationBackground(AppInitializer.java:373) at net.osmand.plus.AppInitializer.access$200(AppInitializer.java:58) at net.osmand.plus.AppInitializer$8.run(AppInitializer.java:582) at java.lang.Thread.run(Thread.java:841) Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) at libcore.io.IoBridge.open(IoBridge.java:393) at java.io.FileInputStream.<init>(FileInputStream.java:78) at net.osmand.plus.GPXUtilities.loadGPXFile(GPXUtilities.java:788) at net.osmand.plus.FavouritesDbHelper.loadGPXFile(FavouritesDbHelper.java:421) at net.osmand.plus.FavouritesDbHelper.loadFavorites(FavouritesDbHelper.java:69) at net.osmand.plus.AppInitializer.startApplicationBackground(AppInitializer.java:373) at net.osmand.plus.AppInitializer.access$200(AppInitializer.java:58) at net.osmand.plus.AppInitializer$8.run(AppInitializer.java:582) at java.lang.Thread.run(Thread.java:841) 04-15 11:07:41.215 28909-28933/net.osmand I/System.out﹕ Initialized FAVORITES_INITIALIZED in 34 ms 04-15 11:07:41.275 28909-28909/net.osmand I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted 04-15 11:07:41.275 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve virtual method 14795: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V 04-15 11:07:41.285 28909-28909/net.osmand I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll 04-15 11:07:41.285 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve virtual method 14801: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V 04-15 11:07:41.285 28909-28909/net.osmand I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled 04-15 11:07:41.285 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve virtual method 11052: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V 04-15 11:07:41.290 28909-28909/net.osmand I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations 04-15 11:07:41.290 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve virtual method 2058: Landroid/content/res/TypedArray;.getChangingConfigurations ()I 04-15 11:07:41.305 28909-28909/net.osmand I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType 04-15 11:07:41.305 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve virtual method 2080: Landroid/content/res/TypedArray;.getType (I)I 04-15 11:07:41.650 28909-28909/net.osmand I/dalvikvm﹕ Could not find method android.view.View.<init>, referenced from method com.software.shell.fab.ActionButton.<init> 04-15 11:07:41.650 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve direct method 14540: Landroid/view/View;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;II)V 04-15 11:07:41.650 28909-28909/net.osmand I/dalvikvm﹕ Could not find method com.software.shell.fab.ActionButton.getElevation, referenced from method com.software.shell.fab.ActionButton.hasElevation 04-15 11:07:41.650 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve virtual method 30201: Lcom/software/shell/fab/ActionButton;.getElevation ()F 04-15 11:07:41.650 28909-28909/net.osmand W/dalvikvm﹕ Unable to resolve superclass of Lcom/software/shell/fab/ActionButtonOutlineProvider; (1686) 04-15 11:07:41.650 28909-28909/net.osmand W/dalvikvm﹕ Link of class 'Lcom/software/shell/fab/ActionButtonOutlineProvider;' failed 04-15 11:07:41.650 28909-28909/net.osmand E/dalvikvm﹕ Could not find class 'com.software.shell.fab.ActionButtonOutlineProvider', referenced from method com.software.shell.fab.ActionButton.drawElevation 04-15 11:07:41.650 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve new-instance 3111 (Lcom/software/shell/fab/ActionButtonOutlineProvider;) in Lcom/software/shell/fab/ActionButton; 04-15 11:07:41.655 28909-28909/net.osmand W/dalvikvm﹕ Unable to resolve superclass of Lcom/software/shell/fab/ActionButtonOutlineProvider; (1686) 04-15 11:07:41.655 28909-28909/net.osmand W/dalvikvm﹕ Link of class 'Lcom/software/shell/fab/ActionButtonOutlineProvider;' failed 04-15 11:07:41.710 28909-28933/net.osmand E/net.osmand﹕ MapRenderingTypes Unexpected error java.lang.IllegalArgumentException: is == null at org.kxml2.io.KXmlParser.setInput(KXmlParser.java:1625) at net.osmand.osm.MapPoiTypes.init(MapPoiTypes.java:226) at net.osmand.plus.AppInitializer.initPoiTypes(AppInitializer.java:248) at net.osmand.plus.AppInitializer.startApplicationBackground(AppInitializer.java:376) at net.osmand.plus.AppInitializer.access$200(AppInitializer.java:58) at net.osmand.plus.AppInitializer$8.run(AppInitializer.java:582) at java.lang.Thread.run(Thread.java:841) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ java.lang.IllegalArgumentException: is == null 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at org.kxml2.io.KXmlParser.setInput(KXmlParser.java:1625) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.osm.MapPoiTypes.init(MapPoiTypes.java:226) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.plus.AppInitializer.initPoiTypes(AppInitializer.java:248) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.plus.AppInitializer.startApplicationBackground(AppInitializer.java:376) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.plus.AppInitializer.access$200(AppInitializer.java:58) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.plus.AppInitializer$8.run(AppInitializer.java:582) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at java.lang.Thread.run(Thread.java:841) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ java.lang.IllegalArgumentException: is == null 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at org.kxml2.io.KXmlParser.setInput(KXmlParser.java:1625) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.osm.MapPoiTypes.init(MapPoiTypes.java:226) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.plus.AppInitializer.initPoiTypes(AppInitializer.java:248) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.plus.AppInitializer.startApplicationBackground(AppInitializer.java:376) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.plus.AppInitializer.access$200(AppInitializer.java:58) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at net.osmand.plus.AppInitializer$8.run(AppInitializer.java:582) 04-15 11:07:41.710 28909-28933/net.osmand W/System.err﹕ at java.lang.Thread.run(Thread.java:841) 04-15 11:07:41.940 28909-28909/net.osmand W/System.err﹕ OnCreate for MapActivity took 736 ms 04-15 11:07:41.950 28909-28909/net.osmand I/dalvikvm﹕ Could not find method android.widget.Button.<init>, referenced from method net.osmand.plus.widgets.ButtonEx.<init> 04-15 11:07:41.950 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve direct method 15196: Landroid/widget/Button;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;II)V 04-15 11:07:41.950 28909-28909/net.osmand I/dalvikvm﹕ Could not find method android.widget.TextView.<init>, referenced from method net.osmand.plus.widgets.TextViewEx.<init> 04-15 11:07:41.950 28909-28909/net.osmand W/dalvikvm﹕ VFY: unable to resolve direct method 15640: Landroid/widget/TextView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;II)V 04-15 11:09:11.130 28909-28909/net.osmand W/System.err﹕ OnCreate for MapActivity took 89174 ms 04-15 11:09:11.380 28909-28909/net.osmand W/System.err﹕ OnCreate for MapActivity took 100 ms
6.OsmAnd的app的一些截图:
点击进入地图后,暂时没有地图数据,所以是空的:
然后点击左下角的地球,显示出不同的出行方式选择:
然后是配置页面:
其他一些功能:
【总结】
OsmAnd的Android的app,看起来是很不错的。
只是暂时出现了个 渲染选中区域时发生错误。好像是由于缺少本地地图之类的原因。那就是感兴趣的,后续自己去调试解决此问题了。
无论如何:
截至目前,是可以在Windows中,通过Android Studio编译通过OsmAnd并连接Android手机进行调试了,OsmAnd可以在Android手机中运行了。
转载请注明:在路上 » 【记录】Android Studio中调试和运行OsmAnd