Issue to have signed apk after creating build.json file and feeling details as- Error: Unexpected token / in JSON at position 0

Hi all,
I am new to Ionic, I have an ionic app.
I have created build for that
ionic build android
and i got debug.apk
now I need Singed apk so that i can use it on play store.

I found this tutorial but it wont help me a lot.
What i have-

** ionic CLI v2.0.0-beta.31
java version "1.7.0_21",
cordova-  6.2.0,
node-   v6.2.2,
npm -v   3.9.5,**

=> I am unable to use Ionic toturial for building a release.apk to have some help,

=> then I follow this
=> also seen this

  1. create a file in project root directory with name build.json
  2. insert details as
    “android”: {
    “release”: {
    “keystore”: “android.keystore”,
    “storePassword”: “storepassword”,
    “alias”: “mykey”,
    “password” : “password”,
    “keystoreType”: “”
  3. run
    cordova build android --release

Now i have issue as-
Reading build config file: /Users/some/project/files/build.json
Error: Unexpected token / in JSON at position 0
Don’t know how to solve this and get signed apk for my app.

I am having the same problem?

Sanjay, did you manage to resolve this?

From the error description it seems like something is wrong with the json file. Try an json verifier to make sure your json file correct.

Otherwise you can always use adb to manully sign your app

 > cordova build android --release    (To create a release version of the application)

> keytool -genkey -v -keystore app.keystore -alias app -keyalg RSA -keysize 2048 -validity 10000   (To generate the keystore to sign the app. Use a single keystore for all versions)

> jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore app.keystore app-release-unsigned.apk app(To sign the application with the give keystore. Here the keystore file is app.keystore. Ruin this command in ant-build folder where release apk is present.)

> zipalign -v app-release-unsigned.apk App.apk
1 Like

This is maybe a long overdue answer, but hopefully it will save somebody some time.
Here’s what you do:

  1. Right click on your “build.json” file
  2. “Open With”
  3. Select “Binary Editor”
  4. Remove the leading dots before the opening curly brace in your file.
  5. Save
  6. Build

Worked for me