Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle: how to include dependencies from repositories to output aar file [duplicate]

I am trying to build an arr package in Android Studio. This package contains dependecies for Zendesk:

allprojects {
    repositories {
        maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
    }
}

compile (group: 'com.zendesk', name: 'sdk', version: '1.7.0.1') {
    transitive = true
}

compile (group: 'com.zopim.android', name: 'sdk', version: '1.3.1.1') {
    transitive = true
}

I want to build this package for a Unity3d project. This package should contain all dependecies for Zendesk (the transitive = true property). When I open the aar file there is no dependencies for Zendesk. What is wrong?

like image 598
Konstantin Gindemit Avatar asked Aug 15 '16 14:08

Konstantin Gindemit


People also ask

How do you resolve transitive dependencies in Gradle?

A variant of a component can have dependencies on other modules to work properly, so-called transitive dependencies. Releases of a module hosted on a repository can provide metadata to declare those transitive dependencies. By default, Gradle resolves transitive dependencies automatically.

How do you add a dependency in Gradle?

To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build.gradle file.

What is testImplementation in Gradle?

For example the testImplementation configuration extends the implementation configuration. The configuration hierarchy has a practical purpose: compiling tests requires the dependencies of the source code under test on top of the dependencies needed write the test class.

What is flatDir in Gradle?

flatDir(configureClosure) Adds an configures a repository which will look for dependencies in a number of local directories. flatDir(args) Adds a resolver that looks into a number of directories for artifacts. The artifacts are expected to be located in the root of the specified directories.


1 Answers

By default AARs do not include any dependencies. If you want to include them you have to copy these libs from artifactory/your cache folder into your package, either by doing it manually or this task might help you: https://stackoverflow.com/a/33539941/4310905

like image 146
and_dev Avatar answered Sep 17 '22 18:09

and_dev