In this post we will see how to export your Gdevelop project to android or ios manually using cordova. Gdevelop provides a web service for export to android or ios. But it is a paid service it only provides 2 exports/day. By paying for subscription you support developement of Gdevelop but it you don't want to pay, Gdevelop provides you with an offline option.
We will see how we can export Gdevelop project as a Cordova project and build it using a cordova by ourselves locally on our computer. Obviously for FREE!!. Lets get started.
Prerequisite
I am assuming you have Android SDK installed on computer.If not then download it and install it first.I am not covering it here as it is a general thing and you can find plenty of tutorials and also that it will make this post unnecessarily longer.
Also cordova requires node.js installed on your computer..Installing is as easy as downloading the installer and running. Link : https://nodejs.org/en/
After installing the node.js. Open the the node.js command prompt and type command,
install -g cordova
This will install cordova on your computer in few minutes.
Lets Do It
Step 1: Export Game as Android Project
First Export your Gdevelop project as a Cordova project.
Go to file-> Export
Choose a folder and click Package.
Step 2: Launch Node command prompt and Navigate to Export folder.
Now run node.js terminal.
Step 3: Add platform
Now type in following command(s)
cordova platform add ios in case you want to export your game to iOS otherwise run
cordova platform add android to export your game to Android.
It will take some time and will create new folders on your project's directory platforms/android (or platforms/ios for ios). It will contain project that can be imported on Android Studio or other IDEs.
I did it for android and you should be able to see output shown below in few minutes
Step 4: Build It for platforms
Now run command cordova build android to build it for android or cordova build ios to build it for ios. Alternatively you can run cordova build to build it for both at the same time.
- You can find the .apk in path platforms/android/app/build/output/apk/debug/debug.apk
Step 5: Run your Game
You can run your game directly from the command line if don't want to do tedious work of transferring the apk or ios executable to the your phone. There are two ways to do it.
First to emulate your device.To emulate android device run command,
cordova emulate android
Read this if you are facing difficulties, https://cordova.apache.org/docs/en/2.9.0/guide/getting-started/android/
and for ios device run command
cordova emulate ios
or run the app on a specific simulator using
target: cordova run ios --target="iPhone-8".
Second way is to run it directly on phone. I don't have an iphone so i have not tried on iphone but for android type in command.
[NOTE: you should have adb installed and make sure usb debugging is on in developer options in
your phone.]
cordova run android
If every thing went right and you should be able to see the game on your phone's screen.
So, this way you can export your Gdevelop games to mobile platforms any number of times a day, that too for free. I hope it was helpful.
Thanks:).
npm install -g cordova
ReplyDeletei guess!