Specify repositories for android dependencies


#1

Hello,

I try to add an angular dependecy to my project and I don’t know where I can add repository ( maven, jcenter … ). I try to use jitPack (https://jitpack.io/) to have my dependency availble but I don’t know where I have to put the code.
I tried to add in App_resources/Android/app.gradle:

repositories {
  maven { url 'https://jitpack.io' }
}
dependencies {
  compile "com.github.Serge-SDL:android-signaturepad:1.2.1"
}

but I have got this error:

Could not find com.github.Serge-SDL:android-signaturepad:1.2.1.

I also tried to add this:

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
  dependencies {
    compile "com.github.Serge-SDL:android-signaturepad:1.2.1"
  }
}

but I have got a other error:

Could not find method compile() for arguments [com.github.Serge-SDL:android-signaturepad:1.2.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Does anyone have an idea?
thanks !
serge


#2

Why don’t you simply use the plugin https://github.com/bradmartin/nativescript-drawingpad ?

btw, your first approach was correct actually. that is the right way to add dependencies.


#3

Thanks for your answer
I just want to fix an issue and customize the native plugin (more details here: Extending native class) that why I want to use a custom repo.

I thing the “dependencies” part works well (if I change to a existing maven element it woks fine), but the “repositories” part doesn’t work like this, at least with jitpack.


#4

While writing nativescript-blur plugin, I used something like this

repositories {
    maven {
        url "https://jitpack.io"
    }
}


dependencies {
    compile 'com.wonderkiln:blurkit:1.0.0'
}

It worked fine for me.


#5

Thanks, it works know!
It was an issue on configuring the native plugin graddle file…


#6

Glad that it worked for you :slight_smile:
Happy NativeScripting!