android - 无法在 Android Studio 中使用 github 库

标签 android gradle android-studio android-gradle-plugin

我想使用 this library在 Android Studio 的一个项目中,如阅读我所述,我在 Android Studio 中创建了新项目,并在 app 文件夹内的 build.gradle 文件中添加了依赖项:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.mycompany.swipe_instagram"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
    }
}

repositories {
   mavenCentral()
} 

dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
   compile 'com.android.support:appcompat-v7:21.0.3'
   compile 'com.lorentzos.swipecards:library:1.0.8@aar'
}

然后,当我同步时,我开始收到此错误:

Failed to find file

我在谷歌和堆栈溢出上进行了搜索,但找不到任何合适的解决方案。

最佳答案

我使用了你的“build.gradle”文件,它对我来说工作正常(有和没有“aar”)。可能是缓存有问题。尝试“文件-> 使缓存无效/重新启动”)。生成更多错误消息详细信息的另一种方法是尝试从命令行构建模块并获取详细输出

gradle -info compileDebugSources

你会得到很多输出,这些输出应该给你一个关于出了什么问题的提示

关于android - 无法在 Android Studio 中使用 github 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28262751/

相关文章:

android-studio - 如何降级 Kotlin 版本

android - Visual Studio Xamarin android 应用程序崩溃

android - HTTPS 请求返回 2032 Stream Error 仅适用于 Android with Flex 4.6 Mobile

android - 获取变量 "into"RxJava 链供以后使用

java - 由于 API 问题导致应用程序崩溃

android - 在 Android Studio 的 Layout Design Palette 中搜索组件

java - 涂黑谷歌地图 Activity 区域

android - 发现无效的 Gradle JDK 配置。打开 Gradle 设置

android-studio - 人工发布不适用于android studio 3.4.1

android - 我不小心从 android studio 中的 import from gradle 选项导入了项目。现在我的项目不工作