Android support

Issue #29 closed
Former user created an issue

Originally reported on Google Code with ID 29 ``` i was trying to use sqlite4java in android project. i don't know anything about gant so i ended up with this solution how to get both jar and needed native libraries

i create normaln android project and in its jni subdirectory i have content of attached archive

then i just run get.sh, it gets last sqlite4java sources from svn, builds it and then calls ndk-build to compile native version of sqlite4java.so library and place it where its needed

this works well, but it would be nicer if you would be able to integrate it somehow directly to gant scripts. please consider adding it there. (and if you don't like the idea then its ok for me too)

```

Reported by `selmi.and` on 2011-06-27 11:37:57

<hr>

Comments (11)

  1. Igor Sereda

    ``` Thanks for your contribution - we will consider integrating it into the common build.

    Could you please tell, what was the reason to use sqlite4java on Android? I thought Android had a pretty good sqlite wrapper among the system libraries.

    Igor ```

    Reported by `sereda` on 2011-06-27 13:29:40 - Labels added: Type-Other - Labels removed: Type-Defect

  2. Przemek Müller

    ``` One reason might be a need for multi-plaftorm code. ```

    Reported by `Thotep` on 2011-08-01 06:27:35

  3. Igor Sereda

    ``` Ok, working on this now. I'm not familiar with Android development, so a little help would be appreciated.

    The main question is, how would you like Android version of sqlite4java delivered? Do you always need to build it, or is it enough to download .SO file and place it in the project directory?

    I managed to build .SO with NDK, but not sure about what else do you need as deliverables.

    Thanks! Igor ```

    Reported by `sereda` on 2012-02-23 22:46:15 - Status changed: `Accepted`

  4. Former user Account Deleted

    ``` generally its ok if .so file would be available, but sometimes they have to recompile sqlite with different options (to enable full text search etc.) so it would be good if in development tree would also contain Android.mk and there would be some android building information somewhere (should be only little enhancment of http://code.google.com/p/sqlite4java/wiki/BuildingFromSource for android specific stuff)

    btw I was removed from android development several months ago but if you would have more questions i will forward them to the team ```

    Reported by `michal.seliga@visicom.com` on 2012-02-24 12:05:35

  5. Igor Sereda

    Reported by `sereda` on 2012-03-01 16:34:20 - Status changed: `Delivered` - Labels added: FixVersion-282

  6. Former user Account Deleted

    ``` Thanks for this great support Igor, really appreciated. Just a minor issue, when running the jar on Android, it does not report the sqlite4java version as it does when running it on other platforms (e.g. Ubuntu).

    java -jar sqlite4java output on Linux PC: [java] sqlite4java 282 [java] SQLite 3.7.10 [java] Compile-time options: ENABLE_COLUMN_METADATA ENABLE_FTS3 ENABLE_FTS3_PARENTHESIS ENABLE_MEMORY_MANAGEMENT ENABLE_RTREE OMIT_DEPRECATED TEMP_STORE=1 THREADSAFE=1

    And here's the output on Android: [exec] sqlite4java (UNKNOWN VERSION) [exec] SQLite 3.7.10 [exec] Compile-time options: ENABLE_COLUMN_METADATA ENABLE_FTS3 ENABLE_FTS3_PARENTHESIS ENABLE_MEMORY_MANAGEMENT ENABLE_RTREE OMIT_DEPRECATED TEMP_STORE=1 THREADSAFE=1

    ```

    Reported by `robert.csiki` on 2012-03-02 15:55:21

  7. Igor Sereda

    ``` Thanks Robert. The code extracts sqlite4java version from the JAR manifest, but on the Android's ClassLoader.getResource() does not work for some reason. ```

    Reported by `sereda` on 2012-03-02 16:33:24

  8. Former user Account Deleted

    ``` Any chance to support non-ARM Android platforms, such as GoogleTV? Here's the error I'm getting when deploying my test app on GoogleTV:

    com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: Couldn't load sqlite4java-android-i686: findLibrary returned null at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97) at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1314) at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:258) at com.robert.Test.<init>(Test.java:110) Caused by: java.lang.UnsatisfiedLinkError: Couldn't load sqlite4java-android-i686: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:425) at java.lang.System.loadLibrary(System.java:554) at com.almworks.sqlite4java.Internal.tryLoadFromSystemPath(Internal.java:349) at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:124) at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:95) ... 8 more ```

    Reported by `robert.csiki` on 2012-03-26 21:40:05

  9. Former user Account Deleted

    ``` Thanks Igor, just did! ```

    Reported by `robert.csiki` on 2012-03-29 18:39:21

  10. Log in to comment