CloudServices/NativeSync: Difference between revisions

Revert catastrophic "re-format as HTML" changes.
No edit summary
(Revert catastrophic "re-format as HTML" changes.)
Line 1: Line 1:
Native Sync
= Native Sync =
 
== Setup ==
== Setup ==
<p><a href="Mobile/Fennec/Android OtherBuildEnvs#Mac_OSX"> Setting up an Android dev environment</a>
[[Mobile/Fennec/Android_OtherBuildEnvs#Mac_OSX | Setting up an Android dev environment]]
</p>
* note: installing *all* the platform tools (all Android from 1 to 3.3) takes a while, if you only need a specific SDK version, just install from the GUI tool:
<ul><li> note: installing *all* the platform tools (all Android from 1 to 3.3) takes a while, if you only need a specific SDK version, just install from the GUI tool:
$ANDROID_HOME/tools/android
</li></ul>
 
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/android
</pre>
=== Emulators ===
=== Emulators ===
<ul><li> to create:
 
</li></ul>
* to create:
<p>Use the command line <tt>$ANDROID_HOME/tools/android</tt>, or use the graphical Android AVD Manager (from within Eclipse: <tt>Window &gt; AVD Manager</tt>).
 
</p>
Use the command line <tt>$ANDROID_HOME/tools/android</tt>, or use the graphical Android AVD Manager (from within Eclipse: <tt>Window > AVD Manager</tt>).
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/android create avd -t android-10 -n NAME -c 2047M
 
</pre>
$ANDROID_HOME/tools/android create avd -t android-10 -n NAME -c 2047M
<p>produces the output
 
</p>
produces the output
<pre class="_fck_mw_lspace">Auto-selecting single ABI armeabi
Android 2.3.3 is a basic Android platform.
Auto-selecting single ABI armeabi
Do you wish to create a custom hardware profile [no]
Android 2.3.3 is a basic Android platform.
Created AVD 'NAME' based on Android 2.3.3, ARM (armeabi) processor,
Do you wish to create a custom hardware profile [no]
with the following hardware config:
Created AVD 'NAME' based on Android 2.3.3, ARM (armeabi) processor,
hw.lcd.density=240
with the following hardware config:
vm.heapSize=24
hw.lcd.density=240
hw.ramSize=256
vm.heapSize=24
</pre>
hw.ramSize=256
<p><span class="fck_mw_template">{{note|Target (in the example above, <tt>android-10</tt>;) probably needs to match build specified in .mozconfig (see Building Fennec Native below).}}</span>
 
</p>
{{note|Target (in the example above, <tt>android-10</tt>) probably needs to match build specified in .mozconfig (see Building Fennec Native below).}}
<ul><li> to launch:
 
</li></ul>
* to launch:
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/emulator -wipe-data -avd NAME -partition-size 2047
 
</pre>
$ANDROID_HOME/tools/emulator -wipe-data -avd NAME -partition-size 2047
<p><span class="fck_mw_template">{{note|The partition size is set large so that you don't run into an insufficient storage error.}}</span>
 
</p>
{{note|The partition size is set large so that you don't run into an insufficient storage error.}}
<ul><li> to delete:
 
</li></ul>
* to delete:
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/android delete avd -n NAME
 
</pre>
$ANDROID_HOME/tools/android delete avd -n NAME
<p>After installation, fennec would crash on installation (unable to locate mozutils library, although it's in the apk). Possibly related to emulator failing to run NDK applications?
 
</p>
After installation, fennec would crash on installation (unable to locate mozutils library, although it's in the apk). Possibly related to emulator failing to run NDK applications?
 
== Running everything ==
== Running everything ==
<p>The main <tt>android-sync</tt> source repository is hosted on github:
 
</p>
The main <tt>android-sync</tt> source repository is hosted on github:
<pre class="_fck_mw_lspace">https://github.com/mozilla-services/android-sync
 
</pre>
https://github.com/mozilla-services/android-sync
<p>Try
 
</p>
Try
<pre class="_fck_mw_lspace">git clone git@github.com:mozilla-services/android-sync.git
 
</pre>
git clone git@github.com:mozilla-services/android-sync.git
 
=== android-sync dependencies ===
=== android-sync dependencies ===
<p>android-sync has the following dependencies:
 
</p>
android-sync has the following dependencies:
<ul><li> sync-crypto, described below.
 
</li><li> httpclientandroidlib, which provides a working modern version of the Apache HTTPClient under a different Java package.
* sync-crypto, described below.
</li><li> json-simple 1.1 and commons-codec 1.2, which ship with Android.
* httpclientandroidlib, which provides a working modern version of the Apache HTTPClient under a different Java package.
</li><li> Android 2.3.3.
* json-simple 1.1 and commons-codec 1.2, which ship with Android.
</li></ul>
* Android 2.3.3.
<p>For testing it requires:
 
</p>
For testing it requires:
<ul><li> JUnit 4.1.
* JUnit 4.1.
</li><li> org.simpleframework.simple, for HTTP testing.
* org.simpleframework.simple, for HTTP testing.
</li><li> Tiny “un-stub” packages for android.util.Log, android.util.Base64, and android.content.SharedPreferences.
* Tiny “un-stub” packages for android.util.Log, android.util.Base64, and android.content.SharedPreferences.
</li></ul>
 
<p>These live on github, and must be built and installed.
These live on github, and must be built and installed.
</p>
 
<ul><li><ul><li> https://github.com/rnewman/base64-unstub
** https://github.com/rnewman/base64-unstub
</li><li> https://github.com/rnewman/log-unstub
** https://github.com/rnewman/log-unstub
</li><li> https://github.com/rnewman/sharedpreferences-stub
** https://github.com/rnewman/sharedpreferences-stub
</li></ul>
 
</li></ul>
=== sync-crypto dependencies ===
=== 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).
 
=== What you need to do ===
=== What you need to do ===
<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/base64-unstub
git clone https://github.com/rnewman/sharedpreferences-stub
git clone https://github.com/rnewman/log-unstub
git clone https://github.com/mozilla-services/android-sync
git clone https://github.com/rnewman/sharedpreferences-stub
pushd base64-unstub;          mvn install; popd
git clone https://github.com/mozilla-services/android-sync
pushd log-unstub;            mvn install; popd
pushd base64-unstub;          mvn install; popd
pushd sharedpreferences-stub; mvn install; popd
pushd log-unstub;            mvn install; popd
pushd android-sync
pushd sharedpreferences-stub; mvn install; popd
git checkout develop
pushd android-sync
./preprocess.sh
git checkout develop
mvn test
./preprocess.sh
</pre>
mvn test
<p><span class="fck_mw_template">{{note|<tt>mvn assembly:assembly</tt> may fail, however, it is still ok to proceed.}}</span>
 
</p><p>To do real Android development and testing, you need to import android-sync as a project in Eclipse with the ADT installed.
{{note|<tt>mvn assembly:assembly</tt> may fail, however, it is still ok to proceed.}}
</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>
To do real Android development and testing, you need to import android-sync as a project in Eclipse with the ADT installed.
 
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.
 
=== Running Fennec ===
=== 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>.
The directions at [[Fennec/NativeUI | Building Native Fennec]] should be correct, specifically [[Fennec/NativeUI#How_To_Build | How To Build]].
</p><p>After building Fennec, make the apk.
 
</p>
After building Fennec, make the apk.
<pre class="_fck_mw_lspace">make -sj8 -C objdir-droid/ package
make -sj8 -C objdir-droid/ package
</pre>
 
<p>The apk will be something like <tt>objdir-droid/dist/fennec-12.0a1.en-US.android-arm.apk</tt>.
The apk will be something like <tt>objdir-droid/dist/fennec-12.0a1.en-US.android-arm.apk</tt>.
</p>
 
==== Running Fennec on an Android device ====
==== Running Fennec on an Android device ====
<ul><li> Ensure USB debugging is enabled on your Android device: fom the home screen, select <tt>Settings &gt; Applications &gt; Development &gt; USB debugging</tt>.
* 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.
* Ensure your Android device is connected to your computer's USB port.
</li><li> Run
* Run
</li></ul>
$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>
==== Running Fennec on an emulator ====
==== Running Fennec on an emulator ====
<ul><li> Ensure the emulator is running.
* Ensure the emulator is running.
</li><li> Run
* Run
</li></ul>
$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>
{{note|You may need to run <tt>adb kill-server; adb start-server</tt> if adb doesn't recognize the emulator.}}
<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>
==== Accessing Fennec/Android Sync debug statements ====
==== Accessing Fennec/Android Sync debug statements ====
<pre class="_fck_mw_lspace">$ANDROID_HOME/platform-tools/adb logcat
$ANDROID_HOME/platform-tools/adb logcat
</pre>
 
=== Setting up Eclipse ===
=== Setting up Eclipse ===
<p>If you want to use Eclipse:
If you want to use Eclipse:
</p>
 
<ul><li> Install Eclipse and the SDK plugin, as described in the Android SDK page.
* Install Eclipse and the SDK plugin, as described in the Android SDK page.
</li><li> Correct formatting: <tt>Preferences &gt; Java &gt; Code style &gt; Formatter &gt; Edit...</tt>, set profile name to <tt>Mozilla</tt>, set <tt>Tab policy</tt> to <tt>Spaces only</tt> change both <tt>Indentation size</tt> and <tt>Tab size</tt> to 2, and check <tt>Align fields in columns</tt>.
* Correct formatting: <tt>Preferences > Java > Code style > Formatter > Edit...</tt>, set profile name to <tt>Mozilla</tt>, set <tt>Tab policy</tt> to <tt>Spaces only</tt> change both <tt>Indentation size</tt> and <tt>Tab size</tt> to 2, and check <tt>Align fields in columns</tt>.
</li><li> Run these commands in your <tt>android-sync</tt> git repository directory (don't forget to checkout the <tt>develop</tt> branch):
* Run these commands in your <tt>android-sync</tt> git repository directory (don't forget to checkout the <tt>develop</tt> branch):
</li></ul>
 
<pre class="_fck_mw_lspace">mvn -Declipse.workspace=&lt;path-to-eclipse-workspace&gt; eclipse:add-maven-repo
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
mvn -DdownloadJavadocs=true -DdownloadSources=true eclipse:eclipse
mvn -DdownloadJavadocs=true -DdownloadSources=true eclipse:eclipse
</pre>
 
<ul><li> Install the project and classpath files (again in your git repository directory), making sure to update the paths where necessary in both files:
* Install the project and classpath files (again in your git repository directory), making sure to update the paths where necessary in both files:
</li></ul>
 
<pre class="_fck_mw_lspace">cp example.project .project
cp example.project .project
cp example.classpath .classpath
cp example.classpath .classpath
</pre>
 
<ul><li> Open Eclipse, choose <tt>File &gt; Import... &gt; General &gt; Existing Projects into Workspace</tt>, and specify your git repository directory.
* Open Eclipse, choose <tt>File > Import... > General > Existing Projects into Workspace</tt>, and specify your git repository directory.
</li></ul>
 
<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>
{{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>.}}
</p>
 
==== To run the unit test suite under Eclipse ====
==== To run the unit test suite under Eclipse ====
<ul><li> First configure the test suite launcher, under <tt>Preferences &gt; Run/Debug &gt; Launching &gt; 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 &gt; Run As ... &gt; JUnit Test</tt>.
* 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></ul>
* Select the <tt>android-sync</tt> project and execute <tt>Run > Run As ... > JUnit Test</tt>.
 
==== To run the integration test suite under Eclipse ====
==== To run the integration test suite under Eclipse ====
<ul><li> Add the <tt>test</tt> subdirectory as a sub-project using <tt>File &gt; Import &gt; Existing project</tt>.
 
</li></ul>
* Add the <tt>test</tt> subdirectory as a sub-project using <tt>File > Import > Existing project</tt>.
<ul><li> Refresh and clean everything.
 
</li></ul>
* Refresh and clean everything.
<ul><li> Select the <tt>test</tt> project and execute <tt>Run &gt; Run As ... &gt; Android JUnit Test</tt>.
 
</li></ul>
* Select the <tt>test</tt> project and execute <tt>Run > Run As ... > Android JUnit Test</tt>.
 
== Development ==
== Development ==
<p>Let's stick to some fairly sane Java conventions: 2-space indenting (Java is wide enough as it is), Maven2 for dependencies and build, JUnit4 for unit tests. We can wire in Hudson later if we have time. "Simple" for HTTP test server.
 
</p><p>Let's figure out bleeding edge stuff ("how do I get a SyncAdapter to work?") in throwaway projects. There will be a lot of these&#160;:)
Let's stick to some fairly sane Java conventions: 2-space indenting (Java is wide enough as it is), Maven2 for dependencies and build, JUnit4 for unit tests. We can wire in Hudson later if we have time. "Simple" for HTTP test server.
</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>
Let's figure out bleeding edge stuff ("how do I get a SyncAdapter to work?") in throwaway projects. There will be a lot of these :)
 
We don't quite follow the [[Fennec/NativeUI/CodingStyle]]. See also [http://source.android.com/source/code-style.html the Android coding style].
 
=== Running unit test code coverage ===
=== 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
<pre class="_fck_mw_lspace">mvn cobertura:cobertura
 
</pre>
mvn cobertura:cobertura
<p>browse
 
</p>
browse
<pre class="_fck_mw_lspace">./android-sync-app/target/site/cobertura/index.html
 
</pre>
./target/site/cobertura/index.html
<p>and click on <tt>org.mozilla.gecko</tt>.
 
</p><p><span class="fck_mw_template">{{note|At this time, you can't see the current integration test code coverage.}}</span>
and click on <tt>org.mozilla.gecko</tt>.
</p>
 
{{note|At this time, you can't see the current integration test code coverage.}}
 
== Security ==
== Security ==
<p>Goals: no less secure than currently, at most Fennec, Service, UI have access to credentials.
Goals: no less secure than currently, at most Fennec, Service, UI have access to credentials.
</p><p><a href="http://developer.android.com/guide/topics/security/security.html">Android Docs on security </a>
 
</p><p>Sandboxing by using UIDs, specifically the section on "User IDs and File Access".
[http://developer.android.com/guide/topics/security/security.html Android Docs on security ]
</p><p>See also <a href="http://developer.android.com/guide/topics/manifest/manifest-element.html">manifest entries</a>:
 
</p>
Sandboxing by using UIDs, specifically the section on "User IDs and File Access".
 
See also [http://developer.android.com/guide/topics/manifest/manifest-element.html manifest entries]:
 
<blockquote><tt>android:sharedUserId</tt>
<blockquote><tt>android:sharedUserId</tt>
The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process</blockquote>
The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process</blockquote>
== Permissions ==
== Permissions ==
<pre class="_fck_mw_lspace">  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
 
  &lt;uses-permission android:name="android.permission.MANAGE_CREDENTIALS" /&gt;
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  &lt;uses-permission android:name="android.permission.USE_CREDENTIALS" /&gt;
    <uses-permission android:name="android.permission.MANAGE_CREDENTIALS" />
  &lt;uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /&gt;
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
  &lt;uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /&gt;
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
  &lt;uses-permission android:name="android.permission.WRITE_SETTINGS" /&gt;
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
  &lt;uses-permission android:name="android.permission.READ_SYNC_STATS" /&gt;
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  &lt;uses-permission android:name="android.permission.READ_SYNC_SETTINGS" /&gt;
    <uses-permission android:name="android.permission.READ_SYNC_STATS" />
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
  &lt;uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/&gt;
    <uses-permission android:name="android.permission.INTERNET"/>
  &lt;uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/&gt;
    <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
</pre>
    <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/>
 
== Adjusting sync frequency ==
== Adjusting sync frequency ==
<p>If API &gt; 8, use ContentResolver.addPeriodicSync()
 
</p><p>If API = 7, create a service with a periodic timer callback, and call ContentResolver.requestSync().
If API > 8, use ContentResolver.addPeriodicSync()
</p><p>API &lt; 6 does not support syncAdapter, so no worries.
 
</p><p>Triggering a sync:
If API = 7, create a service with a periodic timer callback, and call ContentResolver.requestSync().
</p>
 
<pre class="_fck_mw_lspace"> android:supportsUploading defaults to true and if true an upload-only sync will be requested for all syncadapters associated with an   
API < 6 does not support syncAdapter, so no worries.
authority whenever that authority's content provider does a notifyChange(android.net.Uri, android.database.ContentObserver, boolean) with  
 
syncToNetwork set to true.  
Triggering a sync:
</pre>
 
  android:supportsUploading defaults to true and if true an upload-only sync will be requested for all syncadapters associated with an   
  authority whenever that authority's content provider does a notifyChange(android.net.Uri, android.database.ContentObserver, boolean) with  
  syncToNetwork set to true.  
 
== Altering Sync settings ==
== Altering Sync settings ==
<pre class="_fck_mw_lspace"> android:syncAdapterSettingsAction defaults to null and if supplied it specifies an Intent action of an activity that can be used to adjust the sync adapter's sync settings. The activity must live in the same package as the sync adapter.  
 
</pre>
  android:syncAdapterSettingsAction defaults to null and if supplied it specifies an Intent action of an activity that can be used to adjust the sync adapter's sync settings. The activity must live in the same package as the sync adapter.  
== Localization ==
== Localization ==
<p>http://developer.android.com/guide/topics/resources/localization.html
 
</p><p>Strings used in Firefox need to be localized into ALL THE LANGUAGES. Here's how to add a string.
http://developer.android.com/guide/topics/resources/localization.html
</p>
 
<ol><li> Add the string as an entity to <b>$topdir/strings.dtd.in</b>. These are the actual strings that get localized, and should never be changed after landing. If you do need to make a change, make a new string entity, and do not change or delete any previous ones.
</li><li> Add the entity to <b>$topdir/strings.xml.in</b>. This makes the string available in /res/values/strings.xml.
</li><li> Run the preprocess script twice to generate the strings in strings.xml for use. These can be accessed using <b>@string/&lt;string-name from strings.xml&gt;</b> when used in xml, or <b>R.strings.&lt;string-name&gt;</b> in Java code.
</li></ol>
== Schemas ==
== Schemas ==
<p>TODO
 
</p>
TODO
 
== Gotchas ==
== Gotchas ==
<p>Android's sqlite cursors are limited. Oh, and the heap is limited. We have to be very careful about how much data we store and process at one time.
 
</p>
Android's sqlite cursors are limited. Oh, and the heap is limited. We have to be very careful about how much data we store and process at one time.
<blockquote cite="http&#58;//stackoverflow.com/questions/1407442/android-sqlite-and-huge-data-sets"><p>“You are out of heap space. With a 16MB non-compacting heap, and the fact that a Cursor holds the entire result set in the heap, that is not out of the question. CursorWindow only supports 1MB of data, which is what the error message suggests more directly.</p><p>If there is a logical way to divide your queries into discrete chunks, you could do incremental queries and use CursorJoiner to stitch them together, and see if that helps.”</p></blockquote>
 
<blockquote cite="http://stackoverflow.com/questions/1407442/android-sqlite-and-huge-data-sets"><p>“You are out of heap space. With a 16MB non-compacting heap, and the fact that a Cursor holds the entire result set in the heap, that is not out of the question. CursorWindow only supports 1MB of data, which is what the error message suggests more directly.</p><p>If there is a logical way to divide your queries into discrete chunks, you could do incremental queries and use CursorJoiner to stitch them together, and see if that helps.”</p></blockquote>
 
== jvoll's notes ==
== jvoll's notes ==
<p>Having trouble with the emulator when loading Fennec and Sync onto it? Use: emulator -avd android-14 -partition-size 2047
Having trouble with the emulator when loading Fennec and Sync onto it? Use: emulator -avd android-14 -partition-size 2047
</p><p>Lines to remove from mobile/android/base/AndroidManifest.xml.in if you don't feel like working around the permissions stuff:
 
-android:permission="org.mozilla.gecko.permissions.BROWSER_PROVIDER"/&gt; from both providers
Lines to remove from mobile/android/base/AndroidManifest.xml.in if you don't feel like working around the permissions stuff:
-&lt;permission android:name="org.mozilla.gecko.permissions.BROWSER_PROVIDER" android:protectionLevel="signature"/&gt;
-android:permission="org.mozilla.gecko.permissions.BROWSER_PROVIDER"/> from both providers
</p><p>Tests failing and seeing a ProfileDatabaseException logged in logcat? This usually happens when you did a fresh install of fennec and haven't opened it yet. So, just open Fennec. If that fails (and this works for other weird stuff too), go to apps and stop Fennec, clear app data and/or in extreme cases uninstall and reinstall it. This stuff *should* all be fixed shortly, but for now these are good work arounds.
-<permission android:name="org.mozilla.gecko.permissions.BROWSER_PROVIDER" android:protectionLevel="signature"/>
</p><p>Accessing android db on emulator:
 
Tests failing and seeing a ProfileDatabaseException logged in logcat? This usually happens when you did a fresh install of fennec and haven't opened it yet. So, just open Fennec. If that fails (and this works for other weird stuff too), go to apps and stop Fennec, clear app data and/or in extreme cases uninstall and reinstall it. This stuff *should* all be fixed shortly, but for now these are good work arounds.
 
Accessing android db on emulator:
adb shell
adb shell
cd /data/data/org.mozilla.fennec_jason/files/mozilla/yvzvl036.default
cd /data/data/org.mozilla.fennec_jason/files/mozilla/yvzvl036.default
sqlite3 browser.db (or w/e database is wanted)
sqlite3 browser.db (or w/e database is wanted)
</p>
 
== Troubleshooting ==
== Troubleshooting ==
=== "R cannot be resolved" ===
=== "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.
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>
Things to try:
<ul><li>Update string resources: ./preprocess
*Update string resources: ./preprocess
</li><li>Project &gt; Clean, then rebuild the project. Alternatively, you can delete the gen/ directory, and Eclipse will rebuild automatically (Project &gt; Build Automatically checked)
*Project > Clean, then rebuild the project. Alternatively, you can delete the gen/ directory, and Eclipse will rebuild automatically (Project > Build Automatically checked)
</li></ul>
 
=== Loading apk: "Insufficient space" error on emulator ===
=== Loading apk: "Insufficient space" error on emulator ===
<p>Start an emulator with "-partition-size 2047" as a flag, to set emulator size.
Start an emulator with "-partition-size 2047" as a flag, to set emulator size.
</p>
Confirmed users
355

edits