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

  • 相关阅读:
    oracel中wm_concat函数使用
    plsql快捷键设置
    mybatis generator--逆向工程工具的使用
    subline_2使用格式化html等文件
    subline的使用
    关于ssm整合过程中,spring配置文件无提示功能
    初识shell脚本
    ReentrantReadWriteLock原理
    策略模式
    适配器模式
  • 原文地址:https://www.cnblogs.com/skymxc/p/12380536.html
Copyright © 2011-2022 走看看