سؤال

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.

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top