这是我的程序。
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
InitializeSQLCipher();
}
private void InitializeSQLCipher() {
SQLiteDatabase.loadLibs(this);
File databaseFile = getDatabasePath("demo.db");
databaseFile.mkdirs();
databaseFile.delete();
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databaseFile, "test123", null);
database.execSQL("create table t1(a, b)");
database.execSQL("insert into t1(a, b) values(?, ?)", new Object[]{"one for the money",
"two for the show"});
}
}
我在这个链接中的这个程序中添加了一些三个库............ https://github.com/sqlcipher/android-database-sqlcipher
现在我的查询是我收到以下错误。如何克服以获得完美的解决方案...
04-12 11:47:27.379: E/AndroidRuntime(2163): FATAL EXCEPTION: main
04-12 11:47:27.379: E/AndroidRuntime(2163): java.lang.NoClassDefFoundError: net.sqlcipher.database.SQLiteDatabase
04-12 11:47:27.379: E/AndroidRuntime(2163): at com.example.testproject.MainActivity.InitializeSQLCipher(MainActivity.java:43)
04-12 11:47:27.379: E/AndroidRuntime(2163): at com.example.testproject.MainActivity.onCreate(MainActivity.java:37)
04-12 11:47:27.379: E/AndroidRuntime(2163): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-12 11:47:27.379: E/AndroidRuntime(2163): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) .... and so on ...