I have been searching for a solution to my problem a long time and I just want to share my solution to others who might have the same problem.
I was coming from the Eclipse IDE developing an android app and I wanted to check out the Android Studio IDE. So I downloaded the current Android Studio(BETA v0.8.6) and so far I really like what the are doing with the Android Studio.
My Problem: I was using the SQLCipher libraries to include an encrypted database into my project. Unfortunately integration of SQLCipher into Android Studio doesn't work like they say on the official SQLCipher website (since the howto is written for the Eclipse IDE). So I was searching the web for a solution to integrate SQLCipher into Android Studio because I wasn't able to import it into my main activity java class.
My Solution: You download the SQLCipher build from the official website. In that folder you will see two folders. An "assets" folder and a "libs" folder.
Within the "libs" folder there are your *.jar files and some folders for each supported architecture with some *.so files within them.
Now you do the following:
- Go to your project-folder (standard in: C:\Users\\AndroidStudioProjects\)
- Open the "app" folder
- Copy the three .jar files (commons-codec, guava-r09, sqlcipher) into the "lib" folder.
- Now go to: app\src\main and create two folders: "assets" and "jniLibs".
- Copy the icudt46l.zip file into the "assets" folder.
- Copy the "armeabi", "armeabi-v7a" and "x86" folders into the "jniLibs" folder.
Now start Android Studio and open your project. In Android Studio you see the files in tree view at your left.
- Expand your "app" folder wihtin Android Studio so you can see the "build.gradle" file.
- Open the "build.gradle" file.
Now within the grade.build file make sure this code snippets is included at the bottom of the file:
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) }
It should now look similar to this:
apply plugin: 'com.android.application' android { compileSdkVersion 'android-L' buildToolsVersion "20.0.0" defaultConfig { applicationId "com.example.testapp" minSdkVersion 15 targetSdkVersion 'L' versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets { main { jniLibs.srcDirs = ['libs'] } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) }
Finally the import for SQLCipher should now be working. It's important that you create the jniLibs folder with exactly that name! Otherwise it won't work.
I wanted to add pictures as well, but I don't have any sort of credit points yet to do so. As soon as I have these I will add the pictures I made to this post.
Greetz, Steffen