【发布时间】:2020-01-13 03:54:28
【问题描述】:
我正在尝试向现有应用程序添加一些功能。该应用程序的 build.gradle 包含几个 productFlavors 和几个 buildTypes。我已尝试在我的动态功能模块中尽可能地复制它,但我似乎无法从 Android Studio 正确安装它。
我按照https://github.com/googlearchive/android-dynamic-features 中的示例设置了我的功能模块,因此我的项目结构类似于
app
features/module/build.gradle
build.gradle
我在 app build.gradle 中添加了 buildType 和 flavor
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
}
dynamicFeatures = [":features:module"]
buildTypes{
myBuildType {
debuggable true
multiDexEnabled true
}
}
flavorDimensions "blah"
productFlavors{
arm64 {
ndk {
abiFilters "arm64-v8a"
}
ext {
abiVersionCode = 5
}
matchingFallbacks = ['defaultFlavor']
}
}
在模块 build.gradle 中,我尝试将其与:
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
}
buildTypes {
dynamic {
multiDexEnabled true
debuggable true
}
}
flavorDimensions "blah"
productFlavors {
arm64 {
ext {
abiVersionCode = 5
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')
}
在我的 Run->Edit Configuration 屏幕中,我在要部署的动态功能部分下的基本应用程序和模块旁边放置了一个复选框。我正在尝试在运行 Android 9.0 的诺基亚 6 上对此进行测试。我从构建中得到的唯一输出是:
01/12 22:39:25: Launching 'app' on HMD Global TA-1025.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_INVALID_APK
The APKs are invalid.
【问题讨论】:
-
自我注意- 以后记得查看android studio日志,以获取更多信息。