2016-04-24 126 views
2

我写了一个库,并试图在项目中设置gradle依赖项。从这个网站上的教训:http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
一切顺利,在网站上注册,创建一个存储库,创建并保存密钥。但是当他转移到项目中的文件时就犯了错误。
下面是截图: My repo on Bintray
版本中创建自己通过网站
我的项目gradle这个文件:尝试添加库到gradle

// 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' 
     classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4' 
     classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' 
     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
// Plugin used to upload authenticated files to BinTray through Gradle 
plugins { 
    id "com.jfrog.bintray" version "1.5" 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

我的图书馆gradle这个文件:

apply plugin: 'com.android.library' 

ext { 
    bintrayRepo = 'maven' 
    bintrayName = 'AnimLib' 
    publishedGroupId = 'diplom.itis.animationlib' 
    libraryName = 'animlib' 
    artifact = 'animlib' 
    libraryDescription = '' 
    siteUrl = 'https://github.com/metalink94/AnimationLib' 
    gitUrl = 'https://github.com/metalink94/AnimationLib.git' 
    libraryVersion = '0.9.0' 
    developerId = 'metalink94' 
    developerName = 'Denis' 
    developerEmail = '[email protected]' 
    licenseName = 'The Apache Software License, Version 2.0' 
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 
    allLicenses = ["Apache-2.0"] 
} 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     minSdkVersion 14 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     group = 'diplom.itis.animationlib' // Change this to match your package name 
     version = '0.9.0' // Change this to match your version number 

    } 

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

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    apply plugin: 'com.jfrog.bintray' 
    apply plugin: 'com.github.dcendents.android-maven' 
    apply plugin: 'com.android.library' 

} 
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' 
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle' 

我的应用程序模块gradle这个文件:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

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

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.0.1' 
    compile 'com.android.support:recyclerview-v7:23.0.1' 
    compile 'com.github.clans:fab:1.6.1' 
    compile 'com.jakewharton:butterknife:7.0.1' 
    compile 'com.github.wangjiegulu:AndroidInject:1.0.6' 
    compile 'com.github.bumptech.glide:glide:3.6.1' 
    compile 'com.alexvasilkov:android-commons:1.2.4' 
    compile 'diplom.itis.animationlib:animlib:0.9.0' 
    //compile project(':animlib') 
} 

An d我的错误,当我尝试同步gradle: enter image description here

请有人帮助我,告诉我我哪里得到错误?

UPDATE
我没有你(Fondesa)强调在左下角 enter image description here

回答

0

你做的过程是正确的,你可以做的还是两件事情,我会后的截图为了更好地解释它:

enter image description here

  1. 检查你的依赖链接教育署jCenter,你可以在你的项目的右下侧部分找到按钮一般设置

  2. 检查你的依赖声明diplom.itis.animationlib:animlib:0.9.0build.gradle文件与一个我在截图的左下部分强调匹配。

+0

更新我的问题,我无法找到你在底部强调什么left..in我的包 – metalink

+0

@metalink打开Bintray您的0.9.0库走“文件”选项卡上,导航到文件夹中,你能找到一个带有“.pom”扩展名的文件吗? –