如何在android项目中添加库?

如何在android项目中添加库?,android,Android,当我要添加此库时: implementation 'com.daimajia.slider:library:1.1.5@aar' 我的android studio崩溃这是我的应用程序模块: android { compileSdkVersion 27 defaultConfig { applicationId "com.example.mahdi.introductionapps" minSdkVersion 15 tar

当我要添加此库时:

implementation 'com.daimajia.slider:library:1.1.5@aar'
我的android studio崩溃这是我的应用程序模块

    android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.mahdi.introductionapps"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.daimajia.slider:library:1.1.5.
依赖关系:

    dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
}
这是我的错误:

    android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.mahdi.introductionapps"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.daimajia.slider:library:1.1.5.
试着做这些事情

清理和重建项目

File>Invalidate Caches and Restart>Invalidate and Restart

取消选中Gradle Work Offline

尝试做这些事情

清理和重建项目

File>Invalidate Caches and Restart>Invalidate and Restart

取消选中渐变脱机工作

  • 尝试文件->使缓存无效并重新启动->使缓存无效并重新启动
  • 如果没有运气,请尝试,文件->其他设置->默认设置->生成, 执行、部署->构建工具->渐变->脱机工作并取消选中 它
  • 尝试文件->使缓存无效并重新启动->使缓存无效并重新启动
  • 如果没有运气,请尝试,文件->其他设置->默认设置->生成, 执行、部署->构建工具->渐变->脱机工作并取消选中 它

  • 图书馆没有问题

  • 转到构建>清理项目
  • 然后构建>重建项目。 并且库将正常添加。 快乐编码

  • 图书馆没有问题

  • 转到构建>清理项目
  • 然后构建>重建项目。 并且库将正常添加。 快乐编码