Android build failed with syntax error in editor

Hello,

I use Cocos Creator v2.0.9. When I try to build project for Android following errors appears and the build fails:

SyntaxError: Unexpected token
in JSON at position 1211
at JSON.parse ()
at Object.l [as readJson] (C:\CocosCreator\resources\app.asar\editor\builtin\cocos-services\panel\utils\utils.js:1:649)

It seems that error is inside the app.asar archive which I don’t know how to inspect.

I have already tried to create a new clear project, repair and also reinstall Cocos creator but nothing helped. I also tried to remove and add again i18n plugin, which I use in my project. Installation of upgrade editor to v2.0.10 also didn’t help… a similar error, which is discussed here, has appeared. The only solution in the mentioned discussion was reinstalation of OS, which I cant make now.

Any ideas on how to solve these errors?
Or maybe… how to properly and completely uninstall Cocos creator? The setup utility probably does not make the uninstalation properly.

Thanks for any reply!

1 Like

Hi, I have the same problem.

Build Failed: SyntaxError: Unexpected token
in JSON at position 1211
at JSON.parse ()
at Object.l [as readJson] (C:\Tools\CocosCreator-2-0-9\resources\app.asar\editor\builtin\cocos-services\panel\utils\utils.js:1:649)
at Object.readEnableService (C:\Tools\CocosCreator-2-0-9\resources\app.asar\editor\builtin\cocos-services\panel\utils\serviceConfig.js:1:662)
at Object.execInstallNativePlatformScript (C:\Tools\CocosCreator-2-0-9\resources\app.asar\editor\builtin\cocos-services\panel\utils\ccServices.js:1:2875)
at s (C:\Tools\CocosCreator-2-0-9\resources\app.asar\editor\builtin\cocos-services\main.js:1:315)
at C:\Tools\CocosCreator-2-0-9\resources\app.asar\editor-framework\lib\share\polyfills.js:1:286
at Promise ()

This problem is on Windows v2.0.9 when I build my project but also when I build HelloWorld. My colleague has this problem on v2.0.10. I also tried to remove i18n package with no difference.

1 Like

I finally solved the original problem by upgrading Cocos creator to 2.1.3 version.

I had the same problem

I found that the json file settings/services.json is corrupt. Value of element package_version_desc is invalid due to a wrong line break