我一直在努力将新发布的Android Instant Apps与Kotlin编程语言结合起来.在使用以下(标准?)设置创建项目后,当我尝试构建应用程序时,出现错误消息"null无法转换为非null类型com.android.build.gradle.BasePlugin".使用Kotlin可以正常使用标准的"com.android.application"模块; 仅当我尝试在Instant App模块中使用它时才会抛出错误.
顶级build.gradle:
buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.0-alpha1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4"
}
}
// ...
Run Code Online (Sandbox Code Playgroud)
应用模块的build.gradle,在科特林做的工作:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' // This will work.
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
// ...
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':feature')
implementation project(':base')
}
Run Code Online (Sandbox Code Playgroud)
基本 …
android kotlin android-studio android-gradle-plugin android-instant-apps