Tag Archives: Gradle

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 Kotlin language, please read this Josh Skeen and David Greenhalgh (2018). Kotlin Programming – The Big Nerd Ranch Guide. Pearson Education book first.

After that please read this Bill Phillips et al. (2019). Android Programming – The Big Nerd Ranch Guide. Big Nerd Ranch Guides book.

After that please read
– this Cay S. Horstmann (2019). Core Java. Volume I – Fundamentals. Pearson book, and
– this Cay S. Horstmann (2019). Core Java. Volume II – Advanced Features. Pearson book.

The second option for learning mobile application development is iOS programming.
Please read
– this Mikey Ward (2020). Swift Programming – The Big Nerd Ranch Guide. Big Nerd Ranch book or
– this Matt Neuburg (2021). iOS 14 Programming Fundamentals with Swift. O’Reilly Media book first.

After that please read
– this Christian Keur and Aaron Hillegass (2020). iOS Programming – The Big Nerd Ranch Guide. Big Nerd Ranch book or
– this Jonathon Manning et al. (2018). Learning Swift – Building Apps for macOS, iOS, and Beyond. O’Reilly Media book.

A complementary part of this option is Objective-C. Please read
– this Stephan G. Kochan (2014). Programming in Objective-C. 6th Edition. Addison-Wesley book or
– this Neil Smyth (2012). Objective-C 2.0 Essentials book.

The third option for developing mobile applications is

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

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

(iii) to leverage HTML/CSS/Javascript language and the React Native framework; please read this Alex Banks and Eve Porcello (2020). Learning React Modern Patterns for Developing React Apps. O’Reilly book; then read this Bonnie Eisenman (2016). Learning React Native: Building Native Mobile Apps with JavaScript book; or

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

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

If you already have a background of C or C++ and want to develop games for both Android and iOS then please read
– this Roger Engelbert (2015). Cocos2d-x by Example: Beginner’s Guide book or
– this Raydelto Hernandez (2015). Building Android Games with Cocos2d-x book.

It seems that there are a lot of topics to learn. I am totally new to mobile programming. What are the only essential knowledge should I learn in order 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 learning about mobile application development please click Topic 10 – Software Requirements to continue.