Attain Hassle-Free Acceptance of Your Google Play Application with PhoneGap.


I’ve been working on a mobile task management application that is currently in Open Beta on Android, and as December was waning, I knew I needed to add a few months to the beta expiration date that was currently set to expire on December 31, 2018. After extending the expiration, I compiled the app and found that Google Play would not accept it.

This particular app was written using TypeScript with PhoneGap. PhoneGap is a service by Adobe that lets you write your application once in JavaScript, sending the source up to PhoneGap where you can then compile it for Android, iOS and Windows Phone.

Google Requires A Minimum Target APK Level

The reason Google would not accept the app is because I hadn’t specified a minimum target APK level yet. I double-clicked the config file in the application to open the settings dialog. As you can see (below), it fields for minimum, maximum and target API levels but no settings for the APK level.

As I was searching the web for a way to set the target APK level, I found a number of articles that said to create a preference called android-targetSdkVersion with a value of 26. To do this, I right-clicked the config.xml file and selected View Code from the context menu.

I added the new preference alongside other preferences in the config file, as shown below.

After doing so, PhoneGap happily built the application with the same incorrect target APK level of 14 that it had before I set the preference. Since it was less than the minimum requirement of 26, Google still would not accept the build. For a while, this was quite confusing because the target APK level was correct (as you can see in the illustration above).

Solve the Problem by Locating the Proper config.xml File

It turned out, there was a second config.xml file located in the www folder.

This config.xml file contained just a few settings, and when I added the preference here, PhoneGap finally used it to build the application correctly for Android.

The bottom-line is that when you need to set the target APK level for PhoneGap, make sure that you modify the correct config file which is the one located in the www folder.

Have you used PhoneGap before? How has it simplified your app? Comment below.

Leave a comment

Your email address will not be published. Required fields are marked *