<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sdk &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/sdk/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Fri, 08 Mar 2013 04:13:05 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.1</generator>
	<item>
		<title>修改Android sdk hosts文件(无线开发)</title>
		<link>https://www.mudbest.com/%e4%bf%ae%e6%94%b9android-sdk-hosts%e6%96%87%e4%bb%b6%e6%97%a0%e7%ba%bf%e5%bc%80%e5%8f%91/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Fri, 01 Mar 2013 17:05:30 +0000</pubDate>
				<category><![CDATA[分享]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[windows phone 8]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=1789</guid>

					<description><![CDATA[最近有个项目刚好要对无线产品的开发，对移动终端的一些常规测试，但是手机又无法指定hosts，无法测试本地啊，咋 ... <a title="修改Android sdk hosts文件(无线开发)" class="read-more" href="https://www.mudbest.com/%e4%bf%ae%e6%94%b9android-sdk-hosts%e6%96%87%e4%bb%b6%e6%97%a0%e7%ba%bf%e5%bc%80%e5%8f%91/" aria-label="阅读 修改Android sdk hosts文件(无线开发)">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<p>最近有个项目刚好要对无线产品的开发，对移动终端的一些常规测试，但是手机又无法指定hosts，无法测试本地啊，咋办呢？这时候想到了wp8的sdk，但是wp8的hosts都是写在注册表里，过于麻烦，然后再考虑到Android，但是又遇到了以下的一些情况，google资料一把，自己整理下后，总体问题解决方法就出来了，国内很多网站也有这些资料，但都不全，甚至说了头没有尾，在这里分享给需要的网友。</p>
<p>用默认的SDK manage.exe打开Android之后，进行修改hosts会提示以下几种错误：<br />
1、Android Read-only file system<br />
2、No space left on device<br />
3、Out of memory<br />
<span id="more-1789"></span><br />
问题分析：<br />
这个也不算是什么问题，可能是打开Android的时候默认了大小，自身的内存没有进行设置，固然导致空间不够的问题。</p>
<p>解决方法：<br />
在E:\Program Files (x86)\os\Android\adt-bundle-windows-x86_64-20130219\sdk\tools里有一个emulator.exe的应用，将它创建一份快捷方式，右键这个快捷方式，选择属性，在目标一览里，在目标地址的后面加上以下参数：</p>
<pre class="brush: plain; title: ; notranslate">
-avd shadow -memory 768 -partition-size 1024
</pre>
<p>那么全部加起来就是：</p>
<pre class="brush: plain; title: ; notranslate">
&quot;E:\Program Files (x86)\os\Android\adt-bundle-windows-x86_64-20130219\sdk\tools\emulator.exe&quot; -avd shadow -memory 768 -partition-size 1024
</pre>
<p>-avd 设备名称 -memory 内存大小 -partition-size 设置system和data的空间大小。</p>
<p>如下数据：<br />
root@android:/ # df<br />
df</p>
<pre class="brush: plain; title: ; notranslate">
Filesystem             Size   Used   Free   Blksize
/dev                   378M    32K   378M   4096
/mnt/secure            378M     0K   378M   4096
/mnt/asec              378M     0K   378M   4096
/mnt/obb               378M     0K   378M   4096
/system                993M   198M   794M   4096
/data                  993M    10M   982M   4096
/cache                  64M     1M    62M   4096
/mnt/sdcard              1G   206K     1G   2048
/mnt/secure/asec         1G   206K     1G   2048
</pre>
<p>当遇到第一种错误的时候，那说明没有写入权限了，按照以下操作可解决该问题。</p>
<p>首先进入E:\Program Files (x86)\os\Android\adt-bundle-windows-x86_64-20130219\sdk\platform-tools，也可将此路径设置一个全局变量，这样就可以直接使用adb了，如果没有设置，那么就需要在命令行进入该目录，然后输入adb.exe 即可达到一样的效果。</p>
<p>首先以root的形式进入命令行</p>
<pre class="brush: plain; title: ; notranslate">
adb shell
</pre>
<p>先排除Android Read-only file system 错误</p>
<pre class="brush: plain; title: ; notranslate">
mount -o remount rw /
</pre>
<p>设置目录可读写权限</p>
<pre class="brush: plain; title: ; notranslate">
mount -o remount,rw rootfs /system/
</pre>
<p>转向hosts所有目录</p>
<pre class="brush: plain; title: ; notranslate">
cd /system/etc
</pre>
<p>修改hosts文件</p>
<pre class="brush: plain; title: ; notranslate">
#echo &quot;127.0.0.1 localhost&quot; &gt; hosts
#echo &quot;127.0.0.1 www.tieyou.com&quot; &gt;&gt; hosts
</pre>
<p>至此即可对hosts进行修改了，用命令修改固然没有效率，那么可以现在本地创建好hosts，然后退出root shell，ctrl+c即可退出shell模式。</p>
<pre class="brush: plain; title: ; notranslate">
adb push d:/hosts /system/etc/hosts
</pre>
<p>附上对google的各种墙，解决：Failed to fetch URL https://dl-ssl……等错误</p>
<p>错误信息:</p>
<pre class="brush: plain; title: ; notranslate">
Failed to fectch URl https://dl-ssl.google.com/android/repository/addons_list.xml, reason: Connection to https://dl-ssl.google.com refused
</pre>
<p>用notepad打开C:/WINDOWS/system32/drivers/etc中的hosts文件<br />
在最后一行添加74.125.237.1 dl-ssl.google.com<br />
成功解决问题。</p>
<p>修改网关等操作如下：</p>
<pre class="brush: plain; title: ; notranslate">
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
route add default gw 192.168.1.1 dev eth0 
setprop net.dns1 202.106.0.20
</pre>
<p>这样就将本地已经创建好的hosts上传到Android了，到此操作结束。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
