添加依赖项时出错

时间:2016-05-16 06:55:50

标签: android android-studio android-gradle applozic

我正在尝试添加

 compile 'com.applozic.communication.uiwidget:mobicomkitui:3.38'

在build.gradle中的依赖项下,但是它给出了以下错误 Here is the whole logcat

我添加了

include 'com.applozic.communication.uiwidget:mobicomkitui:3.38'
在settings.gradle中

请帮助,我是这些东西的新手。 我尝试实施项目的链接是here 这是build.gradle(module:app)

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
packagingOptions{

    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/ECLIPSE_.SF'
    exclude 'META-INF/ECLIPSE_.RSA'


}

defaultConfig {
    applicationId "com.urjapawar.bevyphase1"
    minSdkVersion 14
    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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.applozic.communication.uiwidget:mobicomkitui:3.38'

}

这里是build.gradle(module:project)

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'

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

allprojects {
  repositories {
    mavenCentral()
   }
  }

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

这是清理项目后的日志

Error:A problem occurred configuring project ':app'.
  

无法解析配置':app:_debugCompile'的所有依赖项。   找不到com.applozic.communication.uiwidget:mobicomkitui:3.38。        在以下位置搜索:            https://repo1.maven.org/maven2/com/applozic/communication/uiwidget/mobicomkitui/3.38/mobicomkitui-3.38.pom            https://repo1.maven.org/maven2/com/applozic/communication/uiwidget/mobicomkitui/3.38/mobicomkitui-3.38.jar            文件:/ C:/Users/DELL/AppData/Local/Android/sdk/extras/android/m2repository/com/applozic/communication/uiwidget/mobicomkitui/3.38/mobicomkitui-3.38.pom            文件:/ C:/Users/DELL/AppData/Local/Android/sdk/extras/android/m2repository/com/applozic/communication/uiwidget/mobicomkitui/3.38/mobicomkitui-3.38.jar            文件:/ C:/Users/DELL/AppData/Local/Android/sdk/extras/google/m2repository/com/applozic/communication/uiwidget/mobicomkitui/3.38/mobicomkitui-3.38.pom            文件:/ C:/Users/DELL/AppData/Local/Android/sdk/extras/google/m2repository/com/applozic/communication/uiwidget/mobicomkitui/3.38/mobicomkitui-3.38.jar        要求:            BevyPhase1:应用程序:未指定的

2 个答案:

答案 0 :(得分:2)

转到项目的build.gradle文件,然后添加jcenter()

 buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.1.0'
            classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
            //classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
           // classpath 'com.github.dcendents:android-maven-plugin:1.2'
            classpath 'com.novoda:bintray-release:0.3.4'

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

    allprojects {
        repositories {
            jcenter()
        }
    }

来源: https://github.com/AppLozic/Applozic-Android-SDK/blob/master/build.gradle

答案 1 :(得分:1)

repositories {
    mavenCentral()
}

 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 'com.applozic.communication.uiwidget:mobicomkitui:3.39'
}