Build Error Android: Configuration with name 'default' not found - android

I tried to find answer for the below error message from the forum. I could not.
Error:
Error:A problem occurred configuring project ':app'.
Cannot evaluate module soundprocessing : Configuration with name 'default' not found.
Details
Project Structure:
Android
|__ app
|__ net (java library)
|__ soundprocessing (Android Library without any activity)
Build.gradle at the top level (Android)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
settings.gradle (at top level Android)
include ':app',':net', ':soundprocessing'
Build.gradle inside app
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.clinicloud.app"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':net')
compile 'io.realm:realm-android:0.80.1'
compile project(':soundprocessing')
}
build.gradle (inside net)
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
build.gradle (inside soundprocessing)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Settings.gradle at the top level has this code
include ':app',':net', ':soundprocessing'
************I deleted settings.gradle from soundprocessing app as one of the forum answers said there should only one settings.gradle in multi project dependency.
Error:A problem occurred configuring project ':app'.
Cannot evaluate module soundprocessing : Configuration with name 'default' not found.
Now I added my settings.gradle as well. So what could be the problem?

I had the same problem when I added a library project to an app. I solved it like this...
In the settings.gradle (in your app, not the library) edit it to include your libraries sub-folder :
include ':app', ':library_project'
project(':library_project').projectDir = new File('../library_project/library')
in my example, observe the /library subfolder. As soon as I specified it, the error was fixed.
NOTE: this subfolder will depend on your library project and will likely be something different.

Change the file "build.gradle" inside "soundprocessing":
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
minSdkVersion 19
targetSdkVersion 21
}
// Change this section or remove
sourceSets {
..........
}
}
// Change this section or remove
dependencies {
.......
}
The section "sourceSets" need only if your project has custom paths to elements: sources, AndroidManifest.xml, resources and etc.

Related

Error:Could not find com.google.gms:google-services:3.0.0 when importing Firebase to a code sample

I imported the sample app in Android Studio under the location section. I then proceeded to update most of the dependancies. I then attempted to add Firebase and that's when things went south. The module build.gradle is below.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.maps.android:android-maps-utils:0.4.4'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.google.android.gms:play-services-wearable:10.0.1'
compile 'com.android.support:support-v13:25.0.1'
compile project(':Shared')
wearApp project(':Wearable')
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 25
buildToolsVersion '24.0.2'
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
productFlavors {
}
}
apply plugin: 'com.google.gms.google-services'
The root build.gradle is below.
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
And the error I receive is :
Error:Could not find com.google.gms:google-services:3.0.0.
Searched in the following locations:
file:/C:/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.pom
file:/C:/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.jar
Required by:
:ToledoZoo:unspecified
Using the latest SDK, and all. Added the google.json file to the app directory as well. I am sure it is something small I am missing, but yet... still missing it!
The module build.gradle is below
app/ is a module, and the buildscript block should not be within that.
The app build.gradle is below.
If by this, you mean build.gradle in the root of the project, then it is that file where you add the classpath of the play services.
Refer. https://firebase.google.com/docs/android/setup#add_the_sdk
Note, when the documentation says
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
You do not literally copy the // ... pieces. It means "leave what is there already".
If you have a single module Gradle project, then that might make sense looking at your question, and so you need to have
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: 'com.android.application'
// rest of gradle file
I'm not a Gradle expert. That said, the layout of your build.gradle files is unconventional. Typically, in the module file, the dependencies block is after the android block. Examples of build files are in the Firebase sample project. Take a look at this sample project build file and this sample module build file.

android : cannot build project after upgrading Android Studio to 2.3

So, happily updated my Android Studio from stable version 2.2 to canary channel 2.3.
But, unfortunately, it has serious bug. Project is not able to build.
I tried opening my previous projects and also tried creating new sample application, I got same below error:
Gradle 'MyApplication' project refresh failed
Error:A problem occurred configuring project ':app'.
build.gradle(project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-alpha1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.chint.myapplication"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:25.0.0'
testCompile 'junit:junit:4.12'
}
Am I the only one with this issue ?
So, be careful while this dialog appears:
Choose "Remind me later" and NOT "Update"
Stay with the build version you already have.
Incase, you pressed Update, so just rollback your Android Gradle Plugin classpath in build.gradle(project) to below one:
classpath 'com.android.tools.build:gradle:2.2.2'
This worked for me.
You should update your Android Studio gradle manually.
1° Step:
Follow this path and get your gradle version
C:\Users\[USER_NAME]\.gradle\wrapper\dists
Here you will get "gradle-X.X" (X- is version) in my case it was "gradle-3.3-all"
2° Step:
Go to the following link :
https://services.gradle.org/distributions/
Download your respective version zip file and just past it in the last folder with long random name.
C:\Users\[USER_NAME]\.gradle\wrapper\dists\gradle-x.x\55gk2rcmfc6p2dg9u9ohc31212 HERE
Now open the Android studio, I hope this will work.
I fought a similar issue and resolved it with the addition of 2 characters...
And after updating the gradle-wrapper.properties to target 3.2.1 everything was great for me
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-all.zip
If you import external libraries apply changes for "allprojects"
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Could not find com.squareup.picasso:picasso:2.5.2

I adding picasso dependencies but seem it not worked. I tried changing the version. But still useless.
This my build.gradle (module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "bhouse.travellist_starterproject"
minSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.squareup.picasso:picasso:2.5.1'
}
and this is my build.gradle (project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
The error said:
Error:(27, 13) Failed to resolve: com.squareup.picasso:picasso:2.5.1
Show in FileShow in
Project Structure dialog
Any help are welcome.
You need to add a section allprojects at the end of your main build.gradle that defines the repositories for the modules of your project:
allprojects {
repositories {
jcenter()
}
}
This will result in the following build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
According to their Github, you have to use MavenCentral to get their library so add this to your build.gradle(app) file:
repositories {
mavenCentral()
}
Resync and try again.
You need to add a maven repository from which Picasso can be downloaded. You can do that by adding this in your app module's build.gradle file:
repositories {
jcenter()
}
A good place would be just before your dependencies {} block.
In my case, I just set in the gradle.properties settings for https
systemProp.https.proxyHost=some.proxy.adress.com
systemProp.https.proxyPort=8080
so in my case, gradle.properties will be:
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8080
Begins when I use the app,and just have a build (module) without build (app).
After I add Picasso library appears Error: (line, column) Failed to resolve: com.squareup.picasso: Picasso: 2.5.2 Show in File || Show in Project Structure dialog
as well as with the glide library
and the solution is as it says (DenisGL) is added allprojects follows:
allprojects {
repositories {
jcenter ()
}
}

Where can I put individual dependencies in Android Studio?

I am trying to install Picasso (http://square.github.io/picasso/) for use in Android Studio. One of the steps is to add this line: compile 'com.squareup.picasso:picasso:2.5.2' in build.gradle under dependencies. However, there is a message in gradle that tells me not to insert individual dependencies in the dependencies folder. What should I do?
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You need to add it to the gradle.build file that is located in the "app" directory, not the one in your project directory. find the gradle.build file that sits within the "app" directory of your project.
Here is mine as an example:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.your.packagename"
minSdkVersion 15
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories { mavenCentral() }
dependencies {
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
And a link to some supporting documentation:
http://developer.android.com/tools/building/configuring-gradle.html
Screenshot of the build.gradle(Module:app file)
Take a look at the image.
Do you see that there are actually 2 build.gradle files?
what you need is the (Module:app) gradle build file select that and paste the link in the dependencies part in the bottom of that file just like what i have done , then Android Studio will ask you to sync the file.
Do it.
It will download the dependency from your link provided and integrate with the project
Hope this helps..

Android studio module cannot resolve symbol context

I had a project in Android studio and I needed to delete .idea directory. So I importet it again, but after this, all modules in libs/ can't resolve anything from android (but app module can).
Is there any setting which connects module with android?
Thanks very much
This is screen from stickyListHeaders library:
biuld.gradle from stickyList:
apply plugin: 'android-library'
apply plugin: 'android-library'
android {
compileSdkVersion 17
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 18
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
And project's settings.gradle
include ':libs/bakuDroidLibrary'
include ':libs/photoView'
include ':libs/pullToRefresh'
include ':libs/slidingMenu'
include ':libs/spinnerWheel'
include ':libs/stickyListHeaders_lib'
include ':##PROJECTNAME##'
Some other screenns which may help:
Top level build.gradle:
// Top-level build file where you can add configuration options common to all sub- projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
First Check whether File » Project Structure » Android SDK is pointing to right SDK.
Than make sure below lines are added before apply plugin: 'android-library'inside build.gradle file of your stickyheader library or inside Project root's build.gradle file.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
My suggestion is to avoid downloading and adding libraries in to your project, use maven dependency instead.
For stickyheader which you have used can be used just by adding dependency like this in your module's build.gradle file
dependencies {
compile 'se.emilsjolander:stickylistheaders:2.1.3'
}
Nothing else needs to be done.

Categories

Resources