<?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>Martin Falatic’s Techno Blog &#187; Android</title>
	<atom:link href="http://www.falatic.com/index.php/tag/android/feed" rel="self" type="application/rss+xml" />
	<link>http://www.falatic.com</link>
	<description>Technobabble...</description>
	<lastBuildDate>Thu, 20 Oct 2011 05:26:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Thoughts on mobile app crash detection and recovery</title>
		<link>http://www.falatic.com/index.php/51/thoughts-on-mobile-app-crash-detection-and-recovery</link>
		<comments>http://www.falatic.com/index.php/51/thoughts-on-mobile-app-crash-detection-and-recovery#comments</comments>
		<pubDate>Thu, 20 Oct 2011 05:26:54 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[recovery]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=51</guid>
		<description><![CDATA[As I work on updates to my app, I&#8217;m happy to see it&#8217;s working quite well. However, inevitably there will be some boundary case that causes an exception, and as I add features (and more importantly, persistent settings) an addition &#8230; <a class="more-link" href="http://www.falatic.com/index.php/51/thoughts-on-mobile-app-crash-detection-and-recovery">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">As I work on updates to my app, I&#8217;m happy to see it&#8217;s working quite well. However, inevitably there will be some boundary case that causes an exception, and as I add features (and more importantly, persistent settings) an addition risk comes into play: failed restarts after a crash.</p>
<p><span id="more-51"></span><br />
Unlike a desktop app, where one could add a &#8220;safe mode&#8221; icon for such instances, there are few options in the mobile space. These include:</p>
<ul>
<li>Letting the user delete the application data manually via the Settings menu</li>
<li>Automatically resetting to defaults after a crash</li>
<li>Attempting to automatically work around the broken area</li>
<li>Asking the user on restart if they want to reset to defaults</li>
<li>Falling back to the last known-good configuration</li>
</ul>
<p>It&#8217;s one thing to <em>be</em> a power user, but another to be <em>forced</em> to become one thus the first option isn&#8217;t really practical. The second option guarantees recovery but may degrade the user experience (especially if there are lots of settings involved)&#8230; it should be a last resort, and a user choice. The third option is nice, but can become quite complex: this works best if settings are checkpointed frequently, but such frequent saves to flash memory are not usually a great idea. In addition, the more complex the fail-safe, the more likely it may cause a triggering exception.</p>
<p>Asking the user first is an important part of any solution, but it requires architecting a fail-safe startup sequence (one that is preference invariant). One can then offer the choice of a &#8220;fresh start&#8221; or the option of using a backed-up configuration, ensuring that the user has at least a chance of restoring to a previously working state with their settings intact.</p>
<p>A useful pattern for a single-instance app would be the following, using a persistent <em>IsRunning</em> flag:</p>
<ul>
<li>App launches</li>
<li>Load settings</li>
<li>Check if the <em> IsRunning</em> flag is set: if it is, then the last run exited abnormally (none of the normal exit points were hit which would&#8217;ve cleared the flag):</li>
<ul>
<li>Clear the <em>IsRunning</em> flag</li>
<li>Offer to restore from backup / defaults or attempt to continue as-is</li>
</ul>
<li>Initialize states and display initial UI presentation</li>
<li>Save the current settings with a backup name</li>
<li>Set the <em>IsRunning</em> flag</li>
<li>Save the settings normally</li>
<li>On normal app exit / backgrounding, clear the <em>IsRunning</em> flag and save settings normally</li>
</ul>
<p>There are other things you can do, including instrumenting for crash data collection and presenting the user an option to forward that data (anonymized!) to you for analysis.</p>
<p><strong>Software quality is as much about how well you avoid defects in the first place as it is about how gracefully you recover from them!<sup>†</sup></strong> Mistakes happen, especially in apps with complex GUIs. Errors should be as rare as possible, but when errors occur it&#8217;s the unrecoverable ones that lead to lost users. Solid error handling and recovery goes a long way towards satisfied users who stick around for the release that irons out the bug they encountered and worked around</p>
<p><strong><sup>†</sup></strong><em>This is a critical difference between hardware and software quality, especially for smaller shops. If you ship a physically defective device, the typical recourse is a return for repair or replacement &#8211; a costly proposition in terms of logistics as well as reworked hardware / waste. The quality patterns for software and hardware have commonalities but are generally quite different in practice: in general, hardware is by its very nature </em>far<em> more costly and less forgiving of quality failures. This is why popular hardware quality initiatives tend to translate poorly to the software space.</em></p>
<p><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;linkname=Thoughts%20on%20mobile%20app%20crash%20detection%20and%20recovery" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;linkname=Thoughts%20on%20mobile%20app%20crash%20detection%20and%20recovery" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a><a class="a2a_button_tumblr" href="http://www.addtoany.com/add_to/tumblr?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;linkname=Thoughts%20on%20mobile%20app%20crash%20detection%20and%20recovery" title="Tumblr" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/tumblr.png" width="16" height="16" alt="Tumblr"/></a><a class="a2a_button_slashdot" href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;linkname=Thoughts%20on%20mobile%20app%20crash%20detection%20and%20recovery" title="Slashdot" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;count=horizontal&amp;text=Thoughts%20on%20mobile%20app%20crash%20detection%20and%20recovery" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;count=horizontal&amp;text=Thoughts%20on%20mobile%20app%20crash%20detection%20and%20recovery" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;title=Thoughts%20on%20mobile%20app%20crash%20detection%20and%20recovery" id="wpa2a_2"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/51/thoughts-on-mobile-app-crash-detection-and-recovery/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android, Honeycomb and the missing menu button&#8230;</title>
		<link>http://www.falatic.com/index.php/48/android-honeycomb-and-the-missing-menu-button</link>
		<comments>http://www.falatic.com/index.php/48/android-honeycomb-and-the-missing-menu-button#comments</comments>
		<pubDate>Wed, 12 Oct 2011 15:59:01 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[action bar]]></category>
		<category><![CDATA[Honeycomb]]></category>
		<category><![CDATA[menu]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=48</guid>
		<description><![CDATA[I&#8217;ve been giving some thought to the loss of the menu button (replaced &#8211; in a way &#8211; by the action bar) in Honeycomb lately and I have to say it&#8217;s a damned peculiar choice. The argument is that by &#8230; <a class="more-link" href="http://www.falatic.com/index.php/48/android-honeycomb-and-the-missing-menu-button">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been giving some thought to the loss of the menu button (replaced &#8211; in a way &#8211; by the action bar) in Honeycomb lately and I have to say it&#8217;s a damned peculiar choice. The argument is that by unifying the UI on Honeycomb fragmentation will be reduced, but for full-screen apps, taking away the menu button on API 11+ builds, from the region of the screen that cannot be hidden, <em>fosters</em> UI fragmentation.</p>
<p><span id="more-48"></span></p>
<p>Consider apps that are meant to be full-screen, and may be deeply interactive (such as a game). Having the action bar onscreen is not tenable, so one hides it. Whereas before you could use the menu button in the gutter (where &#8220;home&#8221; and &#8220;back&#8221; reside and indeed where &#8220;menu&#8221; appears &#8211; only for legacy apps), now you must either code your own button or invent a unique (<em>but intuitive!</em>) gesture to accomplish the end result of opening a custom menu or showing the action bar. If that&#8217;s not UI fragmentation I don&#8217;t know what is!</p>
<p>Though I find the action bar awkwardly placed and non-intuitive for in-app interactions, I understand the merit of having a unified UI. What I find fault with is the shortsighted decision to effectively remove an important <em>hard</em> button from Android (does <em>anyone</em> miss the &#8220;search&#8221; button?)</p>
<p>Now we have only two guaranteed (not hideable) buttons left, for the purpose of app navigation: &#8220;back&#8221; and &#8220;home&#8221; &#8211; along with a third new button for fast task switching (which is a little redundant&#8230; long-press on the home button could easily have the same effect without adding buttons). In addition (and likely for the foreseeable future) we have a &#8220;menu&#8221; button that only appears for legacy apps (thus that space in the toolbar is already &#8220;reserved&#8221; and will remain so for quite some time).</p>
<p>It&#8217;s too bad&#8230; there&#8217;s a strong argument for always having a &#8220;menu&#8221; button handy in an always-visible place. Maybe it unhides your action bar, or maybe it opens a custom menu, but removing it doesn&#8217;t help matters: it simply encourages a new kind of fragmentation for apps that don&#8217;t need an action bar onscreen normally. Now, instead of having a consistent way to perform that &#8220;open menu&#8221; action everyone gets to do it their own way (or leave the action bar open full-time, which significantly detracts from some apps).</p>
<p>One of many things that I <em>like</em> about Android is that the basic controls (home, menu, back) are intuitive and reasonable, balancing function with minimalism. Contrast this with the one overloaded hard button in another popular OS: much like a one-button mouse, oversimplification leads to confusion, reduced functionality and a fragmented UI as everyone works around the limitation differently according to their app&#8217;s design.</p>
<p><strong>The rationale for taking away the menu button &#8211; one of the three main &#8220;always-visible&#8221; navigation and control buttons for Android up to now &#8211; defies logic: it fails at reducing fragmentation and funnels developers (and thus users) into an awkward, one-size-fits-all paradigm that is the antithesis of Android. This loss of a &#8220;hard&#8221; menu button is an unwelcome reduction in basic functionality in an apparent nod to the oversimplification of other OSes. I don&#8217;t find fault with the existence of the action bar, but removing the dedicated menu button from the always-visible area of the screen was IMHO extremely shortsighted. Now, instead of having a convenient way to reveal a hidden action bar, one must figure out how to do this for each app that normally hides its action bar. All this for the sake of removing a button that appears anyway for legacy apps.<br />
</strong></p>
<p><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;linkname=Android%2C%20Honeycomb%20and%20the%20missing%20menu%20button%26%238230%3B" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;linkname=Android%2C%20Honeycomb%20and%20the%20missing%20menu%20button%26%238230%3B" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a><a class="a2a_button_tumblr" href="http://www.addtoany.com/add_to/tumblr?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;linkname=Android%2C%20Honeycomb%20and%20the%20missing%20menu%20button%26%238230%3B" title="Tumblr" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/tumblr.png" width="16" height="16" alt="Tumblr"/></a><a class="a2a_button_slashdot" href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;linkname=Android%2C%20Honeycomb%20and%20the%20missing%20menu%20button%26%238230%3B" title="Slashdot" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;count=horizontal&amp;text=Android%2C%20Honeycomb%20and%20the%20missing%20menu%20button%26%238230%3B" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;count=horizontal&amp;text=Android%2C%20Honeycomb%20and%20the%20missing%20menu%20button%26%238230%3B" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;title=Android%2C%20Honeycomb%20and%20the%20missing%20menu%20button%26%238230%3B" id="wpa2a_4"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/48/android-honeycomb-and-the-missing-menu-button/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building the Android emulator for Windows</title>
		<link>http://www.falatic.com/index.php/43/building-the-android-emulator-for-windows</link>
		<comments>http://www.falatic.com/index.php/43/building-the-android-emulator-for-windows#comments</comments>
		<pubDate>Sun, 25 Sep 2011 10:23:13 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[MinGW]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=43</guid>
		<description><![CDATA[Today I&#8217;ve been investigating an argument parsing bug in Android&#8217;s emulator on Windows (a bug that may affect all platforms). The version I&#8217;m seeing the bug was in the Android SDK r12 version of the emulator [Yep, r13's out - &#8230; <a class="more-link" href="http://www.falatic.com/index.php/43/building-the-android-emulator-for-windows">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve been investigating an argument parsing bug in Android&#8217;s emulator on Windows (a bug that <em>may</em> affect all platforms). The version I&#8217;m seeing the bug was in the Android SDK r12 version of the emulator [Yep, r13's out - see note below.]</p>
<p>As part of this, I needed to rebuild the emulator. It was not as straightforward as I&#8217;d hoped so I decided to write up a little howto here in case others decide to try rebuilding it on Windows. It&#8217;s really not hard at all once you install a few prerequisites! [Note: You'll also find info here about building this via Linux.]</p>
<p><span id="more-43"></span></p>
<p><em>[<strong>Edit:</strong> As of this post the HEAD is 6e2f62...599648 <em>for platform_external_qemu</em>. While this post-r12 work WILL build in Windows with these procedures, I just found out that the older r12 code (tagged as </em>android-sdk-tools_r12<em>) will NOT build in Windows! You'd need to do r12-based builds in Linux with MinGW installed. It's interesting to see just how much was fixed since SDK r12... including, evidently, the very issue I discovered today! <del>Hopefully SDK r13 gets released soon.</del> Oh look, it's out! Interestingly, unlike r12 there is no corresponding r13 tag for this one... which is part of why I didn't notice it in the Git log (I saw the tools_r13 branch though there are lots of changes after that).]</em></p>
<p><span style="text-decoration: underline;"><strong>Note:</strong></span> If you choose other install dirs, adjust the values below accordingly!</p>
<p><strong>Install Python 2.6 or 2.7:</strong></p>
<ul>
<li>I used ActivePython 2.7.2.5 x64 (x86 should be equally good)</li>
<li>Download: <a href="http://www.activestate.com/activepython/downloads" target="_blank">http://www.activestate.com/activepython/downloads</a></li>
<li>Default bin dir for Python = C:\Python27</li>
</ul>
<p><strong>Install MinGW (it includes msys now):</strong></p>
<ul>
<li>Information: <a href="http://www.mingw.org/wiki/MinGW" target="_blank">http://www.mingw.org/wiki/MinGW</a></li>
<li>Download: <a href="http://sourceforge.net/projects/mingw/" target="_blank">http://sourceforge.net/projects/mingw/</a></li>
<li>Default bin dir for MinGW = C:\MinGW\bin</li>
<li>Default bin dir for msys = C:\MinGW\msys\1.0\bin</li>
</ul>
<p><strong>Install Git:</strong> I use <em>msysgit</em> because I also use (and happily recommend!) <a href="http://code.google.com/p/tortoisegit/" target="_blank">TortoiseGit 1.7.3.0</a>:</p>
<ul>
<li>Information: <a href="http://code.google.com/p/msysgit/" target="_blank">http://code.google.com/p/msysgit/</a></li>
<li>Download: <a href="http://code.google.com/p/msysgit/downloads/list" target="_blank">http://code.google.com/p/msysgit/downloads/list</a></li>
<ul>
<li>Git-1.7.4-preview20110204.exe works, 1.7.6 may as well</li>
</ul>
<li>Default bin dir for Git = C:\Git\bin</li>
</ul>
<p><strong>Open a command prompt and ensure your path is set correctly (omit duplicates as necessary, but ensure such entries weren&#8217;t eclipsed by other things you&#8217;ve installed, like Cygwin):</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
set PATH=C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Python27;C:\Git\bin;%PATH%
</pre>
<p><strong>Clone the repository! (Because of the kernel.org outage we&#8217;re using <a href="https://github.com/android/platform_external_qemu" target="_blank">the github mirror</a>):</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
mkdir H:\temp_repo
cd /D H:\temp_repo
git clone https://github.com/android/platform_external_qemu.git
</pre>
<p><strong>Start bash in the folder with the emulator sources (from this point on commands run at the bash prompt):</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
cd /D H:\temp_repo\platform_external_qemu
bash
</pre>
<p><strong>Setting PS1 makes the prompt more verbose than the default <em>&#8220;bash-3.1$&#8221;</em> prompt:</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
PS1='\[\e]0;\w\a\]\n\[\e[36m\]\u@\h \[\e[32m\]\w\[\e[0m\]\n\$ '
</pre>
<p><strong>There&#8217;s a small problem if you want the version string in the emulator to be fully formed:</strong></p>
<ul>
<li>In <em>Makefile.common</em>, ANDROID_BUILD_ID get set <em>only</em> if <em>BUILD_STANDALONE_EMULATOR == &#8220;&#8221;</em> &#8211; never if <em>BUILD_STANDALONE_EMULATOR == &#8216;true&#8217;</em> (which is what we&#8217;re building here). Here&#8217;s a fix for that, at least for the 13.x line of the emulator (line numbers may vary!):</li>
<ul>
<li>Broken: line 66: <em>ifeq ($(BUILD_STANDALONE_EMULATOR),)</em></li>
<li>Patched: line 66: <em>ifneq ($(BUILD_STANDALONE_EMULATOR),false)</em></li>
</ul>
<li><strong>If in doubt, ignore this tweak</strong>! Understand your -version output will not be very informative. That can quickly get annoying if you are building multiple versions&#8230;</li>
</ul>
<p><strong>Set some variables and run the build:</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
# Customize this as desired
export ANDROID_SDK_TOOLS_REVISION=42
export ANDROID_BUILD_ID=custom

# Inserts your username and the timestamp in the build name
export MY_BUILD_TIMESTAMP=`date +%Y%m%d_%H%M%S`
export BUILD_ID=${USERNAME}
export BUILD_NUMBER=${MY_BUILD_TIMESTAMP}

# Executes the build
./android-rebuild.sh --static 2&gt;&amp;1 | \
   tee build_${USERNAME}-${MY_BUILD_TIMESTAMP}.log
</pre>
<p><strong>Check the version string of the emulator you just built:</strong></p>
<ul>
<li>Run this:</li>
<ul>
<li><em>objs/emulator.exe -version</em></li>
</ul>
<li>See output like this:</li>
<ul>
<li>Android emulator version 13.0 (build_id Marty-20110925_042430)</li>
</ul>
</ul>
<p><strong>Using the newly-built emulator:</strong></p>
<ul>
<li><strong></strong>The objects of interest in objs are:<em></em></li>
<ul>
<li><em>emulator.exe</em>, <em>emulator-arm.exe, </em><em>emulator-x86.exe</em></li>
</ul>
<li>You may need to copy them to <em>android-sdk-windows/tools</em> folder to use them (<strong>back up the originals first before replacing them!</strong>)</li>
</ul>
<p><strong>Notes on building via Linux:</strong></p>
<p style="padding-left: 30px;">As mentioned above, I managed to get all this to work on Windows just fine&#8230; technically, no source edits are necessary at this point to make it work. However, when I switched to the <em>android-sdk-tools_r12</em> tag it failed with:<em></em></p>
<p style="padding-left: 60px;"><em>cc1: error: unrecognized command line option &#8220;-mno-cygwin&#8221;</em></p>
<p style="padding-left: 30px;">Turns out this is a <a href="http://code.google.com/p/android/issues/detail?id=18949" target="_blank">known issue</a>&#8230; and in fact it was fixed in a later commit to the emulator code base! (I saw it as I was browsing the overall delta between r12 and the latest.) But, even with that fixed I couldn&#8217;t get r12 to build within Windows, so I went to Linux. I was already configured to build CyanogenMod, so everything was in place except MinGW. I installed <em>mingw32</em>, made that one fix to <em>android-rebuild.sh</em> and ran:</p>
<p style="padding-left: 60px;">./android-rebuild.sh &#8211;static &#8211;mingw</p>
<p style="padding-left: 30px;">And it worked just fine!</p>
<p style="padding-left: 30px;">(<strong>Note:</strong> the &#8211;mingw option is NOT used when building this within Windows&#8230; it&#8217;s a little confusing because of course we&#8217;re using MinGW <em>in</em> Windows, but that&#8217;s how it&#8217;s coded in their build system.)</p>
<p><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;linkname=Building%20the%20Android%20emulator%20for%20Windows" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;linkname=Building%20the%20Android%20emulator%20for%20Windows" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a><a class="a2a_button_tumblr" href="http://www.addtoany.com/add_to/tumblr?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;linkname=Building%20the%20Android%20emulator%20for%20Windows" title="Tumblr" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/tumblr.png" width="16" height="16" alt="Tumblr"/></a><a class="a2a_button_slashdot" href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;linkname=Building%20the%20Android%20emulator%20for%20Windows" title="Slashdot" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;count=horizontal&amp;text=Building%20the%20Android%20emulator%20for%20Windows" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;count=horizontal&amp;text=Building%20the%20Android%20emulator%20for%20Windows" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;title=Building%20the%20Android%20emulator%20for%20Windows" id="wpa2a_6"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/43/building-the-android-emulator-for-windows/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building ZXing for Android part 3 – Using Eclipse</title>
		<link>http://www.falatic.com/index.php/12/building-zxing-for-android-part-3-using-eclipse</link>
		<comments>http://www.falatic.com/index.php/12/building-zxing-for-android-part-3-using-eclipse#comments</comments>
		<pubDate>Fri, 26 Feb 2010 08:42:25 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Barcode Scanner]]></category>
		<category><![CDATA[building]]></category>
		<category><![CDATA[Droid]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[success]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[ZXing]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=12</guid>
		<description><![CDATA[Several iterations of updates below: Update 1: This procedure works on the zxing-1.4.zip source base.  I&#8217;m trying to figure out why it doesn&#8217;t want to work easily with the most current SVN code (e.g., rev 1217 or 1220).  I thought &#8230; <a class="more-link" href="http://www.falatic.com/index.php/12/building-zxing-for-android-part-3-using-eclipse">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Several iterations of updates below:</p>
<p><span id="more-12"></span></p>
<p><strong><span style="text-decoration: underline;">Update 1:</span> This procedure works on the </strong><em>zxing-1.4.zip</em><strong> source base.  I&#8217;m trying to figure out why it doesn&#8217;t want to work easily with the most current SVN code (e.g., rev 1217 or 1220).  I thought it was just some preloading weirdness that caused the Java Stack Overflow errors, then I thought it was Subversion related, but now&#8230; now I&#8217;m not sure what&#8217;s going on but I&#8217;ll let you know if I figure it out.</strong></p>
<hr />
<p><strong><span style="text-decoration: underline;">Update 2:</span> Eclipse does NOT like the new version of </strong><em>/android/default.properties</em><strong> at all.  After you create the project folders but before you try creating the project in Eclipse, edit </strong><em>/android/default.properties</em><strong> and change</strong></p>
<p>&nbsp;</p>
<pre style="padding-left: 30px;">target=<strong>android-4</strong></pre>
<p><strong>to</strong></p>
<pre style="padding-left: 30px;">target=<strong>Google Inc.:Google APIs:4</strong></pre>
<p><strong>That seems to prevent the whole Stack Overflow problem.  I&#8217;m not sure why this changed or what the more correct thing to do it but there&#8217;s some apparently relevant discussion <a href="http://code.google.com/p/zxing/issues/detail?id=276" target="_blank">here</a>. Curiously, despite my reversion of this change I do not see any problem in my test builds here, whether in Eclipse or when using the command-line build as outlined previously.</strong></p>
<hr />
<p><strong><span style="text-decoration: underline;">Update 3:</span> If you comment out the </strong>target=<strong> line in that file entirely (using &#8220;#&#8221;) the problem <em>also </em>goes away &#8211; be sure to select an SDK level &gt;= 4 though.  Eclipse <em>still </em>forces you to select a Google APIs target, but if you double-click one of the &#8220;un-selectable&#8221; Android targets (click the text NOT the checkbox!) just right it&#8217;ll apparently take the setting and work OK.  Who knows if that works in general &#8211; probably not. With an Android target launching the AVD also goes much more smoothly!</strong></p>
<p>&nbsp;</p>
<p><strong>Question is, what is it that makes Eclipse insist this is an APIs project when default.properties is not giving it any hints? </strong><strong><strong>Or i</strong>s it a quirk of the SDK? </strong><strong>What triggers this, and is it more readily resolved than by doing this?</strong></p>
<hr />
<p><strong><span style="text-decoration: underline;">Update 4:</span> Last update for tonight. Once a project is in   Eclipse you can go to Properties -&gt; Android for that project and   select a suitable Android target.  As long as you don&#8217;t have   dependencies on Google APIs it should be fine.  If you </strong>/android/AndroidManifest.xml<strong> and remove the </strong>android:minSdkVersion<strong> setting that problem goes away as well (again, select Android 1.6 SDK level 4 to ensure proper operation).</strong></p>
<p>&nbsp;</p>
<p><strong>Either it&#8217;s Eclipse 3.5.1 or the ADT plugin that&#8217;s messing up here.  Regardless, it doesn&#8217;t seem to be any flaw in ZXing.  It&#8217;s rather annoying to see Eclipse acting like this&#8230; are other people seeing this sort of bug?</strong></p>
<p><span style="color: #0000ff;"><strong><span style="text-decoration: underline;">To  summarize:</span> to avoid all these painful problems just plain remove </strong>default.properties<strong> and edit </strong>AndroidManifest.xml<strong> before you create a new Eclipse project based on the latest source.   Ensure you select Android 1.6 SDK level 4 for best results.</strong></span></p>
<p><strong><span style="color: #0000ff;">Also, when you run the app it&#8217;s best to just start the AVD first, wiping user data, (or at least uninstalling the old version of your app) and being at the home screen before you &#8220;Run As&#8221;.  Otherwise, the app&#8217;s display ends up rather funky.</span></strong></p>
<p><strong><span style="color: #0000ff;">Finally, &#8220;Build Automatically&#8221; may be more trouble than it&#8217;s worth, at least for a larger project such as this.  Consider this if your head starts making dents in the wall as you struggle to make sense of Eclipse&#8217;s random &#8220;out of memory&#8221; errors. <img src='http://www.falatic.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
</span></strong></p>
<hr />
<p>In my <a href="http://www.falatic.com/index.php/9/building_zxing_for_android" target="_blank">previous post</a> I referred to a <a href="http://knol.google.com/k/alec-go/modifying-the-android-barcode-scanner/2vd5zn6va2fqd/2#" target="_blank">Knol</a> that tells you how to build ZXing for Android (the Barcode Scanner) using the <strong>Eclipse</strong> IDE.  There are pros and cons to doing this, given that ZXing is normally built from the command line using Ant (and during that build it is optimized using Proguard).</p>
<p>&nbsp;</p>
<p>However, my goal is to learn more about Android programming in general and to make it even more interesting, I&#8217;m doing it from Windows.  Having the project working in an IDE is preferable for me when it comes to unraveling functional connections and learning how a (quite useful!) Android app is put together.</p>
<p><!--more--></p>
<p>First of all, that Knol isn&#8217;t all that bad.  It helps if you read it carefully (I kept screwing up a particular step), however some of the steps are unclear apparently because the SDK has changed rather substantially since it was first written.  I&#8217;ve tried to be ridiculously detailed here so as to eliminate any possible confusion for the novice.</p>
<p>Second, it&#8217;s not clear that you need to install <em>anything</em> other than the <a href="http://www.eclipse.org/downloads/" target="_blank">Eclipse Classic 3.5.1</a> IDE and the <a href="http://developer.android.com/sdk/index.html" target="_blank">Android SDK</a> to perform this experiment.  I have the JDK, Ant and Proguard as well but they aren&#8217;t in my system paths nor is JAVA_HOME set system-wide yet.  Therefore I suspect none of that other stuff is getting referenced in this experiment.  You should have the IDE installed, the Android SDK installed and up-to-date, and the ADT Plugin for Eclipse (found on the SDK page).<strong> </strong></p>
<p><span style="text-decoration: underline;"><strong>Initialize the project in Eclipse</strong></span></p>
<ul>
<li>Obtain the <strong>ZXing </strong>source tree via zip or SVN as described in the previous posts.  We are only interested in the <em>/android</em> and the <em>/core/src </em>trees.  The rest of the paths and components may be ignored for the purpose of building the <strong>Barcode Scanner </strong>app for Android.</li>
<li>Place these in a working area.  For this example I used <em>D:\workspace\zxing</em></li>
<li><span style="text-decoration: underline;"><strong>An important note: </strong></span>the Android SDK Content loader doesn&#8217;t immediately start in Eclipse until you attempt to use or create an Adroid project, and it takes a while to load.   Therefore quickly creating a new Android project based on another Android project <em>while the SDK is loading </em>can have unwanted consequences &#8211; particularly, <strong>Stack Overflow</strong>s &#8211; which is apparently due to a race condition (if the Android SDK Content Loader is still processing when you pick the &#8220;based on&#8221; tree, bad, bad things happen).  It was a very distracting problem until I realized what was going on.</li>
<li>Start the Eclipse IDE
<ul>
<li>Close any open projects!</li>
<li> Note that <em>Project -&gt; Build Automatically </em>is selected</li>
</ul>
</li>
<li>From the menu select <em>File -&gt; New -&gt; Project&#8230;</em></li>
<li>In the new window select <em>Android -&gt; Android Project</em></li>
<li>If Build targets are NOT populated at all and there&#8217;s activity in the progress tab:
<ul>
<li>Close the <em>New Project </em>window.</li>
<li>Wait for the Android SDK Content Loader activity to complete (watch the progress tab!)</li>
<li>From the menu select <em>File -&gt; New -&gt; Project&#8230;</em> again</li>
<li>In the new window select <em>Android -&gt; Android Project</em> again</li>
<li>At this point the Build Targets should be properly populated and the progress tab should be idle/empty.</li>
</ul>
</li>
<li>Give the project a name.  For this example I used &#8220;<strong>BarExample</strong>&#8221; and will refer to that going forward.</li>
<li>Select <em>Create project from existing source</em></li>
<li>Browse to where you put the <strong>zxing </strong>source tree (this will become your workspace!)</li>
<li>Select the <em>/android </em>subfolder and click OK</li>
<li>The Build Target will automatically be selected as Google APIs 1.6
<ul>
<li>I&#8217;m not entirely sure why this happens &#8211; you cannot select Android alone either.  I think this is why you are later warned when trying to launch it that there are no compatible devices.</li>
</ul>
</li>
<li>The Application name will be auto-filled as <strong>CaptureActivity</strong></li>
<li>Click <em>Finish</em></li>
</ul>
<p><strong>Allow it to prebuild.  At this point you&#8217;ll have some 250+ errors but the next step should resolve them!</strong></p>
<p><span style="text-decoration: underline;"><strong>Add the <em>/core/src </em>code to your project:</strong></span></p>
<p style="padding-left: 30px;"><span style="color: #808080;"><em><strong><span style="text-decoration: underline;"><span style="text-decoration: line-through;">Hard way #1:</span></span></strong><br />
</em></span></p>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">In the <em>Package Exp </em>tab, right click on the project name (&#8220;BarExample&#8221;) and select <em>New -&gt; Source Folder</em></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">Folder name: <strong>srccore</strong></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">&#8220;Update exclusion&#8221; is UNchecked</span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">Click <em>OK</em></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">Now, right click on srccore and <em>Import&#8230;</em></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">Select <em>General -&gt; File System</em> and click <em>Next</em></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">Select the <em>&#8220;core\src&#8221; </em>folder in the zxing source tree and click <em>OK</em></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">You should see the From Directory as <em>D:\workspace\zxing\core\src</em></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">Check the box to the left of the &#8220;src&#8221; folder</span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">&#8220;Into folder&#8221; should already be set to <strong><em>BarExample/srccore</em></strong></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">In Options, select <em>Create selected folders only</em></span></span></li>
<li style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">Click <em>Finish</em></span></span></li>
<p style="padding-left: 30px;"><span style="color: #808080;"><em><strong><span style="text-decoration: underline;"><span style="text-decoration: line-through;">Hard way #2:</span></span></strong></em></span></p>
<p style="padding-left: 30px;"><span style="color: #808080;"><span style="text-decoration: line-through;">A somewhat easier way to do this (avoiding the extra copy) is to put <em>/core/src</em> <span style="text-decoration: underline;">under</span><em> </em><em>/android</em> (thus creating <em>/android/core/src</em>) <strong>before </strong>you initialize the project!  Then, <strong>after </strong>you initialize the project you can pick the <em>src </em>folder under the <em>core </em>entry in the project items and select <em>Build Path -&gt; Use as a Source Folder</em> to have the desired effect (it&#8217;ll crete an entry called <em>core/src</em>).  I would expect a symlink, correctly applied, would also have the desired effect.  As you can see, the <em>android </em>folder itself is really superfluous here.  [I still think there's got to be an even easier way to gather this all together, without moving ANYTHING around.]</span></span></p>
<p><strong>The best way to add <em>/core/src </em>to your project!</strong> No symlinks required (and being Windows it&#8217;s possible but not easy and besides this is even more minimalist) and it should work seamlessly even if you&#8217;re doing thing with Subversion-controlled code.</p>
<p>You&#8217;ve already created a project area called zxing (or whatever) and in it are the /android tree and the /core/src tree. Rather than manually or automatically move ANY code, simply do this:</p>
<ul>
<li>In the <em>Package Exp </em>tab, right click on the project name  (&#8220;BarExample&#8221;) and select <em>Build Path -&gt; Link Source&#8230;</em></li>
<li>Browse to and select the <strong><em>src </em></strong>folder in <strong><em>core</em></strong>.</li>
<li>Change <em>Folder name</em> to <strong><em>srccore </em></strong>(or any other not-in-use folder name you prefer).</li>
<li>Select <em>Finish</em></li>
<li>Let it rebuild automagically</li>
</ul>
<p><strong>If you were successful, you should see a whole mess of warnings (I see over 170) &#8211; but no errors!</strong></p>
<p><span style="text-decoration: underline;"><strong>To install and test this on the Android Virtual Device:</strong></span></p>
<ul style="padding-left: 30px;">
<li>Go to the Android SDK and AVD Manager and start your test device
<ul>
<li>I previously created a Droid-compatible device configured as Platform 2.0.1 API Level 6, with a WVGA854 display and a 32M SD card.</li>
<li>Select the device and click<em> Start&#8230;</em></li>
<li>To avoid weirdness I elected to run with a clean slate and so I selected the &#8220;Wipe user data&#8221; option</li>
<li>The virtual device should start up.</li>
<li>You can (and probably should) close the AVD Manager at this point. Leaving the manager on led to an odd &#8220;GC overhead limit exceeded&#8221; error.</li>
<li>Wait patiently for the main screen to appear (it seems to take quite a while and a lot of CPU &#8211; is it just me?)</li>
<li>You shouldn&#8217;t have any other versions of this Barcode app installed at this point.  If you DO you should probably uninstall them first!</li>
</ul>
</li>
<li>Now, back to Eclipse!
<ul>
<li>In your project, select <em>Run As -&gt; Android Application</em></li>
<li>At this point I get an AVD error telling me &#8220;No compatible targets were found&#8221;.</li>
<li>I selected &#8220;No&#8221; (I don&#8217;t want to create a new target &#8211; I already have one!)</li>
<li>In the Device Chooser that follows I selected my running 2.0.1 emulator and clicked OK.</li>
<li>(I don&#8217;t know why this happens &#8211; it&#8217;s probably the mismatch between my 2.0.1. AVD and the original APIs 1.6 target.)</li>
</ul>
</li>
<li>The app should upload, install and execute on the virtual device.</li>
<li>Be sure to rotate your local gravitational reference clockwise by 90° for the  optimum viewing experience.  See the January, 2153 quantum multicast of <em>Make:  The Virtual Magazine </em>for info on how to construct a portable  graviton generator for this purpose.</li>
<li>It&#8217;s not terribly interesting at this point but should work and look normal (not wiping user data and/or letting it launch the app before the screen is &#8220;unlocked&#8221; had something to do with the display looking rather weird &#8211; I&#8217;m not sure what was going wrong).</li>
<li>(Really, why doesn&#8217;t the AVD have a rotate function?  It seems  pretty fundamental.  Likewise some way to fake camera input &#8211; do tell if  I&#8217;m missing a simple way to do either!)</li>
</ul>
<p><strong>Like I&#8217;ve mentioned, I got various odd little IDE errors as I made my way through all this&#8230; perhaps I&#8217;m doing something that&#8217;s not entirely right or the Eclipse IDE / Android SDK combination isn&#8217;t very stable.<br />
</strong></p>
<p>But <em>will it blend</em>?  That is, will it work on a physical device?  Heck yeah!</p>
<p><span style="text-decoration: underline;"><strong>To install and test this on an Android physical device:</strong></span></p>
<ul style="padding-left: 30px;">
<li>First, uninstall the current Barcode Scanner from your phone (you shouldn&#8217;t need to do it each time you cycle through your private test builds, but you DEFINITELY need to if you are switching between the officially signed to the unsigned or debug signed versions!  In short: if you get an installation error uninstall the app and try intalling it again!</li>
<li> <strong>Note:</strong> for some bizarre reason after installation the Barcode app may be out of order alphabetically in the Manage applications dialog!  Closing the dialog and going back to it via Settings rectifies this.</li>
<li>Copy the application&#8217;s APK from<em> /android/bin</em> to your phone</li>
<li>Install the application</li>
<li>Run the Barcode Scanner!</li>
</ul>
<p><strong>That&#8217;s about it!  I&#8217;d expect this to work just as well from a Linux host but I haven&#8217;t tested it.</strong></p>
<p><span style="text-decoration: underline;"><strong>Caveats:</strong></span></p>
<ul style="padding-left: 30px;">
<li><strong>Proguard </strong>isn&#8217;t being used in this configuration AFAIK.  Therefore, things aren&#8217;t optimized (I&#8217;m not yet clear on why that&#8217;s necessary &#8211; presumably for performance reasons though it seemed to work OK when I tried it).</li>
<li>AFAIK this is NOT how the ZXing project is normally developed, so if you plan to submit changes to it or otherwise assist with the project you should defer to the project&#8217;s <a href="http://code.google.com/p/zxing/wiki/GettingStarted" target="_blank">standards and procedures</a>.</li>
<li>This procedure worked fine for me but it may or may not work as well for you, and there may be unexpected side-effects (I haven&#8217;t seen any yet but you never know).</li>
</ul>
<p><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;linkname=Building%20ZXing%20for%20Android%20part%203%20%E2%80%93%20Using%20Eclipse" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;linkname=Building%20ZXing%20for%20Android%20part%203%20%E2%80%93%20Using%20Eclipse" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a><a class="a2a_button_tumblr" href="http://www.addtoany.com/add_to/tumblr?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;linkname=Building%20ZXing%20for%20Android%20part%203%20%E2%80%93%20Using%20Eclipse" title="Tumblr" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/tumblr.png" width="16" height="16" alt="Tumblr"/></a><a class="a2a_button_slashdot" href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;linkname=Building%20ZXing%20for%20Android%20part%203%20%E2%80%93%20Using%20Eclipse" title="Slashdot" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;count=horizontal&amp;text=Building%20ZXing%20for%20Android%20part%203%20%E2%80%93%20Using%20Eclipse" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;count=horizontal&amp;text=Building%20ZXing%20for%20Android%20part%203%20%E2%80%93%20Using%20Eclipse" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F12%2Fbuilding-zxing-for-android-part-3-using-eclipse&amp;title=Building%20ZXing%20for%20Android%20part%203%20%E2%80%93%20Using%20Eclipse" id="wpa2a_8"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/12/building-zxing-for-android-part-3-using-eclipse/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Building ZXing for Android part 2 &#8211; Subversion!</title>
		<link>http://www.falatic.com/index.php/11/building-zxing-for-android-part-2-subversion</link>
		<comments>http://www.falatic.com/index.php/11/building-zxing-for-android-part-2-subversion#comments</comments>
		<pubDate>Wed, 24 Feb 2010 10:15:23 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Barcode Scanner]]></category>
		<category><![CDATA[building]]></category>
		<category><![CDATA[Droid]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[success]]></category>
		<category><![CDATA[TortoiseSVN]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[ZXing]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=11</guid>
		<description><![CDATA[Well, that was fast!  I decided to give Subversion a whirl with the ZXing codebase before signing off for the night&#8230; and I apparently chose well when I selected TortoiseSVN as my Subversion client for Windows! It went very smoothly! &#8230; <a class="more-link" href="http://www.falatic.com/index.php/11/building-zxing-for-android-part-2-subversion">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, that was fast!  I decided to give Subversion a whirl with the <strong>ZXing</strong> codebase before signing off for the night&#8230; and I apparently chose well when I selected <a href="http://tortoisesvn.net/" target="_blank">TortoiseSVN</a> as my Subversion client for Windows!</p>
<p><strong>It went very smoothly! </strong>Here&#8217;s the details:</p>
<p><span id="more-11"></span></p>
<ul>
<li>Install the <a href="http://tortoisesvn.net/" target="_blank">TortoiseSVN</a> client (then reboot)</li>
</ul>
<ul>
<li>Create a folder to work in (e.g., &#8220;D:\zxing-test&#8221;)</li>
</ul>
<ul>
<li>Right-click in/on the folder and select &#8220;SVN Checkout&#8230;&#8221;<br />
- Edit the &#8220;Checkout Directory&#8221; accordingly<br />
- I used the info at the <a href="http://code.google.com/p/zxing/source/checkout" target="_blank">ZXing SVN page</a> to get the required URL (<em>http://zxing.googlecode.com/svn/trunk/</em>).  Note that the &#8220;<em>zxing-read-only</em>&#8221; part caused problems here (it&#8217;s not valid syntax for this client). You cannot commit changes without being a member of the group so leave it off when using TortoiseSVN.<br />
- I did a fully recursive code pull the first time.<br />
- I selected the HEAD revision of the version tree.</li>
</ul>
<ul>
<li>Time passes as you download quite a helluva lot of code!  Broadband helps&#8230;</li>
</ul>
<ul>
<li>For this experiment the last commit version turned out to be revision <strong>1217</strong>.  I&#8217;m not sure how they manage their changes but it&#8217;s always possible you could be unlucky and get a revision level that&#8217;ll lead to a broken build.  (Fortunately, tonight&#8217;s my lucky night!)  You can specify this when you start the SVN interaction above, or you can &#8220;revert&#8221; to this version (or any other) later if you prefer.</li>
</ul>
<ul>
<li>Prep and build it!<br />
- Edit <em>build.properties</em> as I described in <a href="http://www.falatic.com/index.php/9/building_zxing_for_android" target="_blank">my last post</a>.<br />
- Build the source tree (be sure to set <strong>MY_PROJ_ROOT</strong> correctly to point to the SVN-derived tree!)  Use the debug target as before (I&#8217;ve yet to try the release one though I suspect the lack of signing will cause problems).</li>
</ul>
<p><strong>And again, voilà!  You&#8217;ve got a new build!</strong> (I notice the first &#8220;clean&#8221; build step no longer throws a small error as it did before&#8230; it didn&#8217;t affect things but it was nice to see that it got fixed).</p>
<p>I loaded the build onto my Droid and installed it (there was no need to uninstall the older version 3.0 I was testing with earlier &#8211; I don&#8217;t bother with that unless it complains or otherwise fails to install).  On execution the about box shows this is version 3.2 beta 1 (versus the version 3.0 I built earlier and version 3.1 which was the most current in the Android App Market)!  If I&#8217;m going to fiddle around, it&#8217;s nice to know I&#8217;m fiddling with the latest and greatest! <img src='http://www.falatic.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>That concludes my coding evening.  Thanks for visiting!</p>
<p>Note: Other projects use Git&#8230; I installed <a href="http://code.google.com/p/tortoisegit/" target="_blank">TortoiseGit</a> as well but haven&#8217;t had a chance to play with it yet.</p>
<p><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;linkname=Building%20ZXing%20for%20Android%20part%202%20%26%238211%3B%20Subversion%21" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;linkname=Building%20ZXing%20for%20Android%20part%202%20%26%238211%3B%20Subversion%21" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a><a class="a2a_button_tumblr" href="http://www.addtoany.com/add_to/tumblr?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;linkname=Building%20ZXing%20for%20Android%20part%202%20%26%238211%3B%20Subversion%21" title="Tumblr" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/tumblr.png" width="16" height="16" alt="Tumblr"/></a><a class="a2a_button_slashdot" href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;linkname=Building%20ZXing%20for%20Android%20part%202%20%26%238211%3B%20Subversion%21" title="Slashdot" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;count=horizontal&amp;text=Building%20ZXing%20for%20Android%20part%202%20%26%238211%3B%20Subversion%21" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;count=horizontal&amp;text=Building%20ZXing%20for%20Android%20part%202%20%26%238211%3B%20Subversion%21" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F11%2Fbuilding-zxing-for-android-part-2-subversion&amp;title=Building%20ZXing%20for%20Android%20part%202%20%26%238211%3B%20Subversion%21" id="wpa2a_10"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/11/building-zxing-for-android-part-2-subversion/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building ZXing for Android &#8211; lessons learned</title>
		<link>http://www.falatic.com/index.php/9/building-zxing-for-android-part-1</link>
		<comments>http://www.falatic.com/index.php/9/building-zxing-for-android-part-1#comments</comments>
		<pubDate>Wed, 24 Feb 2010 08:24:29 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Barcode Scanner]]></category>
		<category><![CDATA[building]]></category>
		<category><![CDATA[Droid]]></category>
		<category><![CDATA[success]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[ZXing]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=9</guid>
		<description><![CDATA[Updated based on feedback from the ZXing team. Tonight I decided to try my hand again at building an Android app &#8211; this time, one that should in theory be easy and yet feature-rich enough to learn from.  It was &#8230; <a class="more-link" href="http://www.falatic.com/index.php/9/building-zxing-for-android-part-1">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em><strong>Updated based on feedback from the ZXing team.</strong></em></p>
<p>Tonight I decided to try my hand again at building an Android app &#8211; this time, one that should in theory be easy and yet feature-rich enough to learn from.  It was far from the simple experiment it ought to have been, so I&#8217;m sharing my experience to hopefully save you the reader some time if you try this yourself!</p>
<p><strong><a title="ZXing code page" href="http://code.google.com/p/zxing/" target="_blank">ZXing</a> </strong>is the heart of the <strong>Barcode Scanner</strong> app for Android.  It&#8217;s nifty though it doesn&#8217;t take full advantage of my Droid&#8217;s camera resolution and there are some other tricks I&#8217;d like to see it do (such as activate the flash for improved lighting, replacing the constant autofocus with a forced focus, and perhaps adding some decoding protocols that aren&#8217;t supported in the Droid build of this, at least as of Barcode Scanner v3.1).  My main goal was to simply rebuild the app for the Android target via a Windows host, then play around with the code to learn more about Android coding.</p>
<p><strong><a title="ZXing code page" href="http://code.google.com/p/zxing/" target="_blank"><span id="more-9"></span></a></strong></p>
<p>I&#8217;d recently moved some install folders around so I decided to install the necessary parts from scratch.  Note that I first spent an hour or two trying to use Eclipse 3.5.1 to build this but haven&#8217;t gotten it to work (yet).  When I decided to try doing this via &#8220;basic principles&#8221; it quickly became apparent that this would take a while.</p>
<p>I ran into several issues I won&#8217;t bore you with here.  Suffice to say the answers are scattered around Google, either in the ZXing comments, discussions, or its bugs area, and sometimes completely elsewhere.  It became clear that while Windows is supported as a host it&#8217;s probably not the primary host they test builds from, so their <a href="http://code.google.com/p/zxing/wiki/GettingStarted" target="_blank">instructions</a> <em><span style="text-decoration: line-through;">aren&#8217;t very current or coherent for it</span></em> needed some tweaks, which they&#8217;ve made.  (Windows isn&#8217;t the most common way to build for Android but it&#8217;s quite do-able just the same.)</p>
<p><strong>Here, then, is the distillation of what I learned in order to successfully build the Barcode Scanner app for Android via Windows.</strong> This should apply to other Windows versions as well, at least back to XP.  If you are using an x86-based Windows then use x86 installers instead of x64 installers (where there&#8217;s a difference).</p>
<pre><strong># This is the setup for a Windows 7 host (64-bit on an Intel CPU)
</strong>
<strong># Install Sun JDK (jdk-6u18-windows-x##):</strong>
 - Source: <a href="http://java.sun.com/javase/downloads/index.jsp" target="_blank">http://java.sun.com/javase/downloads/index.jsp</a>
    - Select the JDK appropriate to your Windows host (x64 or x86)
 - My root folder: "C:\Program Files\Java\jdk1.6.0_18"

<span style="text-decoration: line-through;"><strong># Install Sun WTK 2.5.2 (sun_java_wireless_toolkit-2.5.2_01-win.exe)</strong>:
 - Yes, you need this too!
 - Source: <a href="http://java.sun.com/products/sjwtoolkit/" target="_blank">http://java.sun.com/products/sjwtoolkit/</a>
    - Select Sun Java Wireless Toolkit 2.5.2_01 for CLDC
 - My root folder: "C:\WTK2.5.2_01"</span>

<strong># WTK is NOT required for the Android target, but part of its folder structure IS, as follows.</strong>

<strong># Install ProGuard Java Optimizer (proguard4.4.zip):</strong>
 - Source: <a href="http://sourceforge.net/projects/proguard/" target="_blank">http://sourceforge.net/projects/proguard/</a>
 - My root folder: "D:\Programming\proguard4.4"

<strong># Copy the proguard.jar file to the expected location in WTK</strong>:
 copy D:\Programming\proguard4.4\lib\proguard.jar C:\WTK2.5.2_01\bin
 - If the "C:\WTK2.5.2_01\bin" tree doesn't exist, simply create it and populate it as above
    (again, WTK itself is not required for the Android target)

<strong># Install Apache Ant (apache-ant-1.8.0-bin):</strong>
 - Source: <a href="http://ant.apache.org/bindownload.cgi" target="_blank">http://ant.apache.org/bindownload.cgi</a>
 - My root folder: "D:\Programming\apache-ant-1.8.0"

<strong># Install Google Android SDK (android-sdk_r04-windows)</strong>:
 - Source: <a href="http://developer.android.com/sdk/index.html" target="_blank">http://developer.android.com/sdk/index.html</a>
 - My root folder: "D:\Programming\android-sdk-windows"

<strong># Run "android-sdk-windows/SDK Setup":</strong>
 - Update all packages!

<strong># Fix "dx.bat" for Android SDK pre-2.0 (it's broken in those)</strong>:
 - More info in <a href="http://groups.google.com/group/zxing/browse_thread/thread/ca00c576c14dae04/cd52c5b64a" target="_blank">this thread</a>
 cd /d D:\Programming\android-sdk-windows
 copy /y platforms\android-1.1\tools\dx.bat platforms\android-1.1\tools\dx.bat.ORIG
 copy /y platforms\android-2.0\tools\dx.bat platforms\android-1.1\tools
 copy /y platforms\android-1.5\tools\dx.bat platforms\android-1.5\tools\dx.bat.ORIG
 copy /y platforms\android-2.0\tools\dx.bat platforms\android-1.5\tools
 copy /y platforms\android-1.6\tools\dx.bat platforms\android-1.6\tools\dx.bat.ORIG
 copy /y platforms\android-2.0\tools\dx.bat platforms\android-1.6\tools

<strong># Install the ZXing codebase (ZXing-1.4.zip):</strong>
 - Source: <a href="http://code.google.com/p/zxing/downloads/list" target="_blank">http://code.google.com/p/zxing/downloads/list</a>
 - My root folder: "D:\Test\zxing-1.4"

<strong># Edit "zxing-1.4\build.properties":</strong>
 - Note double-backslashes!
 - Update: WTK-home=C:\\WTK2.5.2_01
 - Update: android-home=T:\\Programming\\android-sdk-windows
</pre>
<p><strong>Now, if all that went well you should be ready to build it!</strong></p>
<pre><strong># Open a "cmd.exe" window to work in.</strong>

<strong># Set appropriate environment variables for the tools:</strong>
 set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_18
 set path=%PATH%;D:\Programming\android-sdk-windows\tools
 set path=%PATH%;D:\Programming\apache-ant-1.8.0\bin
 set path=%PATH%;%JAVA_HOME%\bin

<strong># Set the environment variable for the root of your project:</strong>
 set MY_PROJ_ROOT=D:\Programming\workspace\zxing-1.4

<strong># Running the build (repeat as necessary):</strong>
 REM I added this top-level clean step to my process -
 REM It helps when you have tried building from the wrong level!
 cd /d %MY_PROJ_ROOT%  &amp;&amp;  ant clean

 REM Standard build step (see note in android/build.xml)
 cd /d %MY_PROJ_ROOT%\core  &amp;&amp;  ant clean build-no-debug

 REM Debug is the default target - I prefer to name it explicitly
 cd /d %MY_PROJ_ROOT%\android  &amp;&amp;  ant clean debug

 REM OPTIONAL: You can instead build the release version but it's not signed
 cd /d %MY_PROJ_ROOT%\android  &amp;&amp;  ant clean release

<strong># Inspect and use the build output (the APK file is produced if successful)</strong>:
 - %MY_PROJ_ROOT%\android\bin
</pre>
<p><strong>At this point you should have successfully built the Barcode Scanner app for Android!</strong></p>
<p>Load it upon your emulator or phone and see how it works. To try it on your phone, you will probably need to uninstall the current version.  Then you will need to check the <em>&#8220;Settings -&gt; Applications -&gt; Unknown Sources&#8221;</em> box on your phone to install a debug binary like this (As always, be careful when testing in this mode!!)  Copy the APK to your phone and install it.  Voilà!  It worked for me.</p>
<p><strong>Next steps:</strong></p>
<ul>
<li>Seeing if I can do this from within Eclipse.  A <a href="http://knol.google.com/k/alec-go/modifying-the-android-barcode-scanner/2vd5zn6va2fqd/2#" target="_blank">somewhat outdated Knol</a> suggests this is possible, but I had no luck with it. <a href="http://www.falatic.com/index.php/12/building-zxing-for-android-part-3-using-eclipse" target="_blank"><strong><em>Done!</em></strong></a></li>
<li>Install a Subversion client to get the latest code and see how that goes (my expertise is with Clearcase and such so this should be interesting). <strong><a title="Subversion and ZXing on Windows" href="http://www.falatic.com/index.php/11/building-zxing-for-android-part-2-subversion" target="_blank"><em>Done!</em></a></strong></li>
<li>Modifying some code! <strong><a title="Subversion and ZXing on Windows" href="http://www.falatic.com/index.php/11/building-zxing-for-android-part-2-subversion" target="_blank"><em>Done!</em></a></strong></li>
</ul>
<p><strong><span style="text-decoration: underline;">Disclaimer:</span> I&#8217;m NOT attached to the ZXing project at all, I&#8217;m just putting this out there in the hopes that it&#8217;ll help others have an easier time at this than I did.  I probably cannot help you with any issues you have (especially for other host or target platforms).<br />
</strong></p>
<p><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;linkname=Building%20ZXing%20for%20Android%20%26%238211%3B%20lessons%20learned" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;linkname=Building%20ZXing%20for%20Android%20%26%238211%3B%20lessons%20learned" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a><a class="a2a_button_tumblr" href="http://www.addtoany.com/add_to/tumblr?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;linkname=Building%20ZXing%20for%20Android%20%26%238211%3B%20lessons%20learned" title="Tumblr" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/tumblr.png" width="16" height="16" alt="Tumblr"/></a><a class="a2a_button_slashdot" href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;linkname=Building%20ZXing%20for%20Android%20%26%238211%3B%20lessons%20learned" title="Slashdot" rel="nofollow" target="_blank"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;size=medium&amp;count=true" scrolling="no" style="border:none;overflow:hidden;width:90px;height:20px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service facebook_like" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany" scrolling="no" style="border:none;overflow:hidden;width:90px;height:21px"></iframe><!--<![endif]--><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;count=horizontal&amp;text=Building%20ZXing%20for%20Android%20%26%238211%3B%20lessons%20learned" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service twitter_tweet" src="http://platform.twitter.com/widgets/tweet_button.html?url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;counturl=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;count=horizontal&amp;text=Building%20ZXing%20for%20Android%20%26%238211%3B%20lessons%20learned" scrolling="no" style="border:none;overflow:hidden;width:130px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F9%2Fbuilding-zxing-for-android-part-1&amp;title=Building%20ZXing%20for%20Android%20%26%238211%3B%20lessons%20learned" id="wpa2a_12"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/9/building-zxing-for-android-part-1/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

