Android Problem Collection (13)-Error: Tag <manifest> attribute package has invalid character'"'.

Problem Description:
There are invalid characters in the list compiled to run Times mainfest file
Write picture description here
prompt characters are invalid in a statement Activity component mistake, there has been an error log from "invalid character, so start checking whether the manifest file and" invalid characters, supposedly If there are invalid characters, then, manifest file at compile an error will be reported red, like this
Write picture description here
but actually no such error, indicating Activity during the compilation of the statement is true, it only appeared invalid characters during construction Wrong, finally put the target in the relationship between package and applicationId, because productFlavors{{applicationId} is defined in the project.

 productFlavors {

        laiXiu{
            applicationId LAIXIU_APPLICATION_ID

        }
    }

LAIXIU_APPLICATION_ID is defined in the gradle.properties file as follows:

LAIXIU_APPLICATION_ID="com.xxx.xxx"

The problem is that there is a double quotation mark in "com.xxx.xxx" here , and package= ""com.xxx.xxx "" will be set during the construction process , which is an invalid character error.
Write picture description here

Hope you know: Although your project can set the package attribute is not equal to applicationId, but it is not. The build tool will copy the Application ID and set it to the value of the unique package attribute of your application during the final build. So, if you check the AndroidManifest.xml file after the build is successful, don't be surprised that the package attribute changes. On the Android platform and Google App Store, the package attribute is the only identity credential for your application. Therefore, once the original value is used to build (using the R class of the namespace to parse the components in the manifest), the build tool will discard the value of the package attribute and replace it with the Application ID.

Solution:
Remove the double quotes from the value of LAIXIU_APPLICATION_ID.

LAIXIU_APPLICATION_ID=com.xxx.xxx

Thanks:
https://blog.csdn.net/qq_17250009/article/details/53896168

Guess you like

Origin blog.csdn.net/hzw2017/article/details/81001424