Confirmed users
355
edits
Nalexander (talk | contribs) No edit summary |
Nalexander (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
Native Sync | |||
== Setup == | == Setup == | ||
<p><a href="Mobile/Fennec/Android OtherBuildEnvs#Mac_OSX"> Setting up an Android dev environment</a> | <p><a href="Mobile/Fennec/Android OtherBuildEnvs#Mac_OSX"> Setting up an Android dev environment</a> | ||
| Line 7: | Line 7: | ||
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/android | <pre class="_fck_mw_lspace">$ANDROID_HOME/tools/android | ||
</pre> | </pre> | ||
=== Emulators === | |||
<ul><li> to create: | <ul><li> to create: | ||
</li></ul> | </li></ul> | ||
| Line 48: | Line 48: | ||
<pre class="_fck_mw_lspace">git clone git@github.com:mozilla-services/android-sync.git | <pre class="_fck_mw_lspace">git clone git@github.com:mozilla-services/android-sync.git | ||
</pre> | </pre> | ||
=== android-sync dependencies === | |||
<p>android-sync has the following dependencies: | <p>android-sync has the following dependencies: | ||
</p> | </p> | ||
| Line 69: | Line 69: | ||
</li></ul> | </li></ul> | ||
</li></ul> | </li></ul> | ||
=== sync-crypto dependencies === | |||
<p>sync-crypto relies on Apache commons-codec 1.5, which includes Base32. The Android system libraries include the 8-year-old version 1.2. As a result, sync-crypto is packaged as an assembly jar (aka über jar). | <p>sync-crypto relies on Apache commons-codec 1.5, which includes Base32. The Android system libraries include the 8-year-old version 1.2. As a result, sync-crypto is packaged as an assembly jar (aka über jar). | ||
</p> | </p> | ||
=== What you need to do === | |||
<pre class="_fck_mw_lspace">git clone https://github.com/rnewman/base64-unstub | <pre class="_fck_mw_lspace">git clone https://github.com/rnewman/base64-unstub | ||
git clone https://github.com/rnewman/log-unstub | git clone https://github.com/rnewman/log-unstub | ||
| Line 89: | Line 89: | ||
</p><p>Note that both android-sync and sync-crypto have JUnit 4 tests that run in both Eclipse and Maven. The subdirectory android-sync/test includes Android JUnit 3 tests for activity and store testing. This is to avoid the mammoth annoyance of testing in a VM without introducing robolectric. | </p><p>Note that both android-sync and sync-crypto have JUnit 4 tests that run in both Eclipse and Maven. The subdirectory android-sync/test includes Android JUnit 3 tests for activity and store testing. This is to avoid the mammoth annoyance of testing in a VM without introducing robolectric. | ||
</p> | </p> | ||
=== Running Fennec === | |||
<p>The directions at <a href="Fennec/NativeUI"> Building Native Fennec</a> should be correct, specifically <a href="Fennec/NativeUI#How_To_Build"> How To Build</a>. | <p>The directions at <a href="Fennec/NativeUI"> Building Native Fennec</a> should be correct, specifically <a href="Fennec/NativeUI#How_To_Build"> How To Build</a>. | ||
</p><p>After building Fennec, make the apk. | </p><p>After building Fennec, make the apk. | ||
| Line 97: | Line 97: | ||
<p>The apk will be something like <tt>objdir-droid/dist/fennec-12.0a1.en-US.android-arm.apk</tt>. | <p>The apk will be something like <tt>objdir-droid/dist/fennec-12.0a1.en-US.android-arm.apk</tt>. | ||
</p> | </p> | ||
==== Running Fennec on an Android device ==== | |||
<ul><li> Ensure USB debugging is enabled on your Android device: fom the home screen, select <tt>Settings > Applications > Development > USB debugging</tt>. | <ul><li> Ensure USB debugging is enabled on your Android device: fom the home screen, select <tt>Settings > Applications > Development > USB debugging</tt>. | ||
</li><li> Ensure your Android device is connected to your computer's USB port. | </li><li> Ensure your Android device is connected to your computer's USB port. | ||
| Line 104: | Line 104: | ||
<pre class="_fck_mw_lspace">$ANDROID_HOME/platform-tools/adb install -r objdir-droid/dist/fennec*apk | <pre class="_fck_mw_lspace">$ANDROID_HOME/platform-tools/adb install -r objdir-droid/dist/fennec*apk | ||
</pre> | </pre> | ||
==== Running Fennec on an emulator ==== | |||
<ul><li> Ensure the emulator is running. | <ul><li> Ensure the emulator is running. | ||
</li><li> Run | </li><li> Run | ||
| Line 112: | Line 112: | ||
<p><span class="fck_mw_template">{{note|You may need to run <tt>adb kill-server; adb start-server</tt> if adb doesn't recognize the emulator.}}</span> | <p><span class="fck_mw_template">{{note|You may need to run <tt>adb kill-server; adb start-server</tt> if adb doesn't recognize the emulator.}}</span> | ||
</p> | </p> | ||
==== Accessing Fennec/Android Sync debug statements ==== | |||
<pre class="_fck_mw_lspace">$ANDROID_HOME/platform-tools/adb logcat | <pre class="_fck_mw_lspace">$ANDROID_HOME/platform-tools/adb logcat | ||
</pre> | </pre> | ||
=== Setting up Eclipse === | |||
<p>If you want to use Eclipse: | <p>If you want to use Eclipse: | ||
</p> | </p> | ||
| Line 134: | Line 134: | ||
<p><span class="fck_mw_template">{{note|You may need to set <tt>M2_REPO</tt>; (for example, as described at [http://www.mkyong.com/maven/how-to-configure-m2_repo-variable-in-eclipse-ide/]) to something like <tt>$HOME/.m2/repository</tt>.}}</span> | <p><span class="fck_mw_template">{{note|You may need to set <tt>M2_REPO</tt>; (for example, as described at [http://www.mkyong.com/maven/how-to-configure-m2_repo-variable-in-eclipse-ide/]) to something like <tt>$HOME/.m2/repository</tt>.}}</span> | ||
</p> | </p> | ||
==== To run the unit test suite under Eclipse ==== | |||
<ul><li> First configure the test suite launcher, under <tt>Preferences > Run/Debug > Launching > Default Launchers</tt>. Set the Debug and Run launchers to <tt>Android JUnit Test Launcher</tt>. | <ul><li> First configure the test suite launcher, under <tt>Preferences > Run/Debug > Launching > Default Launchers</tt>. Set the Debug and Run launchers to <tt>Android JUnit Test Launcher</tt>. | ||
</li><li> Select the <tt>android-sync</tt> project and execute <tt>Run > Run As ... > JUnit Test</tt>. | </li><li> Select the <tt>android-sync</tt> project and execute <tt>Run > Run As ... > JUnit Test</tt>. | ||
</li></ul> | </li></ul> | ||
==== To run the integration test suite under Eclipse ==== | |||
<ul><li> Add the <tt>test</tt> subdirectory as a sub-project using <tt>File > Import > Existing project</tt>. | <ul><li> Add the <tt>test</tt> subdirectory as a sub-project using <tt>File > Import > Existing project</tt>. | ||
</li></ul> | </li></ul> | ||
| Line 150: | Line 150: | ||
</p><p>We don't quite follow the <a _fcknotitle="true" href="Fennec/NativeUI/CodingStyle">Fennec/NativeUI/CodingStyle</a>. See also <a href="http://source.android.com/source/code-style.html">the Android coding style</a>. | </p><p>We don't quite follow the <a _fcknotitle="true" href="Fennec/NativeUI/CodingStyle">Fennec/NativeUI/CodingStyle</a>. See also <a href="http://source.android.com/source/code-style.html">the Android coding style</a>. | ||
</p> | </p> | ||
=== Running unit test code coverage === | |||
<p>To see the current unit test code coverage (using the Maven plugin integrating Cobertura), from the <tt>android-sync</tt> directory run | <p>To see the current unit test code coverage (using the Maven plugin integrating Cobertura), from the <tt>android-sync</tt> directory run | ||
</p> | </p> | ||
| Line 223: | Line 223: | ||
</p> | </p> | ||
== Troubleshooting == | == Troubleshooting == | ||
=== "R cannot be resolved" === | |||
<p>Something is wrong with xml resolution. Check your Eclipse console errors in xml files, which will prevent Eclipse from building resource (R) files - resolve them first. | <p>Something is wrong with xml resolution. Check your Eclipse console errors in xml files, which will prevent Eclipse from building resource (R) files - resolve them first. | ||
</p><p>Things to try: | </p><p>Things to try: | ||
| Line 230: | Line 230: | ||
</li><li>Project > Clean, then rebuild the project. Alternatively, you can delete the gen/ directory, and Eclipse will rebuild automatically (Project > Build Automatically checked) | </li><li>Project > Clean, then rebuild the project. Alternatively, you can delete the gen/ directory, and Eclipse will rebuild automatically (Project > Build Automatically checked) | ||
</li></ul> | </li></ul> | ||
=== Loading apk: "Insufficient space" error on emulator === | |||
<p>Start an emulator with "-partition-size 2047" as a flag, to set emulator size. | <p>Start an emulator with "-partition-size 2047" as a flag, to set emulator size. | ||
</p> | </p> | ||