首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android Studio导入Jetbrains公开

Android Studio导入Jetbrains公开
EN

Stack Overflow用户
提问于 2018-05-22 18:39:45
回答 1查看 853关注 0票数 3

我是Android开发的新手。我已经用Android创建了一个新项目,需要将jetbrains公开的库导入到我现有的项目中。当我试图按照公开的入门指南将以下内容添加到build.grade文件时:

代码语言:javascript
复制
repositories {
  maven {
    url  "https://dl.bintray.com/kotlin/exposed" 
  }
}
dependencies {
  compile 'org.jetbrains.exposed:exposed:0.10.2'
}

我得到以下错误:

代码语言:javascript
复制
Could not find method compile() for arguments [org.jetbrains.exposed:exposed:0.10.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

我已经在网上搜索了几天了,但仍然找不到问题所在。

这是build.gradle文件:

代码语言:javascript
复制
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.40'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

repositories {
    maven {
        url  "https://dl.bintray.com/kotlin/exposed"
    }
}

dependencies {
    compile 'org.jetbrains.exposed:exposed:0.10.2'
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

希望有人能帮我。

提前感谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-22 18:41:19

您应该将此依赖项放在模块级别的build.gradle文件中--默认情况下,它位于app文件夹中,而不是项目级别的build.gradle文件,后者位于项目的根目录中。

另外,您应该使用implementation而不是compile,因为您使用的是比3.0版本更新的Android插件:

代码语言:javascript
复制
repositories {
    maven {
        url  "https://dl.bintray.com/kotlin/exposed"
    }
}

dependencies {
    implementation 'org.jetbrains.exposed:exposed:0.10.2'
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50474422

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档