在根项目“ myproject”中找不到带路径“ : mypath”的项目

我从 Eclipse 迁移到 android 工作室 0.5.8,在将我的项目导入 android 工作室之后,我得到了错误 Project with path ':progressfragment' could not be found in root project 'project_name'.

项目结构:

利比亚语

enter image description here

完整结构(编辑2) :

enter image description here

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')
}
}
144305 次浏览

It's not enough to have just compile project("xy") dependency. You need to configure root project to include all modules (or to call them subprojects but that might not be correct word here).

Create a settings.gradle file in the root of your project and add this:

include ':progressfragment'

to that file. Then sync Gradle and it should work.

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.

I got similar error after deleting a subproject, removed

"*compile project(path: ':MySubProject', configuration: 'android-endpoints')*"

in build.gradle (dependencies) under Gradle Scripts

Remove all the texts in android/settings.gradle and paste the below code

rootProject.name = '****Your Project Name****'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

This issue will usually happen when you migrate from react-native < 0.60 to react-native >0.60. If you create a new project in react-native >0.60 you will see the same settings as above mentioned

If Igor's answer doesn't work, chances are you are missing the colon(:) before referring the project name.

Omitting it gives the exact same error.

Ensure you are including the project with the : as prefix

include ':progressfragment'

I Got Solution after 3 days of struggle..

must include that dependacies name with version in 'settings.gradle' file..

            include ':paytabs_sdk-v4.0.1'
include ':dtapl-3.5.3'

☻♥ Done Keep Code