在我的项目中,我试图建立汽车图像滑块视图 我正在使用SliderView库.我还添加了GitHub的依赖项:

implementation 'com.github.smarteist:autoimageslider:1.4.0-appcompat'

但当在项目中添加此依赖项并同步项目时,并try 在我的XML文件中使用此库.尽管项目已成功生成,但此库未显示.

Build.gradle(APP):

plugins {
   id 'com.android.application'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.nctr.cd.bmvp"
        minSdk 26
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.gitee.archermind-ti:autoimageslider:1.0.0-beta'
    testImplementation 'junit:junit:4.13.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // room database dependency
    def room_version = "2.4.3"
    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"

    //retrofit http client dependency
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

    //swipe refresh dependency to add pull to refresh for recycleView
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"

    // dependency for gson
    implementation 'com.google.code.gson:gson:2.9.1'

       // dependency for loading image from url

    implementation 'com.github.bumptech.glide:glide:4.11.0'

    // google service dependency
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    // auto image slider dependency
    implementation 'com.github.smarteist:autoimageslider:1.4.0-appcompat'
}

推荐答案

请判断您的build.gradle中是否缺少jcenter():

allprojects {
    repositories {
        google()
        //here
        jcenter()
        mavenCentral()
   
    }
}

还要确保您的项目依赖于appCompat依赖项.

Android相关问答推荐

如何制作带有图标和文本的Fab

Jetapck Compose:将Compose BOM更新为最新版本&2024.01.00&Quot;CircularProgressIndicator后出现错误

我想使用代码自动重命名我的Android存储中的文件夹

Android App Google AdMob";广告加载失败:3;带有测试ID,&q;广告加载失败:1 for My Gahad

无法加载类';com.android.build.api.extension.AndroidComponentsExtension';

如果我的圆形图像的顶部居中于卡片内部,我如何在其下方画一条弧线?

OverridePendingTransition已弃用,我该怎么办?

如何将.txtassets资源 转换为ArrayList<;字符串>;kotlin格式?

弹出导航堆栈后,Compose 无法访问 Hilt View Model

我需要在房间数据库中保留旧的自动迁移行吗?

如何使用 Wea​​r OS 上的运行状况服务模拟位置?

如何在C++中使用JNI_GetCreatedJavaVMs调用Java代码

Material 3的MaterialSwitch默认大小太大了?如何使它变小?

如何在组件之间导航

调用时 listFiles() nullpointerexception

如何在 Compose 中更改高程 colored颜色 ?

Android Studio:如何添加应用程序质量洞察窗口以查看 Android Studio 中的 Crashlytics 数据?

如何使用 Jetpack Compose 在应用程序中实现本地化

Kotlin Compose 全局页脚视图

compose :为什么以记住启动的列表触发方式与快照不同