Vincent Dingding
Vincent Dingding

Reputation: 19

Instrumentation using gradle on Android App

i am using ActiveJDBC for my Android App, and Im having trouble on instrumentation.

Here is my build.gradle

apply plugin: 'java'
apply plugin: 'org.javalite.activejdbc'

buildscript {
   repositories {
      google()
      jcenter()
      mavenCentral()
      maven {url 'http://repo.javalite.io'}
   }

   dependencies {
      classpath 'com.android.tools.build:gradle:3.2.1'
      classpath group: 'org.javalite', name: 'activejdbc-gradle-plugin', version: '2.0'
   }
}

allprojects {
   repositories {
      google()
      jcenter()
      mavenCentral()
      maven {url 'http://repo.javalite.io'}
   }
}

dependencies {
//   compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.25'
     compile group: 'org.javalite', name: 'activejdbc', version: '2.0'
     compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.5'
     testCompile group: 'junit', name: 'junit', version: '4.12'
}

task run(dependsOn: 'build', type: JavaExec) {
     main = 'ph.com.partnersolutions.activejdbforandroidtest.MainActivity'
     classpath = sourceSets.main.runtimeClasspath
}

But this doesn't work. Am i doing it right ?

Upvotes: -1

Views: 200

Answers (2)

ipolevoy
ipolevoy

Reputation: 5518

You are not providing any information on what is not working. However, you are using a JavaLite released version 2.0 and also using the outdated SNAPSHOT repo http://repo.javalite.io which you do not need. I suggest you switch to latest version 2.2 and remove the repo http://repo.javalite.io because it is not available anymore. Months ago we switched to Sonatype as most Java projects. You can find the info here: http://javalite.io/releases#current-snapshot-2.3-snapshot

Also, please check out the working Gradle example: https://github.com/javalite/activejdbc-gradle

EDIT July 11 2019: Please, see an official Gradle Plugin: https://github.com/cschabl/activejdbc-gradle-plugin

Upvotes: 0

Christof Schablinski
Christof Schablinski

Reputation: 107

build\classes\<jvm-language>\main\ is the new directory layout for JVM-language plugins since Gradle 4. The Gradle plugin of ActiveJDBC 2.2 knows about this and adjusts the classes dir dependending on the Gradle version.

You can also try the new ActiveJDBC Gradle plugin.

Upvotes: 0

Related Questions