Cocos console: run android in release mode

Cocos console: run android in release mode
0.0 0



I have been testing the new cocos console and it’s awesome!
With android, the run command works great in debug mode, but in release mode it fails at the end because the apk is unsigned (I think :P).


Is there a way to sign the release apk when the run command is executed and before beign installed on the android device?

Deploying to android in release mode broken (3.0RC1 console)

If is filled like this:

cocos run command signs and zip aligns TespApp-release-unsigned.apk, generating the final apk TespApp-release.apk.

But this final apk is ignored in the deploy stage:

     [echo] Signing final apk...
 [zipalign] Running zip align on final apk...
     [echo] Release Package: C:\dev\TespApp\\bin\TespApp-release.apk




Total time: 7 seconds
Move apk to C:\dev\TespApp\bin\release\android
build succeeded.
Runing command: deploy
Deploying mode: release
installing on device
running: 'C:\dev\android\adt\sdk\platform-tools\adb uninstall com.test.TespApp'

running: 'C:\dev\android\adt\sdk\platform-tools\adb install "C:\dev\TespApp\bin\release\android\TespApp-release-unsigned.apk"'

5067 KB/s (2963170 bytes in 0.571s)
        pkg: /data/local/tmp/TespApp-release-unsigned.apk


Is this problem going to be considered for a fix?



To fix this problem you have to change two strings of code:

  1. in file "\tools\cocos2d-console\plugins\"
    change "apk_name = ‘%s-%s-unsigned.apk’ % (project_name, self._mode)"
    with “apk_name = ‘%s-%s.apk’ % (project_name, self._mode)”

  2. in file "\tools\cocos2d-console\plugins\project_compile\"
    change "apk_name = ‘%s-%s-unsigned.apk’ % (project_name, build_mode)"
    with “apk_name = ‘%s-%s.apk’ % (project_name, build_mode)”


But that fix wouldn’t work with unsigned apks!

I think it should detect if a signed apk has been built and only in that case use the signed one.


Do you really need an unsigned apk built in release mode?


Nope! (in fact I can’t even install it :stuck_out_tongue: )


I couldn’t too, but I fixed the cocos script and now I can :smiley:


It works! Thanks!


Hi, I managed to the get the win32 version up and running quite easy but I have now spent two weeks trying to get a simple hello world work for android with cocos 2d c 3.13 without sucess, latest error is INSTALL_PARSE_FAILED_NO_CERTIFICATES but I don’t have any file as the one mentioned above.

I have built the apk, but when I try to install it either on phone or in emulator I get errors and cannot even start debugging.

To fix this problem you have to change two strings of code:
1) in file "\tools\cocos2d-console\plugins\"
change “apk_name = ‘%s-%s-unsigned.apk’ % (project_name, self.mode)”
_with "apkname = ‘%s-%s.apk’ % (project_name, self.mode)"

2) in file "\tools\cocos2d-console\plugins\project_compile\"
change "apk_name = ‘%s-%s-unsigned.apk’ % (project_name, build_mode)"
with “apk_name = ‘%s-%s.apk’ % (project_name, build_mode)”

Is cocos depricated for android? I have a few years old codebase that needs upgrading, but so far no sucess even though I tried every guide found on the internet. Have anyone any news on this issue?