在android studio中实现com.amulyakhare库

cyvaqqii  于 2023-02-24  发布在  Android
关注(0)|答案(4)|浏览(114)

你好,我正在尝试从github导入一个名为amulyakhare的库到我的android studio项目中,但同步后我一直收到以下错误:

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

你可以在这里找到这个库的github页面:
@github/阿穆尔亚哈雷
以下是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'
}

我不知道是库有问题还是我的代码中缺少了一些东西。谢谢你,谢谢那些能帮忙的人

6bc51xsx

6bc51xsx1#

将此添加到您的设置。gradle

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

如果你使用android studio bumblebee设置.gradle应该是这样的

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'

如果不起作用,尝试导入jar文件,从this下载

lztngnrs

lztngnrs2#

我想通了
1)在您的项目级别gradle中添加jcenter()

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
hgncfbus

hgncfbus3#

JCenter Maven存储库不再接收更新:更新的库版本可能在其他位置提供
所以你需要在其他地方找到相同的库。或者你可以分叉自己并上传到jitpack

将其添加到存储库末尾的根build.gradle中:

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

添加依赖项

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

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

w7t8yxp5

w7t8yxp54#

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%

相关问题