Android studio Failed to find: com.getbase: floactionbutton: 1.3.0

I am trying to run a gradle file with an already existing android project. The only error I am having with this application is Failed to find: com.getbase:floatingactionbutton:1.3.0

. Below is my gradle file. Is there something I need to change to make it work?

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.android.support:appcompat-v7:21.+'
    compile 'com.google.android.gms:play-services:6.5.+'
    compile 'com.getbase:floatingactionbutton:1.3.0'
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    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')
    }
}

      

Please let me know if you need more information. Thank you in advance!

+3


source to share


2 answers


According to a search on Maven Central at http://search.maven.org/#search%7Cga%7C1%7Cfloatingactionbutton this library exists, so I think the problem might be that you haven't added a repositories

for your build script so that he resolved dependencies; the one you have in the block buildscript

is only for resolving build system plugins, not for creating dependencies. I know this is confusing. Add this block to the top level:

repositories {
    mavenCentral()
}

      



I also assume that you have a project with a flat directory structure and one build.gradle file ; when Android Studio builds projects through the wizard, it uses a nested directory structure with multiple build.gradle files , and usually adds the template to the top level build file, so you don't have to add this repositories

lock every single module build file. If this is the case and what is in place, then this tool will not work, so you will have to dig deeper.

+2


source


Make sure your "Global Gradle Settings" in Android Studio is NOT set to "Work Offline"



+1


source







All Articles