简体   繁体   English

Problen添加依赖Android Studio

[英]Problen add dependency android studio

I posted my library in Artifactory 我将图书馆张贴在Artifactory

https://imagizer.imageshack.us/v2/806x253q90/631/kkK1Yn.png https://imagizer.imageshack.us/v2/806x253q90/631/kkK1Yn.png

this is my Gradle 这是我的摇篮

buildscript {
repositories {
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle',    
    version: '3.0.1')
    }
}

repositories {
    jcenter()
    mavenCentral()
    mavenLocal()
    maven {
       url 'http://myartifactory:8081/artifactory/gradle-local'
    }
}

apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.android.library'
apply plugin: 'android-apt'
def AAVersion = '3.2'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

sourceSets {
    main {
    }

}

dependencies {
   compile fileTree(include: ['*.jar', '*.so'], dir: 'libs')
   compile 'com.android.support:recyclerview-v7:21.0.+'
   compile 'com.android.support:appcompat-v7:21.0.+'
   compile 'com.android.support:support-v4:21.0.+'
   compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
   compile 'de.greenrobot:eventbus:2.4.0'
   compile 'com.github.chrisbanes.photoview:library:1.2.3'
   compile 'it.sephiroth.android.exif:library:+'
   compile 'com.joanzapata.android:android-iconify:1.0.8'
   compile 'com.android.support:cardview-v7:21.0.+'
   compile 'com.afollestad:material-dialogs:0.6.0'
   compile 'com.github.lzyzsd:circleprogress:1.0.1@aar'
   apt "org.androidannotations:androidannotations:$AAVersion"
   compile "org.androidannotations:androidannotations-api:$AAVersion"
   compile(group: 'com.mylibrary.android.common', name: 'android.common', version: '1.0.0', ext: 'aar')
}
apt {
   arguments {
      androidManifestFile variant.outputs[0].processResources.manifestFile

      resourcePackageName 'com.mypackage.library'


   }
}

I get this error 我得到这个错误

https://imagizer.imageshack.us/v2/519x72q90/540/8ojerK.png https://imagizer.imageshack.us/v2/519x72q90/540/8ojerK.png

Gradle I found that running the route using the url wrong use "/" instead of "." 我发现Gradle使用url运行路线错误,使用“ /”而不是“。”。

Try to find 尝试去找

...8081/artifactory/repo/com/mypackage/android/common/android.common/1.0.0/android.common-1.0.0.aar ... 8081 / artifactory的/回购/ COM / mypackage中/安卓/普通/ android.common / 1.0.0 / android.common-1.0.0.aar

but should be 但应该是

...8081/artifactory/repo/com.mypackage.android.common/android.common/1.0.0/android.common-1.0.0.aar ... 8081 / artifactory的/回购/ com.mypackage.android.common / android.common / 1.0.0 / android.common-1.0.0.aar

I'm doing wrong, wrong as was published in the artefactory 我做错了,是错误的

Your artifact is not complaint to the standard Maven layout, in which the groupId should be separated by / , not by . 您的工件不是抱怨标准的Maven布局,在该布局中,groupId应该用/而不是用分隔. .

It's not a big deal, Gradle can handle it easly, you just can't declare the repository as maven , but as ivy instead. 没什么大不了的,Gradle可以轻松地处理它,您只是不能将存储库声明为maven ,而是声明为ivy

Actually, it will be easier to use the artifactory plugin for resolution, it also supports both Maven and Ivy layouts. 实际上,使用artifactory插件进行解析会更容易,它也支持Maven和Ivy布局。

Also, please remember to set the repository in Artifactory to be with correct layout (not Maven2, probably Ivy). 另外,请记住将Artifactory中存储库设置为正确的布局 (不是Maven2,可能是Ivy)。

And frankly, I think maybe it worth redeploying the artifact under Maven layout, it will make your life easier. 坦率地说,我认为也许值得在Maven布局下重新部署工件,这将使您的生活更轻松。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM