Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project with path ':mypath' could not be found in root project 'myproject'

I'm migrated from Eclipse to android studio 0.5.8, after importing my project to android studio i was getting the error Project with path ':progressfragment' could not be found in root project 'project_name'.

Project Struture :

Libs

enter image description here

Complete Structure (edit 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')     } } 
like image 840
Cool Avatar asked May 13 '14 19:05

Cool


People also ask

How do I set a build path in gradle project?

After generating the Eclipse project files, you can import the project into a Eclipse workspace. It is important to add the GRADLE_USER_HOME variable in Eclipse: Window->Preferences->Java->Build Path->Classpath Variable. Set it to the path of the ~/. gradle folder in your home directory (e.g. /home/<user_name>/.

How do I add a project to gradle?

To include another gradle project you need to edit the settings. gradle file of the current project. In the current project's settings. gradle file, you have to add the project's name which you want to include in the current project.

What is setting gradle?

Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.


2 Answers

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.

like image 81
Igor Čordaš Avatar answered Sep 23 '22 17:09

Igor Čordaš


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

like image 39
Joe 89 Avatar answered Sep 20 '22 17:09

Joe 89