Installing Android SQLite Asset Helper

后端 未结 1 1290
一整个雨季
一整个雨季 2021-01-16 08:49

I need to use my ready made database. Search for solution on internet did not work until I decided I will use the mentioned library found here. However, I found it hard to u

相关标签:
1条回答
  • 2021-01-16 08:56

    This is an old question, but it doesn't seem to have a proper answer, and I found it while trying to install SQLiteAssetHelper myself, so I thought I should share my experience, according to the instructions found here.

    Like most inexperienced Android Studio users, I thought I should Download ZIP from the GitHub repository and place it somewhere in my PC. Turns out this is not the way to Install SQLiteAssetHelper, if you are using Gradle which is a Build system integrated in Android Studio.

    What you need to do is simply described in the GitHub repository Setup section. So here is a Step-by-step guide, with some additional information:

    1) Make sure that your Gradle is not in Offline Mode. (In Android Studio which is currently at version 2.2.2, go to File > Settings > Build, Execution, Development > Gradle and uncheck Offline Work in case that is checked. (This is only required for your first Sync)

    2) In your Android Studio Project Navigator (on the left) you should see an item entitled Gradle Scripts. Expand it, and you should find a build.gradle file. If you see two such files, there should be a comment in a parenthesis next to each one saying Project: YourProjectName and Module: App.

    If you open the one saying Project: YourProjectName you should see the following comments:

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    

    So, you should choose the one saying Module: App, at the end of which you should see something like this:

    dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      ...
    }
    

    At that point, you should just add the code pointed out in GitHub, like this:

    dependencies {
      compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
      compile fileTree(dir: 'libs', include: ['*.jar'])
      ...
    }
    

    That's all. To start using it, you just have to extend the SQLiteAssetHelper class, pretty much like extending SQLiteOpenHelper.

    0 讨论(0)
提交回复
热议问题