build.gradle에 maven 저장소 추가
Android Studio에서 build.gradle에 사용자 정의 maven 저장소를 추가했지만 종속성을 찾을 수 없습니다
메이븐 리포지토리 및 종속성
<repository>
<id>achartengine</id>
<name>Public AChartEngine repository</name>
<url>https://repository-achartengine.forge.cloudbees.com/snapshot/</url>
</repository>
<dependency>
<groupId>org.achartengine</groupId>
<artifactId>achartengine</artifactId>
<version>1.2.0</version>
</dependency>
build.gradle
buildscript {
repositories {
mavenCentral()
maven {
url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile group: 'org.achartengine', name: 'achartengine', version: '1.2.0'
}
android {
compileSdkVersion 19
buildToolsVersion "19"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
Android Studio의 오류 메시지 :
A problem occurred configuring root project 'My-MobileAndroid'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':_DebugCompile'.
> Could not find org.achartengine:achartengine:1.2.0.
Required by:
:My-MobileAndroid:unspecified
build.gradle에서 무엇을 놓치고 있습니까?
외부에서 저장소를 정의해야합니다 buildscript
. buildscript
구성 블록은 단지 빌드 스크립트의 클래스 경로가 아닌 응용 프로그램에 대한 저장소 및 종속성을 설정합니다.
후
apply plugin: 'com.android.application'
이것을 추가해야합니다 :
repositories {
mavenCentral()
maven {
url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
}
}
@Benjamin이 이유를 설명했습니다.
인증 된 maven이 있다면 다음을 사용할 수 있습니다.
repositories {
mavenCentral()
maven {
credentials {
username xxx
password xxx
}
url 'http://mymaven/xxxx/repositories/releases/'
}
}
순서가 중요합니다.
안드로이드 스튜디오 사용자 :
If you want to use grade, go to http://search.maven.org/ and search for your maven repo. Then, click on the "latest version" and in the details page on the bottom left you will see "Gradle" where you can then copy/paste that link into your app's build.gradle.
You have to add repositories
to your build file. For maven repositories you have to prefix repository name with maven{}
repositories {
maven { url "http://maven.springframework.org/release" }
maven { url "http://maven.restlet.org" }
mavenCentral()
}
Add the maven repository outside the buildscript
configuration block of your main build.gradle
file as follows:
repositories {
maven {
url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
}
}
Make sure that you add them after the following:
apply plugin: 'com.android.application'
참고URL : https://stackoverflow.com/questions/20574111/add-maven-repository-to-build-gradle
'IT박스' 카테고리의 다른 글
Knockoutjs와 트위터 부트 스트랩 자동 완성 드롭 다운 / 콤보 박스 (0) | 2020.08.03 |
---|---|
Intellij IDEA에서 텍스트를 새 줄로 바꾸려면 어떻게합니까? (0) | 2020.08.03 |
인증서를 가져온 후 Java Keytool 오류, "keytool 오류 : java.io.FileNotFoundException & 액세스 거부" (0) | 2020.08.03 |
URL / 전화 클릭 가능 UILabel을 만드는 방법은 무엇입니까? (0) | 2020.08.03 |
ActiveMQ는 무엇에 사용됩니까? (0) | 2020.08.03 |