Unable to add dependecy to gradle (Android Studio)

I am trying to add this https://github.com/hoang8f/android-flat-button dependency to my Android studio project, and I get

 Error:(26, 13) Failed to resolve: info.hoang8f:fbutton:1.0.5

I can easily and without unnecessary difficulties add dependency of Google Play services without problems.

Below is my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.planner"
        minSdkVersion 15
        targetSdkVersion 22
        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 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'info.hoang8f:fbutton:1.0.5'
}

Solutions tried: - 1.) Gradle works online, but not offline. 2.) We cleaned and built / restored the project.

3.) Changed to

repositories {
    mavenCentral()
}

in my root gradle file

4.) Tools-> android-> Project synchronization with gradle files

Still unlucky that it works.

PS: - Not that this raised issues, I ran into the same problem trying to add parse sdk via gradle, so I added the jar file independently.

+4
5

repositories { mavenCentral() }

android

    android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.example.planner"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
repositories {
    mavenCentral()
   }}
+2

. fbutton-1.0.5.aar lib.

repositories {
        flatDir {
            dirs 'libs'
        }
    }

aar .

dependencies {
    compile(name:'ARFile', ext:'aar')
}
+1

, build.gradle demo? https://github.com/hoang8f/android-flat-button/blob/master/demo/build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 2
        versionName "1.1"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    } }

dependencies {
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.larswerkman:HoloColorPicker:1.4'
    compile fileTree(dir: 'libs', include: ['*.jar']) //    compile project(':library')
    compile 'info.hoang8f:fbutton:1.0.5'
 }

, - Gradle - .

EDIT: build.gradle , .

, build.gradle. , .

EDIT2:

build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.google.gms:google-services:1.5.0-beta2'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
+1

. Android. gradle.

0

"demo" lib. , , maven repo

, - , gradle, runProguard, gradle. minifyEnabled false.

0

Source: https://habr.com/ru/post/1620276/


All Articles