Task #2549
closedjNDN on Android: Producer unable to register prefix
80%
Description
Using the jNDN library on Android, the sqlite3 driver cannot be loaded and hence an NDN enabled Producer application is unable to register a prefix with the locally running NFD.
A sample application is created at: https://github.com/ivanyeo/NFDProducerConsumer
Through collaborative effort, this task attempts to resolve the ability for NDN enable applications to register prefixes with the locally running NFD through the jNDN library.
Updated by Anonymous over 9 years ago
- Status changed from New to In Progress
I am able to run Sanjeev's test code for Android SqLite in the emulator. So, making progress. What is the full path where NFD puts .ndn/ndnsec-public-info.db ?
Updated by Ivan Yeo over 9 years ago
Hey Jeff,
Not sure if this answers your question, but the NFD Service has the file located at:
/data/data/net.named_data.nfd/files/.ndn/ndnsec-public-info.db
where: "/data/data/net.named_data.nfd/files/" is the "files" directory that belongs to the Service APK.
My concern is that other applications may not be able to access this file as this directory is only accessible by the NFD Service APK itself. This might suffice if you're working with the NFD Service code. Maybe Alex can chime in if we're on the right track.
Cheers,
Ivan
Updated by Alex Afanasyev over 9 years ago
There should not be any assumptions about the folder. This is the parameter that the client app should specify when creating keychain. The app (any android activity) has an interface to get the right folder where it can store private data: getFilesDir().getAbsolutePath()
Updated by Anonymous over 9 years ago
I wrote the class AndroidSqlite3IdentityStorage in jNDN branch issue/2549-Android-sqlite. I'll work with Sanjeev to test it.
Updated by Anonymous over 9 years ago
- % Done changed from 0 to 80
To test, Sanjeev will write an Android app which does the same thing as "ndnsec set-default" and "ndnsec get-default" since these are pretty simple calls.
Updated by Anonymous over 9 years ago
Hi Sanjeev,
Do you think we are ready to merge the jNDN issue/2549-Android-sqlite branch into the master branch?
Updated by Sanjev Mehrotra over 9 years ago
Jeff Thompson wrote:
Hi Sanjeev,
Do you think we are ready to merge the jNDN issue/2549-Android-sqlite branch into the master branch?
Jeff,
In my last couple of attempts. I was not successful in calling the api via the android app . For this I sent out an email as well asking help from Alex and you dated March 26.
The issues I faced were quite different with different version of sqlit jdbc api. In none of the case the jdbc api got initialized properly for some reason.
I tried couple of other jars from mvn repositiory and got following runtime issues with various versions.
I would need help in resolving it.
with sqlite 3.7.2
/net.named_data.nfd W/dalvikvm? Exception Ljava/lang/Error; thrown while initializing Lorg/ibex/nestedvm/util/Platform;
03-26 06:00:23.759 7262-7278/net.named_data.nfd W/dalvikvm? Exception Ljava/lang/Error; thrown while initializing Lorg/ibex/nestedvm/Runtime;
03-26 06:00:23.769 7262-7278/net.named_data.nfd W/System.err? java.lang.NullPointerException
03-26 06:00:23.809 7262-7278/net.named_data.nfd W/System.err? at org.sqlite.NestedDB$CausedSQLException.fillInStackTrace(NestedDB.java:649)
03-26 06:00:23.809 7262-7278/net.named_data.nfd W/System.err? at java.lang.Throwable.(Throwable.java:83)
03-26 06:00:23.809 7262-7278/net.named_data.nfd W/System.err? at java.lang.Exception.(Exception.java:36)
03-26 06:00:23.809 7262-7278/net.named_data.nfd W/System.err? at java.sql.SQLException.(SQLException.java:55)
03-26 06:00:23.809 7262-7278/net.named_data.nfd W/System.err? at org.sqlite.NestedDB$CausedSQLException.(NestedDB.java:626)
03-26 06:00:23.809 7262-7278/net.named_data.nfd W/System.err? at org.sqlite.NestedDB._open(NestedDB.java:63)
03-26 06:00:23.809 7262-7278/net.named_data.nfd W/System.err? at org.sqlite.DB.open(DB.java:86)
03-26 06:00:23.809 7262-7278/net.named_data.nfd W/System.err? at org.sqlite.Conn.open(Conn.java:140)
03-26 06:00:23.819 7262-7278/net.named_data.nfd W/System.err? at org.sqlite.Conn.(Conn.java:57)
03-26 06:00:23.819 7262-7278/net.named_data.nfd W/System.err? at org.sqlite.JDBC.createConnection(JDBC.java:77)
03-26 06:00:23.819 7262-7278/net.named_data.nfd W/System.err? at org.sqlite.JDBC.connect(JDBC.java:64)
03-26 06:00:23.829 7262-7278/net.named_data.nfd W/System.err? at java.sql.DriverManager.getConnection(DriverManager.java:175)
03-26 06:00:23.829 7262-7278/net.named_data.nfd W/System.err? at java.sql.DriverManager.getConnection(DriverManager.java:140)
03-26 06:00:23.829 7262-7278/net.named_data.nfd W/System.err? at net.named_data.jndn.security.identity.BasicIdentityStorage.construct(BasicIdentityStorage.java:81)
03-26 06:00:23.829 7262-7278/net.named_data.nfd W/System.err? at net.named_data.jndn.security.identity.BasicIdentityStorage.(BasicIdentityStorage.java:66)
with sqlite. 3.8.7
03-26 06:05:15.809 7379-7395/net.named_data.nfd W/dalvikvm? Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/sqlite/core/NativeDB;
03-26 06:05:15.809 7379-7395/net.named_data.nfd W/dalvikvm? threadid=11: thread exiting with uncaught exception (group=0x417aa460)
03-26 06:05:15.849 7379-7395/net.named_data.nfd E/AndroidRuntime? FATAL EXCEPTION: AsyncTask #1
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load sqlitejdbc: findLibrary returned null
Updated by Anonymous over 9 years ago
Can we simplify the problem? Are you able to build a version of your app, independent of jNDN, which does the import
import android.database.sqlite.SQLiteDatabase;
and simply connects to a database with the following?
SQLiteDatabase.openDatabase
(context.getFilesDir() + "/test.db", null,
SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.CREATE_IF_NECESSARY);
Updated by Jiewen Tan over 9 years ago
May I ask what the status of this commit is? I am currently working with Alex and trying to build the Android Identity Manager ontop of jNDN. It apparently needs the Android SQLite feature enabled by this commit. Therefore, I am really concerned about this task.
Updated by Ivan Yeo over 9 years ago
I'm not currently working on this right now. I think Sanjeev might be working on this?
Updated by Anonymous over 9 years ago
AndroidSqlite3IdentityStorage is merged to master.
Updated by Anonymous over 9 years ago
I made a Maven package which includes AndroidSqlite3IdentityStorage. In your Android project, please try this dependency:
<dependency>
<groupId>net.named-data</groupId>
<artifactId>jndn</artifactId>
<version>0.6-android</version>
</dependency>
Updated by Alex Afanasyev almost 9 years ago
- Status changed from In Progress to Closed