How can I set up a simple gradle project that uses sqlite4java?

后端 未结 4 1061
粉色の甜心
粉色の甜心 2020-12-20 12:08

I\'m starting a simple java test project using sqlite4java and building using java.

I can get the core sqlite4java library downloaded easily, but I\'m not sure what

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-20 13:09

    I used this method to setup sqlite4java in anroid studio 3.1.4.

    First download the library from this link: https://bitbucket.org/almworks/sqlite4java

    The download will contain a zip file containing a folder named android and other .jar , .so and .dll files.

    Copy the three folders in android i.e 'armeabi', 'armeabi-v7a' and 'x86' into a folder named 'jniLibs'.

    Copy the above folder i.e 'jniLibs' into yourproject/app/src/main/ folder.

    Then implement the gradle dependencies for java4sqlite:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "your.project.name"
            minSdkVersion 15
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    
    
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        implementation 'com.android.support:design:26.1.0'
        implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
        implementation "com.almworks.sqlite4java:sqlite4java:1.0.392"
        implementation "com.almworks.sqlite4java:libsqlite4java-osx:1.0.392"
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    
    
    }
    

提交回复
热议问题