Fork us on GitHub

Tip: Disable Google Play Services

Reduce app size and increase compatibility
Tip: Disable Google Play Services

Tip: Disable Google Play Services

Google Play Services is a proprietary set of tools that Google licenses to vendors under limited conditions. In recent years more and more features go into Google Play Services making it harder to build an app without it.

In our effort to "do the right thing" we include some of the Google Play Services tools into applications to remain compatible with code that requires these libraries. This also makes some features (such as location) work better. However,if you don’t use: Ads, Push, Maps or Location then you might not need Google Play Services at all…​

At this time the overhead of including this subset of Google play services is 1.5mb to your final APK size. This isn’t much but if your app isn’t big then this might double its size and slow down the cloud build process.

Once you declare that one Google play service isn’t needed we implicitly assume you understand what you are doing and let you pick the services manually so just setting the build hint reduced those 1.5mb from the app size with no ill effect.

In fact one of the services we include is the ads service and Google notices that when you submit an app. It produces a warning if you add an app with the ads framework but declare that you don’t have ads, this small trick removes it.

Check out the build hints section in the developer guide for more information on how you can deeply customize Codename One.

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.