GKG4
GKG4

Reputation: 501

Visual Studio Cordova Application ID

I was using Intel XDK to create Hybrid Apps. I used the Application id for PlayStore as gkg4.pro.obs

Now recently I switched to Visual Studio 2015 with Cordova, however, whenever I am trying this ID, i.e. gkg4.pro.obs, I am getting Exit Code 8 error while compiling.

if I am trying gkg.pro.obs i.e. without numerical in id, its working fine.

I can't change the ID as its already live app.

Any solution to this issue ? Please help

Upvotes: 0

Views: 724

Answers (1)

Abhishek - MSFT
Abhishek - MSFT

Reputation: 1598

It's the Cordova limitation, Cordova requires package name must look like com.company.Name. Visual Studio uses Cordova CLI to build and package app and therefore Application Id not in format com.company.Name throws build error. Please note VS2013 CPT3.0 is Cordova 4.0.0

Workaround: Android package name is checked in C:\Users\[username]\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\lib\create.js (part of Cordova) and you can modify the package name validation regex to use (!/^[a-zA-Z0-9]+(.[a-zA-Z0-9][a-zA-Z0-9_]*)+$/.test(package_name)) in below method.

function validatePackageName(package_name) {
    //Make the package conform to Java package types
    //Enforce underscore limitation
    if (!/^[a-zA-Z]+(\.[a-zA-Z0-9][a-zA-Z0-9_]*)+$/.test(package_name)) {
        return Q.reject('Package name must look like: com.company.Name');
    }

    //Class is a reserved word
    if(/\b[Cc]lass\b/.test(package_name)) {
        return Q.reject('class is a reserved word');
    }

    return Q.resolve();
}

After making the above changes, clean solution and rebuild the project.

Please note this is only temporary fix and installation of Cordova will overwrite this file.

Upvotes: 2

Related Questions