Ezequiel Allio
Ezequiel Allio

Reputation: 35

Error:Configuration with name 'default' not found - Libraries in Android Studio

I added an external library "FloatingActionButton-master" that I downloaded from https://github.com/makovkastar/FloatingActionButton but when I sync with the gradle I get this error: enter image description here

(I don't have enough reputation to poste the image) I tried many differents answers from this forum but nothing was helpful for my case. I don't know what is the problem.

settings.gradle:

include ':app'
include ':librerias:FloatingActionButton-master'

app/build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "24.0.1"

defaultConfig {
    applicationId "com.example.ezequiel.memories"
    minSdkVersion 22
    targetSdkVersion 22
    versionCode 1
    versionName "1.31.08"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':librerias:FloatingActionButton-master')
}

Upvotes: 0

Views: 190

Answers (4)

Ezequiel Allio
Ezequiel Allio

Reputation: 35

Finally, I put compile 'com.melnykov:floatingactionbutton:1.3.0' and I could create the FAB without use the external library. Thank you very much to all!!

Upvotes: 0

piotrek1543
piotrek1543

Reputation: 19351

Change this line:

compileSdkVersion 22

to

compileSdkVersion 24

to avoid Android Support libraries problems

then change your dependencies to:

dependencies {
     compile fileTree(include: ['*.jar'], dir: 'libs')
     compile project(':librerias:FloatingActionButton-master')
     compile 'com.melnykov:floatingactionbutton:1.3.0'
}

Remove:

include ':librerias:FloatingActionButton-master'

and

compile project(':librerias:FloatingActionButton-master')

Hope it will help

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 365048

It happens because you are declaring:

include ':librerias:FloatingActionButton-master'

Gradle is going to search in this folder a build.gradle file.
In this folder there is a top-level build.gradle file without a module configuration.
It is the reason of:

Error:Configuration with name 'default' not found

You should use:

include ':librerias:FloatingActionButton-master:library'

or just copy only the library folder and use:

include ':librerias:library'

Otherwise check the @fernandospr's answer.

Upvotes: 1

fernandospr
fernandospr

Reputation: 3061

To include that library you don't need to clone/download the repository nor add the source manually, you should only add the dependency as follows:

dependencies {
    ...
    compile 'com.melnykov:floatingactionbutton:1.3.0'
}

However, according to the library, you should not use it anymore because it is deprecated as the Android supporting library already comes with the FAB (FloatingActionButton) button.

To use the button from the supporting library, you should instead add the following:

dependencies {
    ...
    compile 'com.android.support:design:24.2.0'
}

And then use it in your layout:

<android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ... />

You can see the following code lab for more details.

Upvotes: 2

Related Questions