无法从包含外部存储库的android库中找到依赖项

时间:2017-04-23 14:12:50

标签: android maven gradle android-gradle pom.xml

我创建了一个android库并将其添加到本地Maven存储库中。当尝试将库添加到其他应用程序时,它无法找到具有外部存储库的依赖项。

图书馆gradle

apply plugin: 'com.android.library'
apply plugin: 'realm-android'
apply plugin: "com.tmiyamon.config"
apply plugin: 'maven'

version = "1.1"
group = "com.myApp.lib"

repositories {
    mavenLocal()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo' }
    maven { url 'http://mobile-sdk.jumio.com' }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    debugCompile 'com.uphyca:stetho_realm:2.0.0'
    stagingCompile 'com.uphyca:stetho_realm:2.0.0'
    compile'com.squareup.picasso:picasso:2.5.3-SNAPSHOT'
    compile 'com.jumio.android:core:2.5.0@aar'
    compile 'com.jumio.android:nv:2.5.0@aar'
    compile 'com.jumio.android:nv-mrz:2.5.0@aar'
    compile 'com.jumio.android:nv-barcode:2.5.0@aar'
}


uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "file://${System.env.HOME}/.m2/repository/")
            pom.project {
                repositories {
                    repository {
                        id 'oss-sonatype'
                        url "https://oss.sonatype.org/content/repositories/snapshots/"
                         snapshots {
                             enabled true
                         }

                    }
                    repository {
                        id 'stetho-realm'
                        url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
                    }
                    repository {
                        id 'jumio'
                        url 'http://mobile-sdk.jumio.com'
                    }
                }
            }
        }
    }
}

项目build.gradle

  apply plugin: 'com.android.application'

repositories {
    mavenLocal()
    mavenCentral()
}


android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.test.test.test"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled true
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
    testCompile 'junit:junit:4.12'
    compile('com.myApp.lib:app:1.1')
}

项目顶级Gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}



ext {
    supportLibVersion = "25.3.1"
}

图书馆POM文件

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.myApp.lib</groupId>
  <artifactId>app</artifactId>
  <version>1.1</version>
  <packaging>aar</packaging>
  <dependencies>

    <dependency>
      <groupId>io.realm</groupId>
      <artifactId>realm-annotations</artifactId>
      <version>2.3.0</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>org.apache.oltu.oauth2</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.realm</groupId>
      <artifactId>realm-android-library</artifactId>
      <version>2.3.0</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>org.apache.oltu.oauth2</groupId>
        </exclusion>
      </exclusions>
    </dependency>
      <groupId>com.squareup.picasso</groupId>
      <artifactId>picasso</artifactId>
      <version>2.5.3-SNAPSHOT</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>org.apache.oltu.oauth2</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.jumio.android</groupId>
      <artifactId>core</artifactId>
      <version>2.5.0</version>
      <type>aar</type>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>*</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.jumio.android</groupId>
      <artifactId>nv</artifactId>
      <version>2.5.0</version>
      <type>aar</type>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>*</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.jumio.android</groupId>
      <artifactId>nv-mrz</artifactId>
      <version>2.5.0</version>
      <type>aar</type>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>*</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.jumio.android</groupId>
      <artifactId>nv-barcode</artifactId>
      <version>2.5.0</version>
      <type>aar</type>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>*</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.facebook.stetho</groupId>
      <artifactId>stetho</artifactId>
      <version>1.4.2</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>org.apache.oltu.oauth2</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.facebook.stetho</groupId>
      <artifactId>stetho-okhttp3</artifactId>
      <version>1.4.2</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>org.apache.oltu.oauth2</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.uphyca</groupId>
      <artifactId>stetho_realm</artifactId>
      <version>2.0.0</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>org.apache.oltu.oauth2</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>oss-sonatype</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </repository>
    <repository>
      <id>stetho-realm</id>
      <url>https://github.com/uPhyca/stetho-realm/raw/master/maven-repo</url>
    </repository>
    <repository>
      <id>jumio</id>
      <url>http://mobile-sdk.jumio.com</url>
    </repository>
  </repositories>
</project>

但是当我尝试编译应用程序项目时,我得到了:

  

无法解决:com.jumio.android:nv:2.5.0以及来自这些存储库的所有其他依赖项:

     

maven {url“https://oss.sonatype.org/content/repositories/snapshots/”}

     

maven {url'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'}

     

maven {url'http://mobile-sdk.jumio.com'}

即使我可以在POM文件中看到所有这些存储库。

0 个答案:

没有答案