0

This is my program.

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"});
         }
}

I have add some three libraries in this program which is in this link ........ https://github.com/sqlcipher/android-database-sqlcipher

Now My query is i am getting the following errors. How to overcome to get a perfect solution ...

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 ...

2 Answers 2

1

It can't find your library. If its a jar, did you put it in your libs folder and add it to the project? Did you export it on the export tab? If its a library project, did you add it as a library? If so did it add the reference in project.properties?

If all of those are right, try a make clean, eclipse may just need to recompile everything.

1
1

I had the same problem, even after the library had the requisite jar file. Solved it, by modifying the Proguard config file. Apparently, Proguard was optimizing the APK by removing the lib. So if you are using Proguard, you might want to look into the config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.