Sqlcipher integration error with Android application on Eclipse


#1

Hello,
I am having issues when integrating into Android application on Eclipse IDE and issues goes like this :

[2015-06-29 22:55:19 - Login] Dx
trouble writing output: already prepared
[2015-06-29 22:55:22 - Dex Loader] Unable to execute dex: Multiple dex files define Lnet/sqlcipher/R$drawable;
[2015-06-29 22:55:22 - Login] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lnet/sqlcipher/R$drawable;

and my libs include armeabi folder, android-support-v4.jar, sqlcipher.jar. And I don’t see multiple jar in libs folder.
Please share your solution.
Thanks a lot~


#2

Hello @faterap

Can you compare your project configuration with the SQLCipher for Android test suite? It seems strange that the issue is local to the drawable components.


#4

Thanks for your solution @developernotes evelopernotes but I met another problem here:
I delete my project in Eclipse and then import it again. I uncheck “Android Private Libraries” in Order and Export panel in Java Build Path then and my app runs but with the new issue:

06-29 11:22:55.044: E/AndroidRuntime(3791): FATAL EXCEPTION: main
06-29 11:22:55.044: E/AndroidRuntime(3791): Process: com.example.login, PID: 3791
06-29 11:22:55.044: E/AndroidRuntime(3791): java.lang.UnsatisfiedLinkError: dlopen failed: “/data/app-lib/com.example.login-2/libdatabase_sqlcipher.so” has unexpected e_machine: 40
I googled it and quite sure the problem is in:

SQLiteDatabase.loadLibs(this)
and I write it in my launcher activity:

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

SQLiteDatabase.loadLibs(this);


I am not able to upload images as I’m a new user here~ANY suggestion for the new issue?
Thx!!!


#5

Hello @faterap

Your project configuration does not appear to be including the native libraries. The call to SQLiteDatabase.loadLibs(this);` perform the native library loading within your application, the exception is due to your application not properly containing the native libraries. Can you adjust your project to include the supplied native libraries?


#6

Hello @developernotes
Do you mean adjusting my libs folder and assets folder? As I’m not quite sure the right way to adjust it.
And here are my assets and libs folders:

And Libraries in Java Build Path:

And Order and Export in Java Build Path:
I am wondering any problems with the configuration above. Can you be more detailed about the adjusting process? Thanks!


#7

Hello @faterap

I am not certain what is different. I just put together the sample application based on the directions found here which was successful. Can you try running through the tutorial and compare that with your existing project? I have attached a few screenshots:


#8

Hi @developernotes
I just add some other .jar in my libs folder and my app is running successfully…

That’s kind of weird somehow…But now I can encrypted my sqlite database.
BTW thank u so much for these suggestion : )


#9

Hello @faterap

Thank you for the update, we are glad to hear everything is working well for you.