1
votes

for sharing our libraries inside our android team, I tried to setup JFrog Artifactory OSS. Every thing was OK except my team mates can not access the repositories thru our local network.

To deploy repository I add this line to my library's gradle
in my library build.gradle

dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.9.1"
    }

in my module build.gradle

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'

def libraryGroupId = 'com.mycomp.mylib'
def libraryArtifactId = 'mylib'
def libraryVersion = '1.0.0'
...
publishing {
    publications {
        aar(MavenPublication) {
            groupId libraryGroupId
            version libraryVersion
            artifactId libraryArtifactId

            artifact("$buildDir/outputs/aar/${artifactId}-release.aar")
        }
    }
}

artifactory {
    contextUrl = 'http://10.220.2.2:8081/artifactory'
    publish {
        repository {
            repoKey = 'libs-release-local'

            username = artifactory_username
            password = artifactory_password
        }
        defaults {
            publications('aar')
            publishArtifacts = true
            properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
            publishPom = true
        }
    }

and Executing tasks 'assembleRelease artifactoryPublish'... is successful:

Deploying artifact: http://10.220.2.2:8081/artifactory/libs-release-local/com/mycomp/mylib/mylib/1.0.0/mylib-1.0.0.aar
Deploying artifact: http://10.220.2.2:8081/artifactory/libs-release-local/com/mycomp/mylib/mylib/1.0.0/mylib-1.0.0.pom

But when we try to get the library it will fail

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.mycomp.mylib:mylib:1.0.0.
Show Details
Affected Modules: app

in my project build.gradle

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "http://10.220.2.2:8081/artifactory/libs-release-local"
            credentials {
                username = "${artifactory_username}"
                password = "${artifactory_password}"

            }
        }
    }
}

in my module build.gradle

implementation "com.mycomp.mylib:mylib:1.0.0"

if I change the IP to localhost it will work for my self just fine, but the problem still exist!

UPDATE:
Repository on the Artifactory web UI screenshots:
libs-release-local
library

1

1 Answers

0
votes

Can your teammates access this ip? try running from their machines

ping 10.220.2.2

Then try accessing the UI from their machines, go to http://10.220.2.2:8081/artifactory

If they can not access it, then this is an internal network issue. Maybe you are not on the same machines? Also possible that you have a firewall on your machine that does not allow accessing port 8081.

On what Operating System you are running?