未包括的Maven库到Android工作室 [英] Failing to include libraries by Maven to Android studio
问题描述
我有我想改变使用Maven包括OSMDroid,而不是本地依赖性库的项目。根据 OSM的Droid教程我需要包括以下依存关系:
I have a project which I want to change to use Maven to include the libraries for OSMDroid instead of local dependencies. According the OSM Droid tutorial I need to include the following dependencies:
dependencies {
compile 'org.osmdroid:osmdroid-android:4.2'
compile 'org.slf4j:slf4j-simple:1.6.1'
}
而从这个<一个href=\"http://stackoverflow.com/questions/16595287/how-to-import-maven-dependency-in-android-studio-intellij\">SO帖子我需要添加一行能够通过gradle这个使用Maven:
And from this SO post I need to add a line to be able to use Maven through the gradle:
repositories {
mavenCentral()
}
这让我对模块的基本的build.gradle:应用这样的:
That makes my basic build.gradle for Module: app to this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "se.einarsundgren.anApp"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
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:21.0.3'
compile 'org.osmdroid:osmdroid-android:4.2'
compile 'org.slf4j:slf4j-simple:1.6.1'
}
这导致从摇篮同步错误:
This results in the errors from Gradle sync:
Error:(29, 13) Failed to resolve: org.slf4j:slf4j-simple:1.6.1
Error:(28, 13) Failed to resolve: org.osmdroid:osmdroid-android:4.2
这是当我尝试编译我从摇篮得到错误建:
This is the error I get from Gradle build when I try to compile:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve org.osmdroid:osmdroid-android:4.4.
Required by:
Mappish:app:unspecified
> Could not GET 'https://jcenter.bintray.com/org/osmdroid/osmdroid-android/4.4/osmdroid-android-4.4.pom'.
> peer not authenticated
> Could not GET 'https://repo1.maven.org/maven2/org/osmdroid/osmdroid-android/4.4/osmdroid-android-4.4.pom'.
> peer not authenticated
> Could not resolve org.slf4j:slf4j-simple:1.6.1.
Required by:
Mappish:app:unspecified
> Could not GET 'https://jcenter.bintray.com/org/slf4j/slf4j-simple/1.6.1/slf4j-simple-1.6.1.pom'.
> peer not authenticated
> Could not GET 'https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/1.6.1/slf4j-simple-1.6.1.pom'.
> peer not authenticated
因为我既Maven和到摇篮的细节一个新手,这可能是一个简单的错误。但我不知道为什么这是行不通的。
This might be an easy error since I'm a newbie both to Maven and to the details of Gradle. But I have no idea why this is not working.
推荐答案
什么解决的问题是一样的<建议href=\"http://stackoverflow.com/questions/26675814/gradle-could-not-head-https-pom-peer-not-authenticated\">this问题
我改变了库
标签:
What resolved the problem was the same as suggested in this question
I changed the repositories
tag to:
repositories {
mavenCentral()
jcenter {
url "http://jcenter.bintray.com/"
}
}
这篇关于未包括的Maven库到Android工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!