【问题标题】:Android change build.gradle to import external libraryAndroid 更改 build.gradle 以导入外部库
【发布时间】:2015-10-24 03:24:19
【问题描述】:

我正在尝试在我的项目中使用MaterialDialog,但是这个库不支持我的从右到左的语言,我必须对其进行编辑。下载项目并将其导入当前项目后,在构建项目时出现此错误:

Error:(2, 0) Plugin with id 'com.novoda.bintray-release' not found.

在网上多次搜索后,我找到了this link 来解决这个问题。但这不适用于我的项目:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
        /* I'm adding this below line */
        classpath 'com.novoda:bintray-release:0.2.7'
    }
}
allprojects {
    repositories {
        jcenter()
    }
}

【问题讨论】:

    标签: android android-gradle-plugin


    【解决方案1】:

    如果您已下载实际库并将其导入 Android Studio 并对其进行了修改,那么您希望在 gradle.build (Module:app) 中添加依赖项。您显示的代码来自 gradle.build (Project: NameOfYourProject) 所以我会删除您在那里添加的那一行。

    转到如下所示的 build.gradle (Module:app) 文件并添加如下所示的库。

    android {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"
    
    defaultConfig {
        applicationId "com.yourappname"
        minSdkVersion 22
        targetSdkVersion 22
        versionCode 1
        versionName "1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-project.txt'), 'proguard-rules.pro'
        }
    }
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:22.2.0'
        compile project(':nameOfTheLibrary')
    }
    

    【讨论】:

      【解决方案2】:

      添加

      dependencies {
      compile 'com.afollestad:material-dialogs:0.7.7.0'
      } 
      

      然后按下同步按钮。

      【讨论】:

      • 我说这个库不支持我的从右到左的语言,我必须从源代码编辑它
      猜你喜欢
      • 1970-01-01
      • 2013-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-13
      • 2020-03-12
      • 2019-12-31
      • 1970-01-01
      相关资源
      最近更新 更多