How to add ORM ActiveAndroid to Gradle?

I am creating an Android application in which I want to use ActiveAndroid ORM . In the readme, I read instructions on how to enable it in Maven or ADT, but I am using / trying to learn Android Studio using Gradle. Therefore, I think I need to insert ActiveAndroid into the dependency. in my build.gradle file in these lines:

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

I really don't know which line / url I should use so that Gradle can automatically find ActiveAndroid and compile it in my project.

Syknee, I'm lost; can someone give me advice here how should i deal with this?

[EDIT] I now built a jar and compiled it using the suggested one compile files('libs/ActiveAndroid.jar')(I don't have the version name in my jar file). Now it works successfully, but I still cannot import classes from it. See image below: enter image description here

+4
source share
8 answers

Give it a go - download the JAR from here

Add it to the libs folder.

Change your dependencies to look something like this.

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

    compile files('libs/ActiveAndroid-3.3.jar') 
}
+9
source

Perhaps this is new, as this question has been answered, but this is in the getting started guide:

Modify your build.gradle to include:

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'

https://github.com/pardom/ActiveAndroid/wiki/Getting-started

+4
source

JAR

repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }

}

compile 'com.michaelpardo: activeandroid: 3.1.0-SNAPSHOT'

+2

, , , gradle .jar .

> Android > gradle

0
  • , , build.gradle , build.gradle?
  • , " Open Module" , "" .
  • , jar "libs", , build.gradle ActiveAndroid. , :

configurations.create( " " )

def jarFile = ('ActiveAndroid.jar')

artifacts.add( "default", jarFile)

0

, , Android Studio/ Gradle AndroidActive, , , , , . build.gradle ( ). ( ) . Gradle, .

app build.gradle

0

My full build.gradle() ActiveAndroid:

buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {

  }
}

repositories {
  mavenCentral()
  maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

apply plugin: 'com.android.application'

dependencies {
  compile 'com.michaelpardo:activeandroid:+'
  // other dependencies
  compile fileTree(dir: 'libs', include: '*.jar')
}

android {
  compileSdkVersion 24
  buildToolsVersion '24.0.0'
  defaultConfig {
    minSdkVersion 16
    targetSdkVersion 24
    versionCode 1
    versionName '1'
    multiDexEnabled true
  }
}
0

:

  • Follow this link - https://oss.sonatype.org/
  • Search michaelpardo
  • A list that also includes activeandroidwould appear
  • Click on a specific line and upload the jar file
  • Put this jar file in a folder libsand use the option Add to libraryin Android Studio
  • Compile and it should work
0
source

Source: https://habr.com/ru/post/1524516/


All Articles