I've been giving a shot at doubling the graphics' resolution


Mostly though, I'm still figuring a comfortable (and functionnal) setup to code and export for Android.
Remember what I said about cocos2d-x working very well? Wellll, turns out that story belongs to the past.
Here's a recollection of the process and obstacles I encountered in my quest to make it work again, hoping it might help others. I'm on Windows 7, and I'm seeking to code in javascript and export for Android (for now).
- Installed Android Studio, used its Android SDK to install the SDK for Android API Level 10 (Android 2.3.3, Gingerbread)- which is the lower version supported by Android and also by my phone (a Nexus One with 2.3.4).
- Downloaded/unziped the latest version of...
. cocos2d-x for windows (3.13)
. the java sdk (JDK)
. apache ant
. android NDK
. Python 2.7
- Ran setup.py at the root of the cocos2d-x folder, provided paths to ant, android NDK and android SDK when prompted to.
- In a windows console (run -> cmd), used the 'new' command (e.g. cocos new -l js -d C:\dev Cocostest --portrait) to create a new helloworld template project named 'Cocostest'.
- Still in the console, cd'ed to the root directory of Cocostest and used the 'compile' command to compile the template to an installable .apk file I could test. e.g. cocos compile -p android --ap android-10
In theory, at this point I would have had a functionnal test
HOWEVER, NOPE
- When trying to launch 'setup.py', the command line interface insisted that 'python' was not a reckognized commandSOLUTION : Add the root of the Python directory to the 'Path' environment variable e.g C:\Python27 (In the 'environnement variables' part of windows control panel)...
AND
Make sure to close and reopen the command line interface for the change to be taken into account.
- Providing the root of the ant directory to cocos would not create a new environment variable.SOLUTION : Use the ant\bin folder instead of the root
- I can't remember if it was when using the 'new' or 'compile' command, but there was a 'command not reckognized' error involving java or javac.SOLUTION : It's trying to use a previously installed JRE instead of the new JDK. Define a new system variable named JAVA_HOME and make it point to the root of the JDK directory. Then add %JAVA_HOME%\bin to the 'Path' variable.
- Can't test the app on my phone using ADB (Adobe Debug Bridge) to install it, since its USB connection doesn't work anymore.SOLUTION :
. Manage to copy the apk file to the phone's SD Card (In my case, using a small USB reader)
. Reinstall the SD card in the phone, boot it, and in Android's default navigator's adress bar, write "file:///sdcard/Cocostest-debug.apk" to install it.
ANOTHER 'SOLUTION':
Use an Android Emulator. Create devices using Android Studio's AVD (Android Virtual Device) Manager, and connect to them with adb as you would with an actual plugged in device.
** In order for the adb command to be reckognized, you need to add it to the 'Path' environment variable e.g. C:\Android\Sdk\platform-tools
That said, So far I never managed to have a build that worked on an emulator, while a build eventually did work on my phone. The Android version on both is similar, and the emulator is supposed to imitate a Nexus One.
- Once I managed to build something, well, the installed app didn't work on my phone. All I got was a brief black screen.SOLUTION : I have no clue as to the cause of this, but after several inconclusive tests trying to fiddle with some pieces of the puzzle such as the NDK, I decided to simply revert to the version of Cocos2d-x that had brought me success back in the days (v3.8.1). This led to a few more problems:
- 'cocos compile' would end prematurely because of error(s) involving the NDK.SOLUTION : Revert to the version of the NDK that did work back in the days (r10e). Hopefully, that folder was still hanging around. Change the NDK_ROOT environment variable accordingly. Try to compile again.
At this point, I managed to get a functionnal build! I didn't realize it at start, though, because the app didn't work on the emulator as previously stated. Indeed, prior to this realization, the plan was to first test on the emulator until I got a functionnal build, then move to the actual phone.
Happy, I tried to compile again with the same setup and then...
- My computer started to straight up shutdown in the middle of the compile process. No warning, no blue screen. It seemed consistent. Awesome!SOLUTION :
First, I wanted to know at what point of the process this happened, since things moved pretty fast in the console. I ended up finding how to redirect the output of the a command to a text file.
It goes like this : cocos compile -p android --ap android-10 > C:\dev\cocoslog.txt
To get both 'standard' and 'error' output, use: cocos compile -p android --ap android-10 > C:\dev\cocoslog.tx > cocoslog.txt 2>&1
More info about that here:
http://www.robvanderwoude.com/redirection.phpIt turned out that the crash actually never happened at the same moment, which made me suspect it might be an hardware problem e.g. the computer overheating.
Turns out, I was right! I used
Speedfan to monitor temperatures during the compile process. Basically it went from 40 to 86 Celcius before shutting down.
I don't know the cause for sure, but I don't think this is a normal situation at all. It's especially bizarre that it's the only circumstance that I know in which said computer would overheat.
Fortunately, I have another one around. I moved to set it up the same way. I copied the whole cocos2d-x 3.8.1 folder, as well as that of the NDK r10e, to that machine. And I tried again. But then...
- At the start of the compile process, got a 'file not found' error when trying to run 'C:\ndk\ndk-build'SOLUTION: I figured there migh be a problem with the NDK, since I copied it from a 64-bit environment to a 32-bit one. So I downloaded that version of the NDK, which came as an exe rather than a zip (
http://dl.google.com/android/ndk/android-ndk-r10e-windows-x86.exe - see the trick here:
http://stackoverflow.com/questions/6849981/where-do-i-find-old-versions-of-android-ndk), ran that exe to extract it, replaced the old one with it, and launched the compile process again.
Let's test the result!
"Sorry, the application has closed unexpectedly".

Android Debugger says:
694 Android Runtime
java.lang.UnsatisfiedLinkError : Couldn't load cocos2djs: findLibrary returned null
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:288)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:303)
To be continued!