Connect To Sqlite In Android Ndk Native
I'm connecting SQLite in NATIVE on android. I'm Got this exception: unable to open database file my NDK code: #include #include #include 'Da
Solution 1:
Android app does not have its own 'home' directory. The underlying Linux-like runtime has getcwd(), and it will return /
- i.e. the root of the filesystem. Note that the app does not own /
and it cannot write to this directory.
This means that you must pass the full path to any file you want to open, including myDb.db
. You probably want to keep the database in the default database location for the app, such as returned by Context.getDatabasePath(). The best easiest reliable way to get it in C++, is to have Java query it before calling native, and pass the path to C++.
Post a Comment for "Connect To Sqlite In Android Ndk Native"