android - AppExtension 类型对象的未知属性 dynamicFeatures
问题描述
从即时应用程序迁移到应用程序包后,我收到以下错误。
Could not set unknown property 'dynamicFeatures' for object of type com.android.build.gradle.AppExtension.
我已按照https://developer.android.com/topic/google-play-instant/feature-module-migration上的说明进行操作。
我尝试更新应用程序的构建工具和目标 SDK 版本,但没有帮助。
这是我的动态功能模块的 build.gradle 文件。
apply plugin: 'com.android.dynamic-feature'
android {
dynamicFeatures = [":features:base"] // This is where error points to!
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':features:base')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
应用程序中使用的版本:
buildTools = "28.0.3"
compileSdk = 28
targetSdk = 28
minSdkInstant = 21
minSdk = 21
archLifecycleVersion = "1.1.1" //"2.0.0"
ktxVersion = "1.0.1"
supportLibVersion = "28.0.0"
playServicesAuthVersion = "11.8.0"
espressoVersion = "3.0.1"
androidTestVersion = "0.5"
hamcrestVersion = "1.3"
junitVersion = "4.12"
gradle-wrapper 版本:5.1.1
解决方案
我在动态功能模块中设置了 dynamicFeatures 变量,这是不正确的。您必须仅在基本模块中设置 dynamicFeatures 变量。
功能1/build.gradle
apply plugin: 'com.android.dynamic-feature'
android {
...
// do not set dynamicFeatures here!
}
应用程序/build.gradle
apply plugin: 'com.android.application'
android {
...
dynamicFeatures = [":feature1", ":feature2"]
}
您可以在此处查看示例项目:https ://github.com/CapTechMobile/Android-App-Bundle-Sample
推荐阅读
- c - 在没有字符串库的情况下比较 C 中的命令行参数
- javascript - 防止在反应中重新渲染数组内的某些组件
- powerbi - Power BI Count 包含“2”的列的总数
- wpf - 如何为 WPF 安装和使用 Lottie/JSON 动画代码
- flutter - Flutter:在 Stack() 场景中使用 CheckboxListTile() 和 Positioned() 时出现问题
- asp-classic - 如何在url中传递无法直接在url中执行的值参数?
- jquery - 如何使用 DOM 获取内容
- reactjs - 模块联合(意外令牌 '!==' main.js:619)
- java - 错误:使用 cicd 将 maven 项目部署到应用引擎 gg 云时,无法找到或加载主类 org.apache.maven.wrapper.MavenWrapperMain
- reactjs - 使用 React JS 提供静态文件