Gradle 无法解析 Android Studio 中的库 [英] Gradle failed to resolve library in Android Studio

查看:23
本文介绍了Gradle 无法解析 Android Studio 中的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Android Studio 中包含一个库,但它显示如下错误:

I want to include a library in Android Studio , but it displays error like below :

无法解析:com.lemonlab:expandable-button-menu:1.0.0"

"Failed to resolve:com.lemonlab:expandable-button-menu:1.0.0"

如何解决这个问题?

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 21
        buildToolsVersion '21.1.2'

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

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:21.0.3'
        compile 'com.google.android.gms:play-services:6.5.87'
        compile 'com.lemonlab:expandable-button-menu:1.0.0'
        compile files('libs/pinchzoom.jar')
    }

推荐答案

为了能够使用 lib 项目,您需要将它包含在应用程序的 settings.gradle 添加:

To be able to use a lib project you need to include it in your application's settings.gradle add:

include '..:ExpandableButtonMenu:library'

然后在你的 build.gradle 添加:

and then in your build.gradle add:

compile project(':..:ExpandableButtonMenu:library') 

将 ExpandableButtonMenu 项目放在您自己的(同一文件夹)旁边

place ExpandableButtonMenu project along side your own (same folder)

见这个如何构建一个android带 Android Studio 和 gradle 的库?了解更多详情.

这篇关于Gradle 无法解析 Android Studio 中的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆