这是我的演示项目
public class SQLDemoActivity extends Activity {
EventDataSQLHelper eventsData;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//you must set Context on SQLiteDatabase first
SQLiteDatabase.loadLibs(this);
String password = "foo123";
eventsData = new EventDataSQLHelper(this);
//then you can open the database using a password
SQLiteDatabase db = eventsData.getWritableDatabase(password);
for (int i = 1; i < 100; i++)
addEvent("Hello Android Event: " + i, db);
db.close();
db = eventsData.getReadableDatabase(password);
Cursor cursor = getEvents(db);
showEvents(cursor);
db.close();
}
@Override
public void onDestroy() {
eventsData.close();
}
private void addEvent(String title, SQLiteDatabase db) {
ContentValues values = new ContentValues();
values.put(EventDataSQLHelper.TIME, System.currentTimeMillis());
values.put(EventDataSQLHelper.TITLE, title);
db.insert(EventDataSQLHelper.TABLE, null, values);
}
private Cursor getEvents(SQLiteDatabase db) {
Cursor cursor = db.query(EventDataSQLHelper.TABLE, null, null, null, null, null, null);
startManagingCursor(cursor);
return cursor;
}
private void showEvents(Cursor cursor) {
StringBuilder ret = new StringBuilder("Saved Events:\n\n");
while (cursor.moveToNext()) {
long id = cursor.getLong(0);
long time = cursor.getLong(1);
String title = cursor.getString(2);
ret.append(id + ": " + time + ": " + title + "\n");
}
Log.i("sqldemo",ret.toString());
}
}
我收到以下错误我如何清除错误。以下作为演示项目的链接是https://github.com/sqlcipher/android-database-sqlcipher。
04-12 12:53:20.229: E/AndroidRuntime(7413): java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared: findLibrary returned null
04-12 12:53:20.229: E/AndroidRuntime(7413): at java.lang.Runtime.loadLibrary(Runtime.java:429)
04-12 12:53:20.229: E/AndroidRuntime(7413): at java.lang.System.loadLibrary(System.java:554)
04-12 12:53:20.229: E/AndroidRuntime(7413): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:142)
04-12 12:53:20.229: E/AndroidRuntime(7413): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:137)
04-12 12:53:20.229: E/AndroidRuntime(7413): at example.SQLDemoActivity.onCreate(SQLDemoActivity.java:20)
04-12 12:53:20.229: E/AndroidRuntime(7413): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-12 12:53:20.229: E/AndroidRuntime(7413): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-12 12:53:20.229: E/AndroidRuntime(7413): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-12 12:53:20.229: E/AndroidRuntime(7413): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-12 12:53:20.229: E/AndroidRuntime(7413): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-12 12:53:20.229: E/AndroidRuntime(7413): at android.os.Handler.dispatchMessage(Handler.java:99)
04-12 12:53:20.229: E/AndroidRuntime(7413): at android.os.Looper.loop(Looper.java:123)
04-12 12:53:20.229: E/AndroidRuntime(7413): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-12 12:53:20.229: E/AndroidRuntime(7413): at java.lang.reflect.Method.invokeNative(Native Method)
04-12 12:53:20.229: E/AndroidRuntime(7413): at java.lang.reflect.Method.invoke(Method.java:507)
04-12 12:53:20.229: E/AndroidRuntime(7413): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-12 12:53:20.229: E/AndroidRuntime(7413): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-12 12:53:20.229: E/AndroidRuntime(7413): at dalvik.system.NativeStart.main(Native Method)<