programing

루트 프로젝트 'myproject'에서 경로가 ': mypath'인 프로젝트를 찾을 수 없습니다.

projobs 2021. 1. 17. 10:24
반응형

루트 프로젝트 'myproject'에서 경로가 ': mypath'인 프로젝트를 찾을 수 없습니다.


Eclipse에서 android studio 0.5.8 로 마이그레이션 했습니다. 내 프로젝트를 android studio로 가져온 후 오류가 발생했습니다.Project with path ':progressfragment' could not be found in root project 'project_name'.

프로젝트 구조 :

여기에 이미지 설명 입력

완전한 구조 (편집 2) :

여기에 이미지 설명 입력

Gradle.build :

apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':progressfragment')
    compile project(':viewpagerindicatorlibrary')
    compile project(':ZBarScannerActivity')
    compile project(':google-play-services_lib')
    compile project(':SwitchCompatLibrary')
    compile project(':actionbarsherlock')
    compile project(':librarymultichoice')
}



buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}

android {
    compileSdkVersion 14
    buildToolsVersion "19.0.1"

    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')
    }
}

compile project("xy")의존성 만으로는 충분하지 않습니다 . 모든 모듈을 포함하도록 루트 프로젝트를 구성해야합니다 (또는 하위 프로젝트라고 부르지 만 여기에서는 올바른 단어가 아닐 수 있음).

크리에이트 settings.gradle 프로젝트의 루트에 파일이 추가 :

include ':progressfragment'

그 파일에. 그런 다음 Gradle을 동기화하면 작동합니다.

Also one interesting side note: If you add ':unexistingProject' in settings.gradle (project that you haven't created yet), Gradle will create folder for this project after sync (at least in Android studio this is how it behaves). So, to avoid errors with settings.gradle when you create project from existing files, first add that line to file, sync and then put existing code in created folder. Unwanted behavior arising from this might be that if you delete the project folder and then sync folder will come back empty because Gradle sync recreated it since it is still listed in settings.gradle.


이 답변이 비슷한 오류에 도움이 될 수 있습니다. 하위 프로젝트를 삭제 한 후 비슷한 오류가 발생 하고 Gradle Scripts 아래의 build.gradle (종속성)에서 " compile project (path : ': MySubProject', configuration : 'android-endpoints') "를 제거했습니다.

참조 URL : https://stackoverflow.com/questions/23640059/project-with-path-mypath-could-not-be-found-in-root-project-myproject

반응형