Only set the appid if it's present in the tiapp.xml. In the _build.js, the set the appid if it's not set.