I code on C++ and compile on Windows 7 for Android in command prompt.
I used last stable cocos2d-x v. 3.16 with sdkbox 2.3.17.7
Now looks like I succeed to migrate one my project (debug version) to cocos v. 3.17.2 with sdkbox 2.4.3.3.
Installed packages: admob facebook iap sdkboxads gpg googleplayservices (v2.4.3.3)
First problem: I lost a lot of time searching for the code crashing my app. Here it is:
bool HelloWorld::init()
{
// a lot of code
f();
return true;
}
int HelloWorld::f()
{
// return 0; // so - no proper return; So, I need compiler not to crash my app and/or to prompt me about bug at this row;
}
Old cocos2d-x 3.16 command prompt compiler generated app which not crashed with this code. But with newer it crashes.
That error log:
I DEBUG : r0 61a8a9a8 r1 61a8a9a8 r2 00000008 r3 601a750c: /system/bin/debuggerd
D ADB_SERVICES: closing because is_eof=1 r=-1 s->fde.force_eof=0: /sbin/adbd
I DEBUG : r4 1da00001 r5 5f32a228 r6 1b979e91 r7 609bc910: /system/bin/debuggerd
W ADB_SERVICES: entered. LS(95175) fd=20: /sbin/adbd
I DEBUG : r8 609bcad8 r9 608bef14 sl 5bb3c148 fp 609bcaec: /system/bin/debuggerd
I DEBUG : ip 608671a0 sp 609bc6c4 lr 600dc63b pc 600dc8aa cpsr 60070030: /system/bin/debuggerd
I DEBUG : : /system/bin/debuggerd
I DEBUG : backtrace:: /system/bin/debuggerd
I DEBUG : #00 pc 0028a8aa /data/app-lib/org.cocos2dx.t2-1/libMyGame.so (HelloWorld::f()+7): /system/bin/debuggerd
I DEBUG : #01 pc 0028a637 /data/app-lib/org.cocos2dx.t2-1/libMyGame.so (HelloWorld::init()+1334): /system/bin/debuggerd
I am_crash: [673,0,org.cocos2dx.t2,8961606,Native crash,Illegal instruction,unknown,0]: system_server
V Provider/Settings: from settings cache , name = dropbox:SYSTEM_TOMBSTONE , value = null: system_server
V Provider/Settings: from settings cache , name = dropbox:data_app_native_crash , value = null: system_server
I am_finish_activity: [0,1122386560,77,org.cocos2dx.t2/org.cocos2dx.cpp.AppActivity,crashed]: system_server
Second problem: then I replace code file with its old version â looks like compiler do not recompile it (because it is not new). Update: Iâve succeed to build release version only after the only change: updating date+time of all files in âClassesâ to current.
Third problem: what about pre-build libraries for Android and Win32 (Visual Studio)? Had someone succeed?
Could someone recommend some settings for the new command_prompt compiler? (Thank you. It is NOT urgent)
Having debug build I could not create release build.
Iâve succeed to build the release version only after the only change : updating date+time of all files in âClassesâ to current.
"clean and re-compile the whole project" â too long.
The crash you experienced is not a bug. It happened because you didnât do a clean/rebuild, you simply replaced certain source files, and the compiler didnât pick up the changes. Mixing up generated object files like this would cause the most random issues. The fact that you had to âtouchâ the files (updating their date/time stamp) to force the compiler to do a rebuild, which resulted in the crash no longer happening, proves that point. You really should have done a clean/rebuild instead.
Thatâs not a valid reason to avoid doing a clean and rebuild, and when you donât, as you experienced, you end up with undefined behavior, especially when you change something so significant as a new version of Cocos2d-x.
Have you tried building your application with Android Studio first to check if it actually works? If it doesnât work via Android Studio, then youâll have to hunt down the reasons why. If it does work, then there is little reason for it to not work via the command line either.
One thing to check for, if youâre building with the Windows CLI, then the path to the location of gradlew.bat may be missing from the environment path settings, so check that first. There should be an entry like this in there:
Oh yes, of course! Then (running gradlew.bat from myProject folder):
c:\Develop\myProject>proj.android\gradlew tasks
> Task :tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.
Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'myProject'.
components - Displays the components produced by root project 'myProject'. [incubating]
dependencies - Displays all dependencies declared in root project 'myProject'.
dependencyInsight - Displays the insight into a specific dependency in root project 'myProject'.
dependentComponents - Displays the dependent components of components in root project 'myProject'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'myProject'. [incubating]
projects - Displays the sub-projects of root project 'myProject'.
properties - Displays the properties of root project 'myProject'.
tasks - Displays the tasks runnable from root project 'myProject'.
To see all tasks and more detail, run gradlew tasks --all
To see more detail about a task, run gradlew help --task <task>
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
so it is not possible to execute task âcleanâ:
c:\Develop\myProject>proj.android\gradlew clean
FAILURE: Build failed with an exception.
* What went wrong:
Task 'clean' not found in root project 'myProject'.
Alas I do not use Android Studio, only Visual Studio for now.
Thank you.
This is with Android Studio 3.4.1. The gradlew clean command works when run inside the Android Studio terminal, so Iâm at a loss as to why itâs not working for you.