【发布时间】:2020-03-22 20:47:18
【问题描述】:
我正在尝试在 android 中创建一个功能,但出现下一个错误
执行任务:项目中的[:app:assembleDebug] C:\Users\wilso\OneDrive\Documents\retrofit_system\retrofit_system
配置项目 :feature:webview 警告:com.android.feature 插件已弃用,将于 2019 年底删除。请 切换到使用动态功能或库。有关更多信息 将您的应用程序转换为使用 Android App Bundle,请访问 https://developer.android.com/topic/google-play-instant/feature-module-migration 警告:com.android.feature 插件已弃用,将 于 2019 年底移除。请切换到使用动态功能或 图书馆。有关将您的应用程序转换为 使用 Android App Bundle,请访问 https://developer.android.com/topic/google-play-instant/feature-module-migration
FAILURE:构建失败并出现异常。
出了什么问题:配置项目 ':feature:webview' 时出现问题。
'kotlin-android' 期望将 Android Gradle 插件之一应用于项目:* android * com.android.application * 安卓库 * com.android.library * com.android.test * com.android.feature * com.android.dynamic-feature * com.android.instantapp
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
通过https://help.gradle.org获得更多帮助
在 383 毫秒内构建失败
gradle是下一个
apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'
android {
defaultConfig {
consumerProguardFiles 'consumer-proguard-rules.pro'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'RtlEnabled'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
}
我搜索了任何解决方案,但我什么也得不到,
如果我使用下一个 gradle,它就会起作用
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.co.webview"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
但我不想创建应用程序,因为我想创建一个功能
【问题讨论】:
-
"com.android.feature 插件已弃用,将于 2019 年底移除。"我很确定我们已经到了 2020 年。
-
是的,我理解日志,但我找不到创建功能的解决方案
-
我认为article 可能会对您有所帮助。
-
我做了一个测试,我的问题得到了解决,但我不明白为什么下一个标签会影响构建'应用插件:'kotlin-android'。如果我删除它,我的应用程序就会构建。有人知道下一个应用插件有什么用:'kotlin-android'
-
kotlin-android期望找到一个 android 插件,如堆栈跟踪所示。com.android.feature插件很可能已被删除,因此您构建时没有 android 插件。kotlin-android相当于kotlingradle 插件,但适用于 Android。
标签: java android swift react-native kotlin