안녕하세요, 저는 AAR을 생성하는 Android 라이브러리 프로젝트를 보유하고 있습니다.다른 라이브러리에 따라 Android 라이브러리 AAR
모두 좋다하지만 난 다른 프로젝트에서 AAR을 사용할 때이 오류가 얻을 :
java.lang.NoClassDefFoundError: com.squareup.picasso.Picasso
AAR은 가능 하나를 생성 할 때뿐만 아니라 AAR의 종속성을 수출, 피카소를 사용합니다을 ?
안녕하세요, 저는 AAR을 생성하는 Android 라이브러리 프로젝트를 보유하고 있습니다.다른 라이브러리에 따라 Android 라이브러리 AAR
모두 좋다하지만 난 다른 프로젝트에서 AAR을 사용할 때이 오류가 얻을 :
java.lang.NoClassDefFoundError: com.squareup.picasso.Picasso
AAR은 가능 하나를 생성 할 때뿐만 아니라 AAR의 종속성을 수출, 피카소를 사용합니다을 ?
How can one go about setting up a local maven repo.
경고 : 다음과 같은 조리법 작동하지만, 아마 내가 메이븐 전문가로부터 까지 오전으로, 개선을 사용할 수 있습니다. 작년에 CWAC 라이브러리와 함께 사용하기 위해이 접근 방식을 강타했습니다.
1 단계 : 라이브러리 프로젝트의 build.gradle
파일에있는 buildscript
dependencies
블록에 classpath 'com.github.dcendents:android-maven-plugin:1.0'
을 추가하십시오. 또한 version
및 group
진술을 추가하여 AAR에 관한 정보를 제공하십시오.
# 2 : AAR을 컴파일하고 기본 로컬 Maven 저장소에 설치하려면 gradle install
을 사용하십시오.
3 단계 : 일반적으로 응용 프로그램 프로젝트의 dependencies
블록에 mavenLocal()
을 추가하여 이슈 ID를 통해 AAR을 선택합니다. 조금이라도 부러졌지만 다시 작동 할 수도 있습니다. 대신 단기적인 해결 방법으로 maven { url "${System.env.HOME}/.m2/repository" }
을 사용하십시오.
따라서, 예를 들어, 라이브러리 프로젝트 build.gradle
파일이 포함되어있을 수 있습니다 : 당신은 당신의 지역 메이븐의 repo에 JAR를 게시 할 gradle install
을 사용
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
}
}
apply plugin: 'android-library'
apply plugin: 'android-maven'
version '0.4.0'
group 'some.likely.group.name.goes.here'
repositories {
mavenCentral()
}
dependencies {
compile 'com.squareup.picasso:picasso:2.2.0'
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
// as normal
}
. 귀하의 응용 프로그램 프로젝트는 그 build.gradle
에 다음과 같은 물건을 할 것이다 :
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
maven { url "${System.env.HOME}/.m2/repository" } // mavenLocal()
}
dependencies {
compile 'some.likely.group.name.goes.here:name-of-library:0.4.0'
}
android {
// as normal
}
당신은 대체 여기서
some.likely.group.name.goes.here
XYZ 형식의 버전 번호와 뭔가
0.4.0
와
name-of-library
은 다음과 같은 디렉토리 이름이됩니다. Android 라이브러리 프로젝트가 포함되어 있습니다 (예 : presentation
또는 foo
)
나는 아직도이 방법을 사용하고있는 누군가를 위해주의해야 할 중요한 한 가지가 있습니다. 이것은 이후 새로운 버전의 그라데이션으로 업데이트되었습니다. 새로운 GitHub : https://github.com/dcendents/android-maven-gradle-plugin을 방문하여 여기에있는 지침을 사용하여'gradle-wrapper.properties'를 변경하여 gradle이 2.4 이상인지 확인하십시오. http : // tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0 – anddev84
'gradle install' 사용법을 알려주세요? 나는 gradle for java를 윈도우즈에 설치하고'gradle install'을 시도했다.'Task 'install'루트 프로젝트 'bin'에 찾을 수없는 오류가있다. ' –
@WilliamKinaan :이 대답은 2.5 년 전이다. 새로운 솔루션을 찾는 것이 좋습니다. – CommonsWare
다른 프로젝트에서 AAR을 어떻게 사용하고 있습니까? 이처럼 – CommonsWare
: 이것은 가정되는 보통의 groupId 형식 – redDragonzz
를 사용하여 포함 '저장소 { flatDir { DIRS 'libs와'} mavenCentral() } 다음' 와 내가 생각 예상되는 동작 할 수 : https : //로 groups.google.com/forum/#!topic/adt-dev/0ZAP8AVUZVw! 나는 내가 picasso 항아리를 다운로드해야하고, 그 다음 gradle가 그것을 자동적으로 포함 할 것이다라고 생각한다, 그렇지 않으면 그것은 doesnt한다. 그것을 시도하고 대답을 게시 할 것입니다 – redDragonzz