2016-10-13 4 views
0

여러 개의 Android 앱 및 라이브러리가 포함될 gradle로 다중 프로젝트 빌드가 있습니다. 프로젝트 구조의중첩 된 프로젝트에서 classpath 종속성이 해결되지 않았습니다.

샘플 :

root (Project Root) 
| android 
    | module1 (Android Application) 
    | module2 (Android Library) 
| ios (in the future) 

나는 일부 하위 프로젝트에 특정 Gradle을 플러그인을 적용 할. Gradle을 안드로이드 Gradle을 발견 할 수 없다는
:android:module1 -> build.gradle -> apply plugin: 'com.android.application'

:android:module2 -> build.gradle -> apply plugin: 'com.android.library' 문제가 : (예에만 로이드 서브 프로젝트에 로이드 Gradle을 플러그인으로) 그러므로 I는 :android -> build.gradle 클래스 경로 의존성 두 로이드 서브 프로젝트에 플러그인 선언 첨가 노력 :root -> build.gradle 또는 :android:moduleX -> build.gradle 모든 클래스 경로 종속성을 정의 할 때 예상대로 때문에 :; 플러그인 (2.2.1 안드로이드 Gradle을 플러그인 버전 Gradle을 버전 3.1) 또한

Error:(1, 1) A problem occurred evaluating project ':Shoppr:presentation'. Plugin with id 'com.android.application' not found.

그것은 다른 질문에 같은 버전의 문제가 아니다 .

: 루트 -> build.gradle

allprojects { 
    repositories { 
    mavenCentral() 
    jcenter() 
    } 
} 

: 안드로이드 -> build.gradle

buildscript { 
    repositories { 
    jcenter() 
    } 

    dependencies { 
    classpath 'com.android.tools.build:gradle:2.2.1' <-- Should only be applied for android project 
    } 
} 

: 안드로이드 : 모듈 1 -> build.gradle

apply plugin: 'com.android.application' --> Plugin with id 'com.android.application' not found. 

: 안드로이드 : module2 -> build.gradle

apply plugin: 'com.android.library' 

답변

0

나는 안드로이드 폴더와 웹 폴더를 포함하는 구글 샘플 프로젝트와 같은 폴더 배열을 보아왔다. 당신이 시도 할 수있는 것은 프로젝트 폴더로 android 폴더를 사용하여 프로젝트를 가져 오는 것입니다. 왜냐하면 프로젝트를위한 폴더가 두 개 더 있다면 gradall을 사용하여 Ios와 Web을 빌드하지 않을 수도 있기 때문입니다.

그래서 프로젝트를 닫고 프로젝트 루트로 android 폴더를 사용하여 다시 가져 오기, 나는 이런 식으로 생각합니다, gradle 잘 실행해야합니다. 내 프로젝트 폴더는 웹과 안드로이드 프로젝트가 모두 하나의 저장소에 있지만 안드로이드 스튜디오로 빌드하는 동안 안드로이드 프로젝트 루트로 안드로이드 폴더를 사용하기 때문에 이와 비슷합니다.

+0

감사합니다. 필자는 hte 모듈 의존성을 세부적으로 제어하기 위해 프로젝트를 분리했다. 원래 문제를 해결하지는 못하더라도 답변을 수락 한 것으로 표시하겠습니다. – chris115379

관련 문제