{"id":957,"date":"2011-08-07T20:20:17","date_gmt":"2011-08-07T18:20:17","guid":{"rendered":"http:\/\/hex.ro\/wp\/?p=957"},"modified":"2011-09-12T07:54:23","modified_gmt":"2011-09-12T05:54:23","slug":"preparing-to-build-gingerbread-android-on-ubuntu","status":"publish","type":"post","link":"https:\/\/hex.ro\/wp\/blog\/preparing-to-build-gingerbread-android-on-ubuntu\/","title":{"rendered":"Preparing to build Gingerbread \/ Android on Ubuntu."},"content":{"rendered":"<p>This is a quick tip on how to setup Ubuntu to build Android from scrap.<\/p>\n<p>Android \/ Gingerbread build process itself is pretty straightforward if you follow the standard documentation: <a href=\"http:\/\/source.android.com\/source\/building.html\">http:\/\/source.android.com\/source\/building.html<\/a>.<\/p>\n<p>What will stop you is that Ubuntu has, in my opinion, two things that annoy every java developer:<br \/>\na) openjdk \/ fastjar<br \/>\nb) pulseaudio! Neah, this just annoys everybody :))<\/p>\n<p>This crippled Java kills Gingerbread build process with errors like:<\/p>\n<pre class=\"lang: bash\">out\/target\/common\/obj\/APPS\/Camera_intermediates\/src\/com\/android\/camera\/R.java:10:\r\ncannot access java.lang.Object\r\nbad class file: java\/lang\/Object.class(java\/lang:Object.class)\r\nunable to access file: corrupted zip file\r\nPlease remove or make sure it appears in the correct subdirectory of the\r\nclasspath.\r\npublic final class R {\r\n^\r\n<\/pre>\n<p>For all the details and the solution here&#8217;s how to fix: <a href=\"https:\/\/groups.google.com\/group\/pandaboard\/browse_thread\/thread\/2ad9f0ae099e7db1?fwc=1&#038;pli=1\">https:\/\/groups.google.com\/group\/pandaboard\/browse_thread\/thread\/2ad9f0ae099e7db1?fwc=1&#038;pli=1<\/a><\/p>\n<p>Correcting the fastjar mess :<\/p>\n<pre class=\"lang: bash\">sudo update-alternatives --config jar<\/pre>\n<p>and selecting the proper Sun \/ Oracle JDK fastjar alternative.<\/p>\n<p>It now builds correctly in just under one hour! (E8500 \/ 2Gb DDRAM 800Mhz \/ RAID-0).<\/p>\n<pre class=\"lang: bash\">\r\n# time make -j8\r\n...\r\nreal 59m26.427s\r\nuser 69m54.414s\r\nsys 9m24.187s\r\n<\/pre>\n<p>So, to get rid of OpenJDK\/fastjar, issue the following commands:<\/p>\n<pre class=\"lang: bash\">apt-get remove icedtea-6-jre-cacao icedtea6-plugin openjdk-6-dbg openjdk-6-demo openjdk-6-doc openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib openjdk-6-source openjdk-6-jre-zero cacao-source default-jdk default-jdk-doc default-jre default-jre-headless\r\n<\/pre>\n<p>as well as:<\/p>\n<pre class=\"lang: bash\">apt-get remove fastjar<\/pre>\n<p>It will actually remove much more (as there are many dependencies not used), but this does not affect the build process of Gingerbread as long as you have Sun&#8217;s JDK installed.<\/p>\n<p><span style=\"color: #ff0000;\">Make sure you check the output and you don&#8217;t delete something you need.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a quick tip on how to setup Ubuntu to build Android from scrap. Android \/ Gingerbread build process itself is pretty straightforward if you follow the standard documentation: http:\/\/source.android.com\/source\/building.html. What will stop you is that Ubuntu has, in my opinion, two things that annoy every java developer: a) openjdk \/ fastjar b) pulseaudio! [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,24],"tags":[],"class_list":["post-957","post","type-post","status-publish","format-standard","hentry","category-android","category-it"],"_links":{"self":[{"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/posts\/957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/comments?post=957"}],"version-history":[{"count":11,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/posts\/957\/revisions"}],"predecessor-version":[{"id":1077,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/posts\/957\/revisions\/1077"}],"wp:attachment":[{"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/media?parent=957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/categories?post=957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hex.ro\/wp\/wp-json\/wp\/v2\/tags?post=957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}