Adding local .aar files to my gradle build - android

So I have created an Android library and successfully compiled it into a .aar file. I called this aar file: "projectx-sdk-1.0.0.aar". Now I want my new project to depend on this aar so what I have done is follow this post.
But the post confuses me since I do not get the desired result:
The package name of the aar is : com.projectx.photosdk and the module inside is called sdk
Here is my current project structure:
|-SuperAwesomeApp
|--.idea
|--gradle
|--App
|---aars
|----projectx-sdk-1.0.0.aar
|---build
|---jars
|---src
|---build.gradle
And here is my Gradle build file:
apply plugin: 'android'
buildscript {
repositories {
mavenCentral()
flatDir {
dirs 'aars'
}
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:gridlayout-v7:19.0.1'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.android.support:appcompat-v7:19.0.1'
compile 'com.projectx.photosdk:sdk:1.0.0#aar'
// compile files( 'aars/sdk-1.0.0.aar' ) // Does not work either
}
EDIT
The errors I am getting:
Failed to refresh Gradle project 'SuperAwesomeApp'
Could not find com.projectx.photosdk:sdk:1.0.0.
Required by:
SuperAwesomeApp:App:unspecified

You put your flatDir block in the wrong repostories block. The repositories block inside buildscript tells Gradle where to find the Android-Gradle plugin, but not the rest of the dependencies. You need to have another top-level repositories block like this:
repositories {
mavenCentral()
flatDir {
dirs 'aars'
}
}
I tested this and it works okay on my setup.

With recent versions of Android Studio, tested with 1.3, to use local .AAR file and not one fetched from maven/jcenter repository, just go to File > New > New module and choose Import .JAR/.AAR Package.
What you will end up with is a new module in your project that contains very simple build.gradle file that looks more or less like this:
configurations.create("default")
artifacts.add("default", file('this-is-yours-package-in-aar-format.aar'))
Of course, other projects have to reference this new module with regular compile project directive. So in a project that uses this new module which is simple a local .aar file has this in it's build.gradle
[...]
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
[...]
compile project(':name-of-module-created-via-new-module-option-described-above')
}
[...]

In Android Studio 3.1.3 with gradle 3.0.1.
Simply adding implementation fileTree(dir: 'libs', include: ['*.aar']) or implementation files('libs/app-release.aar') without any other flatdir works.

These days (over 1 year after this question) with Android Studio >1.0, local dependency does work properly:
The android sdk looks for dependencies in a default local repo of: $ANDROID_HOME/extras/android/m2repository/
In a local library project you can publish the aar to this directory. Here's a snippet that can be added to your module's build.gradle file (ex: sdk/build.gradle)
apply plugin: 'maven'
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://localhost" + System.getenv("ANDROID_HOME")
+ "/extras/android/m2repository/")
pom.version = '1.0-SNAPSHOT'
pom.groupId = 'your.package'
pom.artifactId = 'sdk-name'
}
}
}
some reference gradle docs http://gradle.org/docs/current/userguide/artifact_management.html
In your library project, run ./gradlew uploadArchives to publish the aar to that directory
In the application project you want to use the library in, add the dependency to your project/app/build.gradle. compile 'your.package:sdk-name:1.0-SNAPSHOT'
For local dependency, the next gradle build should find the previously deployed archive and that's it!
In my case, I use the above for local dev, but also have a Bamboo continuous integration server for the Library that publishes each build to a shared Nexus artifact repository. The full library code to deploy the artifact then becomes:
uploadArchives {
repositories {
mavenDeployer {
if (System.getenv("BAMBOO_BUILDNUMBER") != null) {
// Deploy to shared repository
repository(url: "http://internal-nexus.url/path/") {
authentication(userName: "user", password: "****")
}
pom.version = System.getenv("BAMBOO_BUILDNUMBER")
} else {
// Deploy to local Android sdk m2repository
repository(url: "file://localhost" + System.getenv("ANDROID_HOME")
+ "/extras/android/m2repository/")
pom.version = '1.0-SNAPSHOT'
}
pom.groupId = 'your.package'
pom.artifactId = 'sdk-name'
}
}
}
In order to tell applications to download from my internal Nexus repository, I added the internal Nexus maven repository just above jcenter() in both "repositories" blocks in the project/build.gradle
repositories {
maven {
url "http://internal-nexus.url/path/"
}
jcenter()
}
And application dependency then looks like compile 'your.package:sdk-name:45' When I update the 45 version to 46 is when my project will grab the new artifact from the Nexus server.

With the newest Gradle version there is now a slightly updated way of doing what Stan suggested (see maving publishing)
apply plugin: 'maven-publish'
publishing {
publications {
aar(MavenPublication) {
groupId 'org.your-group-id'
artifactId 'your-artifact-id'
version 'x.x.x'
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
}
}
repositories {
maven {
url("file:" + System.getenv("HOME") + "/.m2/repository")
}
}
}

It seems adding .aar files as local dependency is not yet supported(Planned to be supported in 0.5.0 Beta)
https://code.google.com/p/android/issues/detail?id=55863
But the way you are using your library in dependency will only work if your library is on central maven repository or in the local maven repository.
Refer this for How to use local maven repository to use .aar in module dependencies.
http://www.flexlabs.org/2013/06/using-local-aar-android-library-packages-in-gradle-builds

This is for Kotlin DSL (build.gradle.kts) assuming you put the files in my-libs subdirectory relative to where the build file is located:
dependencies {
implementation(
fileTree("my-libs/") {
// You can add as many include or exclude calls as you want
include("my-first-library.aar")
include("another-library.aar")
// You can also include all files by using a pattern wildcard
include("*.jar")
exclude("the-bad-library.jar")
}
)
// Other dependencies...
}
For more ways to do this, see Gradle documentations and this post and this post.

Related

How to use local aar inside flutter plugin?

I've create a flutter plugin with:
flutter create --template plugin flutter_plugin
I've put my aar file inside flutter_plugin/android/src/main/libs folder
I've modified flutter_plugin/android/build.gradle
and changed rootProject.allprojects section to
rootProject.allprojects {
repositories {
google()
jcenter()
flatDir {
dirs "src/main/libs"
}
}
}
And added dependencies section, after android {}:
dependencies {
implementation (name:"mylib",ext:"aar")
}
but when i try running with: flutter run
I get gradle exception, apparently it tried to look for my mylib.aar inside example directory: example/src/main/libs/mylib.aar and failed.
I can put my lib inside example dir, but i don't think it's the right way,
as i want my aar to be part of the plugin.
My solution to add local .aar depencies to a flutter plugin is as follows (based on the instructions here How to add .aar dependency in library module?):
create a libs folder in your android plugin source code (<plugin_name>/android/libs) (on top level of your plugin, not in the example project)
add your .aar files in this folder (e.g. myFirstDependency.aar)
add your .aar dependencies (without the .aar extension) to your plugins build.gradle file (<plugin_name>/android/build.gradle) e.g.
dependencies {
...
implementation (name: 'myFirstDependency', ext: 'aar')
implementation (name: 'myOtherDependency', ext: 'aar')
}
in order for gradle to be able to find these dependencies you need to instruct gradle to search in the libs folder inside of the plugin. Therefore add the following to your plugins build.gradle (<plugin_name>/android/build.gradle, same as for your dependencies) under rootProject.allprojects repositories section.
(NOTE: there is also a buildscripts a repositories section which you should not change for this).
rootProject.allprojects {
repositories {
google()
jcenter()
//Add this below <plugin_name> is whatever your plugin is called eg. url_launcher
flatDir {
dirs project(':<plugin_name>').file('libs')
// e.g. dirs project(':url_launcher').file('libs') - don't miss the ':'
}
}
}
With that, you don't have the .aar library dependencies directly in your plugin.
I created a libs directory in the android directory of my plugin. I placed the aar I generated in the libs directory:
I updated the build.gradle file for the android code to include the following:
rootProject.allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
And in the dependencies section:
implementation fileTree(dir: 'libs', include: ['*.aar'])
In my experience, adding direct plugin aar in another plugin project (flutter plugin's android project) is either very difficult or not allowed, so in that case, you have two options,
If your aar dependancy is available on gradle, use gradle that in your build file. You can search for it here
Or if you are building aar yourself from another project, then you can publish aar to your local maven and use that dependency in your flutter plugin by adding "mavenLocal()" to your plugins build file.
For example here is what I did to fix same issue:
My dependancy's build.gradle
group 'com.companyname.artifactname'
version '1.0-SNAPSHOT'
buildscript {
repositories {
mavenLocal()
google()
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
apply plugin: 'com.android.library'
uploadArchives {
repositories {
mavenLocal()
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "2.0.1"
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
apply plugin: 'maven-publish'
publishing {
publications {
library(MavenPublication) {
version "1.1"
artifact(bundleRelease)
}
}
}
Then just run following command to publish it to local maven repository
gradlew publishToMavenLocal
And then just add mavenLocal() in your flutter plugin's repositories section and add dependancy as
compile 'com.companyname.artifactname:libraryname:1.1#aar'
With the flatDir solution you will get a warning when you try to sync your project with the Gradle files:
using flatDir should be avoided because it doesn't support any meta-data formats.
You can put this in your build.gradle instead to get rid of the warning:
android {
sourceSets {
main.jniLibs.srcDirs += project(':<plugin_name>').file('libs')
}
}
dependencies {
implementation files('libs/<dependency_name>.aar')
}
Unfortunately, with both solutions you'll get this error when you try to build the project:
Direct local .aar file dependencies are not supported when building an AAR.
The resulting AAR would be broken because the classes and Android resources from any local .aar
file dependencies would not be packaged in the resulting AAR. Previous versions of the Android
Gradle Plugin produce broken AARs in this case too (despite not throwing this error).
The accepted answer seems to be correct. I put the library inside the app's project instead because both options of the accepted answer were not possible in my case.
For this I had to create a new directory in the android directory of my app (i.e. example/android/<dependency_name>) and put my .aar file and a new build.gradle in that directory.
android/build.gradle:
dependencies {
implementation project(':<dependency_name>')
}
example/android/<dependency_name>/build.gradle:
configurations.maybeCreate("default")
artifacts.add("default", file('<dependency_name>.aar'))
example/android/settings.gradle:
include ':<dependency_name>'
i managed to make it work by adding
maven { url("${project(':test_flutter_plugin').file('libs').path}/my_lib") }
into rootProject.allprojects
of plugin/android/build.gradle

Gradle Could not find method compile() for arguments

i have a hello world full screen android studio 1.5.1 app that i added a gradle/eclipse-mars subproject to. no other files were modified except for adding include ':javalib' to settings.gradle. adding a project lib dependency:
project(':app') {
dependencies {
compile project(':javalib') // line 23
}
}
to the root build build file and running gradle from the command line , gets:
Where:
Build file 'D:\AndroidStudioProjects\AndroidMain\build.gradle' line: 23
What went wrong:
A problem occurred evaluating root project 'AndroidMain'.
Could not find method compile() for arguments [project ':javalib'] on org.grad
le.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated#46
3ca82f.
adding the java plugin to the root build file did not help.
i don't think it's in the wrong place.
both the root project and the added subproject have the gradle wrapper.
any pointers will be appreciated.
thanks
edit: for clarification, the root build file is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
task hello << { task -> println "I'm $task.project.name" }
}
project(':app') {
dependencies {
//compile project(':javalib') // causes problems
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and the app build file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "acme.androidmain"
minSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile project(':javalib') // use :javalib:jar?
//testCompile project(':javalib')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
}
edit: the whole purpose of this exercise is to get core java code into an android project. currently the core code is a standalone gradle/eclispe project. i have a batch in the android project that does a gradle -p standaloneprojectdir/ jar and copied the jar into libs/.
i just though there would be an easier way other than to publish the jar and get it from a repository since this all done on my pc.
it would be nice to have all the code live and just do a build :(
edit: as per RaGe's suggestion, here is a virgin android studio project and a virgin gradle/eclipse project. no editing has been done to these files. you mission should you choose to accept it is to get the android app to easily access the java project classes (i.e. new Library(); in MainActivity.onCreate() will compile and run). i don't care where the java project lives. ideally, both sources would be live in both ide's.
atempting this fails also. says: > Could not find :virginjavaproject, but directory does exist.
edit: what actually worked was RaGe's pull request to the virgin android project.
You already have
compile project(':javalib')
in your :app project, you don't have to also inject the dependency from your root build.gradle. If you still want to do it from the root build.gradle, the correct way to do it is:
configure(':app') {
dependencies {
compile project(':javalib') // causes problems - NOT ANYMORE!
}
}
the virgin android studio head is what worked.
We have 2 files named "build.gradle".
make sure you have copied your "compile code" in the build.gradle file that is inside "app" folder
As stated by #peter-niederwieser:
The build script is mixing up buildscript dependencies (i.e. dependencies of the build itself; typically this means Gradle plugins) with regular dependencies (i.e. dependencies of the code to be compiled/run). The latter need to go into dependencies { ... }, not into buildscript { dependencies { ... } }. Everything but the classpath dependencies are regular dependencies.
Also have a look at this: Could not find method compile() for arguments Gradle.
Simply paste this on build.gradle(Project:"Your prject name")
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I had this problem but with my own library. The way to correctly compile was:
compile project(path: ':MyLib')

configuration issue. "Configuration with name 'default' not found"

I am relatively new to Android development and VERY new to Android Studio (much more experienced with Eclipse + android plugin). I am trying to edit a github project, but I can't seem to get it to even compile! I have been reading up, and my error seems to have to do with the build.gradle/locations of libraries themselves.
My error is:
Error:Configuration with name 'default' not found.
It also says "Gradle project sync failed, but I think its related to the above error…whatever that means.
My outer build.gradle is:
// Top-level build file where you can add configuration options common to all sub- projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
And my inner build.gradle file is:
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
defaultConfig {
applicationId "com.wisely.loyalty"
minSdkVersion 14
targetSdkVersion 18
versionCode 17
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':facebook')
compile project(':cwac')
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
compile('org.apache.httpcomponents:httpmime:4.3.5') {
exclude module: "httpclient"
}
compile 'com.android.support:support-v13:20.0.0'
compile 'com.google.android.gms:play-services:5.0.+'
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
compile 'com.makeramen:roundedimageview:1.3.0'
compile 'com.crashlytics.android:crashlytics:1.+'
}
EDIT:
General file hierarchy
root
.idea
app
libs
cwac
fb
utils
src
… all source files
gradle
build.gradle
settings.gradle
External Libraries
Android API 20 Platform
JDK
EDIT: Settings.gradle:
include ':app', ':facebook', ':cwac', ':utils'
project(':facebook').projectDir = new File('app/libs/facebook')
project(':cwac').projectDir = new File('app/libs/cwac')
project(':utils').projectDir = new File('app/libs/utils')
Progress Update:
I've tried moving the library files around in the directory to no avail. I also tried using my eclipse environment which just seemed to have even more issues. I really need to get this project configured properly!
UPDATE #2:
I have a strong feeling that this has to do with the gradle version since the file configuration seems fine, and its likely my computer that is lacking something. I am new to using gradle. Is there a way to update it? Or is it simply updated through the support libraries in the sdk manager?
Add your library folder in your root location of your project and copy all the library files there. For ex YourProject/library then sync it

Android TDD: The saga continues with Robolectric & Gradle

Just when I'd achieved an effective development and build environment with the android-maven-plugin, the new kid on the block, Gradle, starts making inroads into the Android circles. Not being hot on Groovy and with the android-gradle plugin almost as fragmented as the OS itself I've hit some issues. Specifically around building library projects, with flavours and our buddy Robolectric.
Short version
I am at a loss as to what my next move should be upon encountering the gradle error;
Cannot add a SourceSet with name 'testDebug' as a SourceSet with that name already exists.
The error emanates from having productFlavours on a library (i.e. moving to the 0.9.2 android build system) and the gradle-android-test-plugin recently forked by the team over at Robolectric from Jake's creation (see here). I have followed all lines of investigation to near exhaustion and can report that the meer existence of the 'android-test' plugin within my library gradle file sends things awry.
Longer version
Here is the abridged application build.gradle file with pertinent information retained;
apply plugin: 'android-library'
apply plugin: 'android-test'
...
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 18
targetSdkVersion 19
versionCode buildNumber().toInteger()
versionName "1.0.0"
}
productFlavors {
estimote {
dependencies {
compile '<flavour specific dependency>'
}
}
radius {
dependencies {
compile '<flavour specific dependency>'
}
}
}
}
...
dependencies {
compile 'com.squareup.dagger:dagger:1.2.1'
compile 'com.squareup.dagger:dagger-compiler:1.2.1'
compile 'com.google.code.gson:gson:2.2.+'
// Testing dependencies
androidTestCompile 'org.mockito:mockito-core:1.9.5'
androidTestCompile 'com.squareup:fest-android:1.0.7'
androidTestCompile 'org.hamcrest:hamcrest-all:1.3'
androidTestCompile 'org.robolectric:robolectric:2.2'
androidTestCompile 'junit:junit:4.11'
}
And here is the abridged root build.gradle file.
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.2'
classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.9.+'
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
}
If you've got this far down the page, give yourself a pat on the back. Now, the eagle eyed amongst you have probably noticed the omission on the sourceSets redirection with commands akin to;
sourceSets {
androidTest {
setRoot('src/test')
}
}
After the initial error is corrected these lines will need to be reinstated to inform gradle of the project's structure. The project's structure is standard and looks like;
- project_name
+ gradle
- lib
+ flavour1
+ flavour2
- main
+ java
- test
+ java
build.gradle
build.gradle
gradle.properties
settings.gradle
What is being used
The app is using gradle-1.10-all, 0.9.2 android-gradle plugin and 0.9.+ gradle-android-test-plugin.
The question
How should the project be set-up/changed to facilitate Robolectric testing on a library with flavours? Is this even possible yet?
I ran into the same issue, dug into the code, fixed it, and submitted a pull request which has just now been merged. See my explanation on the PR for details, but it boils down to a bad optimization in the plugin code:
https://github.com/robolectric/robolectric-gradle-plugin/pull/70
As of today you need to clone the repo and build and install the plugin to your local maven repo. The next time they do a release to maven central (perhaps release 0.13.1?), you'll be able to use the plugin directly from there.

Maven uploadArchives (aar) to GitLab Maven Repository

I am using gradle to generate Android Library Archive (aar) and now want to deploy directly to Git Maven Repo. I have successfully generated it to local file system but problem occurs when I try to deploy to GitLab repo directly.
Note that GitLab repository is public and once I generate Android Library Archive (aar) to local git location (file system) and push it, I can add dependency in other Android projects and it works fine.
build.gradle
apply plugin: 'android-library'
apply plugin: 'android-maven'
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
//for using HTTP url obtained from GitLab
classpath 'org.apache.maven.wagon:wagon-http:2.2'
}
}
install {
repositories.mavenInstaller {
pom.groupId = 'com.company.android'
pom.artifactId = 'androidcommons'
pom.version = '0.1.1'
}
}
uploadArchives {
repositories {
mavenDeployer {
//HTTP url obtained GitLab
repository(url: "http://beans.infra.company.com/<group>/<project>/raw/maven-repo/releases/")
pom.groupId = 'com.company.android'
pom.artifactId = 'androidcommons'
pom.version = '0.1.1'
}
}
}
When I run gradle clean install uploadArchives I get this error:
Error deploying artifact: Resource to deploy not found: File: http://beans.infra.company.com/<group>/<project>/raw/maven-repo/releases/com/company/android/androidcommons/0.1.1/androidcommons-0.1.1.aar does not exist
It seems to me that repository url is being treated as File instead of HTTP url. I've looked up at gradle docs and the only information available is that I need to include 'org.apache.maven.wagon:wagon-http:2.2' in dependencies to be treated as HTTP instead of File, which I already am. Any help in this regard would be appreciated.

Categories

Resources