CloudServices/NativeSync: Difference between revisions

Jump to navigation Jump to search
Undo revision 408569 by Liuche (talk)
(Undo revision 408569 by Liuche (talk))
Line 1: Line 1:
= Native Sync =
<h1> Native Sync </h1>
== Setup ==
<h2> Setup </h2>
[[Mobile/Fennec/Android_OtherBuildEnvs#Mac_OSX | Setting up an Android dev environment]]
<p><a href="Mobile/Fennec/Android OtherBuildEnvs#Mac_OSX"> Setting up an Android dev environment</a>
* 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:
</p>
$ANDROID_HOME/tools/android
<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:
 
</li></ul>
=== Emulators ===
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/android
 
</pre>
* to create:
<h3> Emulators </h3>
 
<ul><li> to create:
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>).
</li></ul>
 
<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>).
$ANDROID_HOME/tools/android create avd -t android-10 -n NAME -c 2047M
</p>
 
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/android create avd -t android-10 -n NAME -c 2047M
produces the output
</pre>
<p>produces the output
Auto-selecting single ABI armeabi
</p>
Android 2.3.3 is a basic Android platform.
<pre class="_fck_mw_lspace">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
 
hw.ramSize=256
{{note|Target (in the example above, <tt>android-10</tt>) probably needs to match build specified in .mozconfig (see Building Fennec Native below).}}
</pre>
 
<p><span class="fck_mw_template">{{note|Target (in the example above, &lt;tt&gt;android-10&lt;/tt&gt;) probably needs to match build specified in .mozconfig (see Building Fennec Native below).}}</span>
* to launch:
</p>
 
<ul><li> to launch:
$ANDROID_HOME/tools/emulator -wipe-data -avd NAME -partition-size 2047
</li></ul>
 
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/emulator -wipe-data -avd NAME -partition-size 2047
{{note|The partition size is set large so that you don't run into an insufficient storage error.}}
</pre>
 
<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>
* to delete:
</p>
 
<ul><li> to delete:
$ANDROID_HOME/tools/android delete avd -n NAME
</li></ul>
 
<pre class="_fck_mw_lspace">$ANDROID_HOME/tools/android delete avd -n NAME
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?
</pre>
 
<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 ==
</p>
 
<h2> Running everything </h2>
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:
 
</p>
https://github.com/mozilla-services/android-sync
<pre class="_fck_mw_lspace">https://github.com/mozilla-services/android-sync
 
</pre>
Try
<p>Try
 
</p>
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>
=== android-sync dependencies ===
<h3> android-sync dependencies </h3>
 
<p>android-sync has the following dependencies:
android-sync has the following dependencies:
</p>
 
<ul><li> sync-crypto, described below.
* sync-crypto, described below.
</li><li> httpclientandroidlib, which provides a working modern version of the Apache HTTPClient under a different Java package.
* httpclientandroidlib, which provides a working modern version of the Apache HTTPClient under a different Java package.
</li><li> json-simple 1.1 and commons-codec 1.2, which ship with Android.
* json-simple 1.1 and commons-codec 1.2, which ship with Android.
</li><li> Android 2.3.3.
* Android 2.3.3.
</li></ul>
 
<p>For testing it requires:
For testing it requires:
</p>
* JUnit 4.1.
<ul><li> JUnit 4.1.
* org.simpleframework.simple, for HTTP testing.
</li><li> org.simpleframework.simple, for HTTP testing.
* Tiny “un-stub” packages for android.util.Log, android.util.Base64, and android.content.SharedPreferences.
</li><li> Tiny “un-stub” packages for android.util.Log, android.util.Base64, and android.content.SharedPreferences.
 
</li></ul>
These live on github, and must be built and installed.
<p>These live on github, and must be built and installed.
 
</p>
** https://github.com/rnewman/base64-unstub
<ul><li><ul><li> https://github.com/rnewman/base64-unstub
** https://github.com/rnewman/log-unstub
</li><li> https://github.com/rnewman/log-unstub
** https://github.com/rnewman/sharedpreferences-stub
</li><li> https://github.com/rnewman/sharedpreferences-stub
 
</li></ul>
=== sync-crypto dependencies ===
</li></ul>
 
<h3> sync-crypto dependencies </h3>
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>
=== What you need to do ===
<h3> What you need to do </h3>
 
<pre class="_fck_mw_lspace">git clone https://github.com/rnewman/base64-unstub
git clone https://github.com/rnewman/base64-unstub
git clone https://github.com/rnewman/log-unstub
git clone https://github.com/rnewman/log-unstub
git clone https://github.com/rnewman/sharedpreferences-stub
git clone https://github.com/rnewman/sharedpreferences-stub
git clone https://github.com/mozilla-services/android-sync
git clone https://github.com/mozilla-services/android-sync
pushd base64-unstub;          mvn install; popd
pushd base64-unstub;          mvn install; popd
pushd log-unstub;            mvn install; popd
pushd log-unstub;            mvn install; popd
pushd sharedpreferences-stub; mvn install; popd
pushd sharedpreferences-stub; mvn install; popd
pushd android-sync
pushd android-sync
git checkout develop
git checkout develop
./preprocess.sh
./preprocess.sh
mvn test
mvn test
</pre>
 
<p><span class="fck_mw_template">{{note|&lt;tt&gt;mvn assembly:assembly&lt;/tt&gt; may fail, however, it is still ok to proceed.}}</span>
{{note|<tt>mvn assembly:assembly</tt> may fail, however, it is still ok to proceed.}}
</p><p>To do real Android development and testing, you need to import android-sync as a project in Eclipse with the ADT installed.
 
</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.
To do real Android development and testing, you need to import android-sync as a project in Eclipse with the ADT installed.
</p>
 
<h3> Running Fennec </h3>
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>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.
=== Running Fennec ===
</p>
The directions at [[Fennec/NativeUI | Building Native Fennec]] should be correct, specifically [[Fennec/NativeUI#How_To_Build | How To Build]].
<pre class="_fck_mw_lspace">make -sj8 -C objdir-droid/ package
 
</pre>
After building Fennec, make the apk.
<p>The apk will be something like <tt>objdir-droid/dist/fennec-12.0a1.en-US.android-arm.apk</tt>.
make -sj8 -C objdir-droid/ package
</p>
 
<h4> Running Fennec on an Android device </h4>
The apk will be something like <tt>objdir-droid/dist/fennec-12.0a1.en-US.android-arm.apk</tt>.
<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>.
 
</li><li> Ensure your Android device is connected to your computer's USB port.
==== Running Fennec on an Android device ====
</li><li> Run
* Ensure USB debugging is enabled on your Android device: fom the home screen, select <tt>Settings > Applications > Development > USB debugging</tt>.
</li></ul>
* Ensure your Android device is connected to your computer's USB port.
<pre class="_fck_mw_lspace">$ANDROID_HOME/platform-tools/adb install -r objdir-droid/dist/fennec*apk
* Run
</pre>
$ANDROID_HOME/platform-tools/adb install -r objdir-droid/dist/fennec*apk
<h4> Running Fennec on an emulator </h4>
 
<ul><li> Ensure the emulator is running.
==== Running Fennec on an emulator ====
</li><li> Run
* Ensure the emulator is running.
</li></ul>
* Run
<pre class="_fck_mw_lspace">$ANDROID_HOME/platform-tools/adb install -r objdir-droid/dist/fennec*apk
$ANDROID_HOME/platform-tools/adb install -r objdir-droid/dist/fennec*apk
</pre>
 
<p><span class="fck_mw_template">{{note|You may need to run &lt;tt&gt;adb kill-server; adb start-server&lt;/tt&gt; if adb doesn't recognize the emulator.}}</span>
{{note|You may need to run <tt>adb kill-server; adb start-server</tt> if adb doesn't recognize the emulator.}}
</p>
 
<h4> Accessing Fennec/Android Sync debug statements </h4>
==== Accessing Fennec/Android Sync debug statements ====
<pre class="_fck_mw_lspace">$ANDROID_HOME/platform-tools/adb logcat
$ANDROID_HOME/platform-tools/adb logcat
</pre>
 
<h3> Setting up Eclipse </h3>
=== 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 &lt;tt&gt;M2_REPO&lt;/tt&gt; (for example, as described at [http://www.mkyong.com/maven/how-to-configure-m2_repo-variable-in-eclipse-ide/]) to something like &lt;tt&gt;$HOME/.m2/repository&lt;/tt&gt;.}}</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>
 
<h4> To run the unit test suite under Eclipse </h4>
==== 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>.
<h4> To run the integration test suite under Eclipse </h4>
 
<ul><li> Add the <tt>test</tt> subdirectory as a sub-project using <tt>File &gt; Import &gt; Existing project</tt>.
==== To run the integration test suite under Eclipse ====
</li></ul>
 
<ul><li> Refresh and clean everything.
* Add the <tt>test</tt> subdirectory as a sub-project using <tt>File > Import > Existing project</tt>.
</li></ul>
 
<ul><li> Select the <tt>test</tt> project and execute <tt>Run &gt; Run As ... &gt; Android JUnit Test</tt>.
* Refresh and clean everything.
</li></ul>
 
<h2> Development </h2>
* Select the <tt>test</tt> project and execute <tt>Run > Run As ... > Android JUnit Test</tt>.
<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;:)
== Development ==
</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 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.
<h3> Running unit test code coverage </h3>
 
<p>To see the current unit test code coverage (using the Maven plugin integrating Cobertura), from the <tt>android-sync</tt> directory run
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 :)
</p>
 
<pre class="_fck_mw_lspace">mvn cobertura:cobertura
We don't quite follow the [[Fennec/NativeUI/CodingStyle]]. See also [http://source.android.com/source/code-style.html the Android coding style].
</pre>
 
<p>browse
=== Running unit test code coverage ===
</p>
 
<pre class="_fck_mw_lspace">./target/site/cobertura/index.html
To see the current unit test code coverage (using the Maven plugin integrating Cobertura), from the <tt>android-sync</tt> directory run
</pre>
 
<p>and click on <tt>org.mozilla.gecko</tt>.
mvn cobertura:cobertura
</p><p><span class="fck_mw_template">{{note|At this time, you can't see the current integration test code coverage.}}</span>
 
</p>
browse
<h2> Security </h2>
 
<p>Goals: no less secure than currently, at most Fennec, Service, UI have access to credentials.
./target/site/cobertura/index.html
</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".
and click on <tt>org.mozilla.gecko</tt>.
</p><p>See also <a href="http://developer.android.com/guide/topics/manifest/manifest-element.html">manifest entries</a>:
 
</p>
{{note|At this time, you can't see the current integration test code coverage.}}
 
== Security ==
Goals: no less secure than currently, at most Fennec, Service, UI have access to credentials.
 
[http://developer.android.com/guide/topics/security/security.html Android Docs on security ]
 
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>
 
<h2> Permissions </h2>
== 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"/>
<h2> Adjusting sync frequency </h2>
 
<p>If API &gt; 8, use ContentResolver.addPeriodicSync()
== Adjusting sync frequency ==
</p><p>If API = 7, create a service with a periodic timer callback, and call ContentResolver.requestSync().
 
</p><p>API &lt; 6 does not support syncAdapter, so no worries.
If API > 8, use ContentResolver.addPeriodicSync()
</p><p>Triggering a sync:
 
</p>
If API = 7, create a service with a periodic timer callback, and call ContentResolver.requestSync().
<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   
 
authority whenever that authority's content provider does a notifyChange(android.net.Uri, android.database.ContentObserver, boolean) with  
API < 6 does not support syncAdapter, so no worries.
syncToNetwork set to true.  
 
</pre>
Triggering a sync:
<h2> Altering Sync settings </h2>
 
<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.  
  android:supportsUploading defaults to true and if true an upload-only sync will be requested for all syncadapters associated with an   
</pre>
  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 ==
 
  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.  
<h2> Localization </h2>
<h2> Localization </h2>
<p>http://developer.android.com/guide/topics/resources/localization.html
<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.
</p>
</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.
<h2> Schemas </h2>
</li><li> Add the entity to <b>$topdir/strings.xml.in</b>. This makes the string available in /res/values/strings.xml.
<p>TODO
</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.
</p>
</li></ol>
<h2> Gotchas </h2>
 
<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.
== Schemas ==
</p>
 
<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>
TODO
<h2> jvoll's notes </h2>
 
<p>Having trouble with the emulator when loading Fennec and Sync onto it? Use: emulator -avd android-14 -partition-size 2047
== Gotchas ==
</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
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.
-&lt;permission android:name="org.mozilla.gecko.permissions.BROWSER_PROVIDER" android:protectionLevel="signature"/&gt;
 
</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.
<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>
</p><p>Accessing android db on emulator:
 
== jvoll's notes ==
Having trouble with the emulator when loading Fennec and Sync onto it? Use: emulator -avd android-14 -partition-size 2047
 
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"/> from both providers
-<permission android:name="org.mozilla.gecko.permissions.BROWSER_PROVIDER" android:protectionLevel="signature"/>
 
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 ==
<h2> Troubleshooting </h2>
=== "R cannot be resolved" ===
<h3> "R cannot be resolved" </h3>
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:
Things to try:
</p>
*Update string resources: ./preprocess
<ul><li>Update string resources: ./preprocess
*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 &gt; Clean, then rebuild the project. Alternatively, you can delete the gen/ directory, and Eclipse will rebuild automatically (Project &gt; Build Automatically checked)
 
</li></ul>
=== Loading apk: "Insufficient space" error on emulator ===
<h3> Loading apk: "Insufficient space" error on emulator </h3>
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>
Confirmed users
400

edits

Navigation menu