【发布时间】:2017-12-05 21:11:11
【问题描述】:
我正在尝试为我的应用程序使用 this 库,但由于它是在 kotlin 中制作的,所以我遇到了问题。我下载了这个库的模块并在项目中导入了这个模块,但在初始状态下,我找不到 kotlin 插件,所以我将等级更改为this
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
resourcePrefix "yal_ms_"
}
buidscript {
ext.kotlin_version = '1.0.1-2'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.1-2'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:26.1.0"
compile "com.android.support:recyclerview-v7:26.1.0"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
repositories {
mavenCentral()
jcenter()
}
我是第一次尝试使用 kotlin 库,但我对 kotlin 了解不多,任何关于如何使用该库的建议都会有所帮助。
【问题讨论】:
-
您可以从使用当前的 Kotlin 版本开始。也不清楚你的错误是关于什么的。 Kotlin Plugin 也可以指 Kotlin 的 AS 插件。您应该始终确保使用最新版本的 AS。如果是这种情况,则可能是插件崩溃了,因此请查看错误日志。
-
嘿,你能回答我的颤振问题吗
标签: android android-gradle-plugin kotlin android-library