implementing the com.amulyakhare library in android studio
Asked Answered
N

4

5

Hello i am trying to import a library called amulyakhare from github into my android studio project but i keep getting the following error after syncing:

Failed to resolve: com.amulyakhare:com.amulyakhare.textdrawable:1.0.1
Show in Project Structure dialog
Affected Modules: app

You can find the github page of the library here :

@github/amulyakhare

This is the code in the build.gradle(app):

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'



android {
    compileSdkVersion 30

    defaultConfig {
        applicationId "com.example.androidnewchatapp"
        minSdkVersion 28
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {


    implementation platform('com.google.firebase:firebase-bom:27.1.0')

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'



    //Firebase UI
    implementation 'com.firebaseui:firebase-ui-auth:7.1.1'
    implementation 'com.firebaseui:firebase-ui-database:7.1.1'



    //viewPager 2
    implementation 'androidx.viewpager2:viewpager2:1.1.0-alpha01'

    //ButterKnife
    implementation 'com.jakewharton:butterknife:10.2.3'
    annotationProcessor'com.jakewharton:butterknife-compiler:10.2.3'

    //Dexter
    implementation 'com.karumi:dexter:6.1.2'

    //TextDrawable (The amulyakhare Library)
    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'

    //EventBus
    implementation 'org.greenrobot:eventbus:3.2.0'

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    annotationProcessor'com.github.bumptech.glide:compiler:4.11.0'


    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.google.firebase:firebase-analytics'
}

i dont know if there is something wrong wih the library or there is something missing in my code. Thank you in adnvance to those who can help out

Neck answered 10/5, 2021 at 8:48 Comment(0)
I
3

I figured it out

1)In your project level gradle add jcenter()

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
Inharmonic answered 17/11, 2021 at 11:41 Comment(0)
F
3

Add this to your settings.gradle

   jcenter()
    maven {
        url 'https://jitpack.io'
    }

if you're using android studio bumblebee settings.gradle should be like this

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven {
            url 'https://jitpack.io'
        }
    }
}
rootProject.name = "You App Name"
include ':app'

If not work, try to import jar file, download from this

Farmann answered 18/3, 2022 at 5:19 Comment(0)
R
1

JCenter Maven repository is no longer receiving updates: newer library versions may be available elsewhere

so You need to find same library somewhere else. or you can fork yourself and upload to jitpack

OR

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency

dependencies {
        implementation 'com.github.alvinhkh:TextDrawable:f9f516c43b'
}

https://jitpack.io/#alvinhkh/TextDrawable/f9f516c43b

Rufous answered 5/1, 2022 at 16:57 Comment(0)
U
0
ADD these Simple Lines In Build.Gradle

buildscript {
    repositories {
        google()
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven { url "https://www.jitpack.io" }

        jcenter()
        maven {
            url 'http://dl.bintray.com/amulyakhare/maven'
        }

    }
    dependencies {
        //Your dependencies here

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com' }
        maven { url "https://www.jitpack.io" }
        maven { url 'https://jitpack.io' }
        mavenCentral()
    }
}

And in Build.Gradle (App)

implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'


Will work 100%
Unprincipled answered 16/7, 2022 at 12:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.