2017-09-22 5 views
2

내 Android Studio 프로젝트는이 같은 디렉토리 구조가 작동하지 않습니다 . 그것의 settings.gradle은 단지 include ':library'입니다. 이전 설정을Gradle을의 설정은 더 이상 안드로이드 스튜디오 3 (베타)

project/settings.gradle 작업

include ':submodule/library'을 말한다. project/app/build.gradle에는 compile project(':submodule/library') 행이 있습니다.

이 모든 안드로이드 스튜디오 3하기 전에 잘 작동,하지만 지금은 안드로이드 스튜디오는 그 이름으로 모듈을 찾을 수 없다는 불평 :

Error:Unable to find module with Gradle path ':submodule/library' (needed by module 'Accession'.)

(명령 행에서 빌드를 실행하면 Gradle을가 나타납니다으로 잘 작동하므로 뭔가가 마음에 들지 않는 Android Studio로만 보이게됩니다.)

온라인으로 볼 때 :submodule/library은 gradle에 지정된 프로젝트의 이름으로 우연히 만 작동했을 수도 있습니다. config는 상대적인 p와 동일하게 축 어적으로 간주되었습니다. 그 뿌리의 ath.

1 build.gradlesettings.gradle 모두 :submodule:library:submodule/library 교체

가능한 해결 방법 :

나는 두 가지 해결책이있다. 이것은 작동하는 것으로 보입니다. 그러나 가장 좋은 추측은 그 프로젝트의 하위 프로젝트 인 grad30 프로젝트 :submodule을 포함한다는 것입니다. 요점을 더 들어서, 나는이 :x:y 표기법이 실제로 무엇을 나타내는지는 정말로 모른다.

2 settings.gradle

include ':library' 
project(':library').projectDir = file('submodule/library') 

include ':submodule/library'를 교체하고 build.gradlecompile project(':library')으로 compile project(':submodule/library') 교체 가능한 솔루션입니다.

나는 이것이 "옳은 일"이라고 생각합니다.

질문

누군가가 정확히 "입니다 Gradle을이 세 비트 각각에 대해 작동합니다 (있는 경우) (원래 설정과 두 가지 수정을) 진행하고있는 무슨 말해 수 모범 사례 "?

업데이트 (해설)

내가 설명한 것은 모두 나의 오래된 Gradle을 안드로이드 Gradle을 플러그인 버전 설정과 발생 (Gradle을 3.3, 안드로이드 Gradle을 플러그인 2.3.3) 모두 (Gradle을 4.1을 업데이트 한 후, Android Gradle Plugin 3.0.0 베타).

답변

0

그들은 새로운 gardle 릴리스에서 많은 것을 변경했고 빌드 스크립트도 더 이상 작동하지 않았습니다. 그러나 최신 버전을 사용하기 위해 빌드 스크립트를 마이그레이션하는 방법에 대한 좋은 문서가 있습니다.

은 문서의이 부분은 당신을 위해 STH해야한다 예를 들어 다음과 같이

대신 의존성을 구성해야합니다

dependencies { 
// This is the old method and no longer works for local 
// library modules: 
// debugCompile project(path: ':foo', configuration: 'debug') 
// releaseCompile project(path: ':foo', configuration: 'release') 

// Instead, simply use the following to take advantage of 
// variant-aware dependency resolution. You can learn more about 
// the 'implementation' configuration in the section about 
// new dependency configurations. 
implementation project(':foo') 

// You can, however, keep using variant-specific configurations when 
// targeting external dependencies. The following line adds 'app-magic' 
// as a dependency to only the 'debug' version of your module. 

debugImplementation 'com.example.android:app-magic:12.3' 

} 여기

전체 문서에 대한 링크입니다 , 그것은 당신이 나를 위해했던 것처럼 도움이되기를 바랍니다.

https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

+0

위에서 설명한 문제는 Android Studio를 업그레이드 한 후에 발생했습니다. 저는 아직도 Gradle 3.3과 Android Gradle 플러그인 2.3.3을 사용하고 있습니다. 그런데, 제가 Gradle 버전을 4.1로, 플러그인 버전을 3.0.0 베타로 바꾸고,'compile '을 어디에서나'implementation'으로 대체했을 때, 문제는 여전히 지속되었습니다. – UtterlyConfused