Sunday, 27 November 2016

Fix Error: Configuration with name 'default' not found in android-studio

While importing or cloning a code from any version control system you might sometimes get an error showing you as "Error: Configuration with name 'default' not found". This error generally occurs due to following reasons:
1. When a module doens't have the build.gradle file,
2. You're trying to use a project that doesn't have a "build.gradle" file.

Essentially the build.gradle file for each submodule needs to have the information on how to build itself and any custom gradle command definitions.
So, you need to make sure that each submodule in your project has its own build.gradle file.
The name 'default' happens because your project level build.gradle is trying to build a project that doesn't know how to build itself, thus it is given the name 'default.'

Fix 1:
- If you are cloning a project from a version control system, then make a new clone of your project:

                                       git clone <LINK_TO_YOUR_PROJECT>  

and then issue the git submodule command:

                                       git submodule update --init --recursive  
and after this check whether your external folders are being populated with required folders and files.

Fix 2:
- After importing your project, run the following to commands:
                                       git submodule init  
                                       git submodule update  

Fix 3:
Add you library projects in your app level build.gradle file as follows:

               compile fileTree(dir: 'libs', include: ['*.jar'])              
               compile 'com.android.support:appcompat-v7:21.0.3' 
               compile project(":libs:<Your project name>")      

For more information on gradle visit: http://tools.android.com/tech-docs/new-build-system/user-guide


Thanks and reply if any issues.


No comments:

Post a Comment