[英]How can i add dependencies in Android Astudio
我想将此依赖项compile 'com.github.ar-android:DrawRouteMaps:1.0.0'
到我的Android Studio项目中。
当将此添加到依赖项并单击“同步”时,显示此错误:
Error:(39, 13) Failed to resolve: com.github.ar-android:DrawRouteMaps:1.0.0
<a href="openFile:G:/Android/Projects/1-MapTutorial/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
build.gradle代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.example.mohammadn.a1_maptutorial"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.android.gms:play-services-maps:9.2.1'
testCompile 'junit:junit:4.12'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.github.ar-android:DrawRouteMaps:1.0.0'
}
如何修复它并将该库添加到我的依赖项中?
在存储库末尾的根build.gradle
中添加支持jitpact存储库:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
阅读有关DrawRouteMaps的官方指南。
尝试将以下行添加到project / build.gradle (不是app / build.gradle)
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
app / build.gradle
compile 'com.github.ar-android:DrawRouteMaps:1.0.0'
首先,您必须在项目中添加Maven存储库:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
然后,在build.gradle
模块应用程序中添加依赖build.gradle
:
dependencies {
compile 'com.github.ar-android:DrawRouteMaps:1.0.0'
}
将此添加到您的项目:build.gradle文件到此
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
除了以上注释之外,您还可以在文件->项目结构->添加-> +(加号)->添加库中添加依赖项
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.