Android动态功能INSTALL

Android动态功能INSTALL

本文介绍了Android动态功能INSTALL_FAILED_INVALID_APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向现有应用程序添加一些功能.该应用程序的build.gradle包含几个productFlavors和几个buildType.我已经尽力在动态功能模块中进行复制,但是似乎无法从Android Studio中正确安装它.

I am trying to add some functionality to an existing application. The app's build.gradle contains several productFlavors and a couple of buildTypes. I have tried to replicate that as best I can in my dynamic-feature module, but I cannot seem to get it to install properly from Android Studio.

我按照以下示例操作: https://github.com/googlearchive/android-dynamic-features 来设置我的功能模块,因此我的项目的结构类似于

I followed the example from: https://github.com/googlearchive/android-dynamic-features to set up my feature module, so my project is structured like

app
features/module/build.gradle
build.gradle

我在应用程序build.gradle中添加了一个buildType和风味

I added a buildType and flavor to the app build.gradle

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模块中,我尝试将其与:

and in the module build.gradle, I have attempted to match that with:

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')
}

在运行"->编辑配置"屏幕中,我在要部署的动态功能"部分的基本应用程序和模块旁边都选中了一个复选框.我正在尝试在运行Android 9.0的诺基亚6上进行测试.我从构建中获得的唯一输出是:

In my Run->Edit Configuration screen, I have put a checkbox next to both the base app and the module under the dynamic features to deploy section. I am trying to test this on a Nokia 6, with Android 9.0 running on it. The only output I get from the build is:

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.

推荐答案

这只是发生在我身上.原来我为不同的模块设置了不同的风格.
尝试在 View>下选择相同的变体.工具窗口>构建变体.

It just happened to me.Turns out I was setting different flavors for different modules.
Try selecting the same variants under View > Tool Windows > Build Variants.

这篇关于Android动态功能INSTALL_FAILED_INVALID_APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 12:06