Tag Archives: Cocos2d-x

Software Configuration Management Example

Context:

  • You have an application that was developed 7 years ago and there have been no updates since then.
  • Your application was developed with python 2.7, Java 8, Android SDK 7.0 (API level 24), tools_r25.2.5, ndk-r13, ant 1.9.4, and cocos2d-x 3.13.1 (Sadly its development was discontinued).

Problem:

  • Google Play requires you to update your app to target Android 12 (API level 31).

Experience:

1. You tried installing all the tools and compiling the code. Luckily no problem happened.

2. You checked for Java and Gradle compatibility. You decided to stay with Java 8 because cocos2d-x only works best with Java 8. It means that your Gradle version must be less than 4.3. So you selected version 4.1 for Gradle.

3. You checked for Gradle and Android Gradle Plugin compatibility. You realized that you can only use Android Gradle plugin version 3.0.0 or less. So you selected version 3.0.0 for Android Gradle plugin.

4. You searched for “gradle-wrapper.properties” and updated Gradle to version 4.1.

#distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

5. You searched for “build.gradle” and updated Android Gradle plugin to version 3.0.0.

buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
// classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:3.0.0'
...

6. You set your app targetSdkVersion to 31, created APK file and uploaded it to Google Play.

7. Google Play complained about “android:exported” property for activities with “intent-filter. You added “android:exported” property to your AndroidManifest.xml but the problem still persisted.

8. You suspected that Google Play Services library caused the issue because your app uses Firebase Ads that depends on Google Play Services library. So you tried removing Firebase Ads and you were happy when Google Play did not complain anymore.

9. Then you decided to add Google AdMob SDK to your app to replace Firebase Ads. You set your minSdkVersion to 19, your targetSdkVersion to 33 and follow the instructions until you got many build errors with play-services-ads:22.4.0.

10. You tried using latest SDK tools (26.1.1) but you got “The “android” command is deprecated.” issue. cocos2d-x development had been discontinued so you had to revert back to 25.2.5 SDK tools.

11. You tried downgrading play-services-ads to a lower version using trials and errors and luckily you found that version 17.2.1 worked.

12. You created APK file, uploaded it to Google Play, and sent for review. Google Play complained that you must have included 64-bit and 32-bit native code in your app.

13. Luckily, you could build cocos2d-x 3.13.1 for 64-bit architectures by searching for “Application.mk” and set APP_ABI :=armeabi-v7a arm64-v8a, and searching for “gradle.properties” and set PROP_APP_ABI=armeabi-v7a:arm64-v8a, and searching for “build.gradle” and set ndk.abiFilters ‘armeabi-v7a’, ‘arm64-v8a’ under defaultConfig. You also noticed that cocos2d-x 3.13.1 has not supported x86_64 achitectures but at least finally you could be able to publish your app to Google Play.

Lessons learned:

1. Select mature and long-term support tools for your application development.

2. Always package the tools that you used together with the application source code.

3. Always document source code compilation steps and configuration setting locations.

4. Regularly update your application if possible.

Topic 9 – Introduction to Mobile Application Development

Why do I need to learn about mobile application development?

Desktop applications are very useful but their deployment and updating are daunting. Web applications overcome many limitations but you still need a workstation to work with it. This is often a PC or MAC that is too large and heavy to bring on-the-go.

Nowadays most of us always bring a mobile device with us everywhere. It’s very convenient if we could use our daily software inside our mobile devices. In order to  leverage our mobile devices we need to develop software for them.
Therefore you need to learn mobile programming.

What can I do after finishing learning mobile programming?

You can create applications like WhatsApp, Instagram or games like Temple Run, Angry Birds, Fruit Ninjia.

How interesting! What should I do now?

Mobile programming requires a lot of reading. You have to master at least a programming language and a mobile platform. Currently, there are 2 major platforms for mobile development: Android and iOS. There are 3 options for developing a mobile application:
– native Android application or
– native iOS application or
– hybrid mobile application.

The first option for learning mobile programming is Android programming.
If you are not familiar with the Kotlin language, please first read this book to learn the core concepts of Kotlin: Josh Skeen and David Greenhalgh (2018). Kotlin Programming – The Big Nerd Ranch Guide. Pearson Education.

After that, please read this book to learn how to use Android frameworks and libraries to create interactive mobile applications: Bill Phillips et al. (2019). Android Programming – The Big Nerd Ranch Guide. Big Nerd Ranch Guides.

After that, please read the two books below to learn about Java concepts, as Java is still widely used in many Android frameworks, libraries, and legacy systems:

The second option for learning mobile application development is iOS programming.
Please first read one of the following books to learn how to use iOS frameworks and libraries to create interactive mobile applications:

After that, please read one of the following books to learn how to create more sophisticated iOS applications:

The Objective-C language is still used in many legacy frameworks, libraries, and systems, as well as for accessing low-level APIs. Please read one of the following books to learn the core concepts of Objective-C:

The third option for developing mobile applications is either

(i) to leverage C# language and the Xamarin framework; please read this book: Charles Petzold (2016). Creating Mobile Apps with Xamarin.Forms; or

(ii) to leverage HTML/CSS/Javascript language and the Ionic framework; please read this book: Jeremy Wilken (2015). Ionic in Action: Hybrid Mobile Apps with Ionic and AngularJS; or

(iii) to leverage HTML/CSS/Javascript language and the React Native framework; please read the books below:

(iv) to leverage Dart language and the Flutter framework; please read this book: Priyanka Tyagi (2021). Pragmatic Flutter. CRC Press.

Mobile is a great environment for games because of its mobility. If you are interested in developing games for Android please read this book: Jayme Schroeder and Brian Broyles (2013). AndEngine for Android Game Development Cookbook.

If you already have a background in C or C++ and want to develop games for both Android and iOS, please read one of the following books:

It seems that there are many topics to learn. I am completely new to mobile programming. What essential knowledge should I focus on to reduce my learning time?

You could focus on these topics first:

  • How to install necessary tools and create a Hello World application.
  • What is the physical structure of a project and how to build it using both IDE and command line?
  • How to deploy an application to Play Store or App Store.
  • How to create UIs, transfer data between UIs, compose new UI using existing UIs using SDK features or frameworks.
  • How to use built-in or 3rd party libraries to interact with camera, microphone, media player, GPS device, local files, local databases, external databases and external services.
  • How to call native code libraries to improve performance or access low-level features.

Terminology Review:

  • Android.
  • iOS.
  • Native Apps.
  • Hybrid Apps.
  • Build Tools.
  • Views.
  • Controls.
  • Layouts.
  • Game Programming.
  • Game Development.
  • Native Development Kit.
  • Google Play Console.
  • App Store Connect.

After finishing mobile application development, please click on Topic 10 – Software Requirements to continue.