Domanda

I am trying to add a library greenDAO from Github to an Android project created in Android Studio. The content of latest build.gradle created are as follow

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "18.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:18.0.0'
}

How to go about doing it?

Any pointer to latest blog on Gradle build system with added help.

È stato utile?

Soluzione

GreenDao is on Maven Central (here) so you can reference it in your final dependencies block:

dependencies {
    compile 'com.android.support:appcompat-v7:18.0.0'
    compile 'de.greenrobot:greendao:1.3.2'
}

Then just reference like you normally would. Android Studio will automatically download the jar file and build it into your app.

Altri suggerimenti

Just add compile 'de.greenrobot:greendao-generator:2.1.0' to build.gradle and sync it. You can always check the latest version here.

See this blog post for a step by step greenDAO integration tutorial.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top