zoukankan      html  css  js  c++  java
  • The application could not be installed: INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME

    问题摘要

    Installation did not succeed.
    The application could not be installed: INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME
    Installation failed due to: 'null'

    出现场景: 在变体里增加了 applicatinId 后缀 后安装时出现的。

    因为需求更改,需要增加变体,更改 applicationId ,所以在变体里使用了 applicationIdSuffix 来增加个后缀。

    defaultConfig {
        minSdkVersion config.minSdkVersion
        targetSdkVersion config.targetSdkVersion
        applicationId "com.skymxc"
        versionCode 1
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    
    }
    

    增加变体,更改后缀

    defaultConfig {
        minSdkVersion config.minSdkVersion
        targetSdkVersion config.targetSdkVersion
        applicationId "com.skymxc"
        versionCode 1
        versionName "1.0.0"
    
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    
    }
    flavorDimensions 'cloud'
    productFlavors {
        oa41217 {
            dimension 'cloud'
            applicationIdSuffix "41217"
            versionCode 1
            versionName "1.0.0"
            
        }
    }
    

    然后在运行就出现上述问题了。

    出现原因: 增加的的后缀是纯数字

    applicationIdSuffix "41217"
    

    这个要增加的后缀不能是纯数字,要以字母开头。

    如何修复: 以字母开头。

    applicationIdSuffix "a41217"
    

    实际开发中肯定不能这么随便的加个 a ,自己酌情考虑吧。

    排查过程

    看提示是因为 解析包名出错了,所以就查看包名,刚开始觉得没什么问题。
    在开发者文档里看到了 applicationId 的命名规则:

    • 必须至少包含两段(一个或多个圆点)。
    • 每段必须以字母开头。
    • 所有字符必须为字母数字或下划线 [a-zA-Z0-9_]。

    猜测是不是后缀的值是不是也不能是纯数字,所以改了字母开头试了试。
    果然没有问题了。

    总结

    applicationIdSuffix 的值不能是纯数字,要以字母开头

    End

  • 相关阅读:
    ASP.NET 母版页和内容页中的事件
    用powershell 获取windows窗口标题
    PowerShell中格式化命令和输出命令
    Powershell视频教程
    百度谷歌眼中的80后90后
    oracle导出和导入
    Websphere 优化文档
    windows 全部命令
    Oracle SQL 语句一
    怎样启动、关闭和重新启动oracle监听器 in linux
  • 原文地址:https://www.cnblogs.com/skymxc/p/12380536.html
Copyright © 2011-2022 走看看