I’m already using cocos for two weeks and 90% of time I’m trying to resolve problems, find documentation, understand why something doesn’t work at all instead of just creating a game.
Android is a tough beast to crack. I struggle with simple things getting stuff running where it just works on iOS and desktop platforms. I apologize for this.
Which NDK version are you using? What version of Android Studio? Are you trying to run on a hardware device or an emulator?
I do not use AndroidStudio but cocosd-x.3.17 needs android-ndk-r16.
Below lines were copied from cocos2d-x CI script: \tools\appveyor-scripts\build.ps1, \tools\appveyor-scripts\before-build.ps1
That means that here https://ci.appveyor.com/project/minggo/cocos2d-x/history this build passed and it was running. I also use similar PowerShell script to build my apps without any problem.
.\tools\appveyor-scripts\setup_android.py - downloads proper android sdk and android-ndk-r16
mkdir C:/dev
cd c:/dev
git clone https://github.com/cocos2d/cocos2d-x.git
cd cocos2d-x
# checkout official release cocos2d-x-3.17
git checkout cocos2d-x-3.17
python download-deps.py --remove-download=False
git submodule init
git submodule update --recursive --depth=1
# download proper version of sdk and android-ndk-r16b
python -u .\tools\appveyor-scripts\setup_android.py
# set environment
$env:APPVEYOR_BUILD_FOLDER=$pwd.Path
$env:ANDROID_HOME=$env:APPVEYOR_BUILD_FOLDER + "\..\android-sdk"
$env:ANDROID_NDK_HOME=$env:APPVEYOR_BUILD_FOLDER + "\..\android-ndk-r16b"
$env:ANDROID_SDK_ROOT=$env:APPVEYOR_BUILD_FOLDER + "\..\android-sdk"
$env:NDK_ROOT=$env:APPVEYOR_BUILD_FOLDER + "\..\android-ndk-r16b"
# build
cd $env:APPVEYOR_BUILD_FOLDER\tests\cpp-empty-test\proj.android\
./gradlew assembleRelease
I have no problems with building, I can’t run it.
Seems like only Creator can build an application, Android Studio can’t.
I have no idea how do you guys deal with it, to be honest.
I bet there is no way to build the same project for iOS?
Two run application you have to build application properly.
I gave you the steps that work for me and CI appveyor.
Those steps require git and Python 2.7, java (in my case jdk1.8.0_171). All other dependencies (including Android, NDK, SDK, build tools, compilers, gradle, …) are downloaded and set properly inside above script.
I guess that NDK 17.1.4828580 is your problem - try NDK 16
But maybe something else ( Android SDK, build tools, compilers, gradle, … )
Please try to build and run tests\cpp-empty-test\proj.android
I spend 99% of my development on desktop (windows or mac) - development/debugging on desktop is much faster than using emulator/device.
When everything works than:
How can I use engine when I’m not sure it works at all?
I can’t distribute my game with engine, I have to compile it.
But when engines isn’t able to do that, game is worthless.
Now I see that I can compile it only for Windows x64.
And I bet I have to thank Visual Studio for that.
UPD:
Tested with NDK 16 - the same issue, obviously.
Agree
Script similar to that I gave is run after each commit to my repo.
After each commit I have latest version of my application on my Android device ready to testing.
But still I spend 99% of my development on desktop