Android app development tidbits  

  • If you love DataBinding, don't bother ViewBinding
  • PopupWindow is rarely useful because what it can do usually can be done by making a layout visible/invisible, with customized Dialog (i.e. extending Dialog).  Inflating a layout can be a problem for PopupWindow  from a fragment. Spinner often has an inflation problem.
  • Navigation Drawer can be used to replace the app bar though it is not its original purpose.  When an navigation drawer is used, using an app bar with the sole function of opening the drawer is hard to be justified.  Use an arrow or hamburger icon instead.
  • There are alternative to Google Play to publish free apps.  Opera Software is one of them.
  • Use Android system colors like this: android:background="@android:color/darker_gray".  Colors like darker_gray can be found here.
  • Android  SDK tools are platform independent and are required no matter which Android platform you are developing on.
  • Android SDK Platform-tools are customized to support the features of the latest Android platform. They are backward compatible so that you always use the latest update of Android SDK Platform-tools even your app targets older Android platforms.
  • Android SDK Build-tools used to be components of Android SDK Platform-tools. They have been decoupled from Android SDK Platform-tools, so that the build tools can be updated independently of the integrated development environment (IDE) components.
  • There are different ways to use third-party library jars.  Following the official way  will prevent a lot of potential troubles.
  • Google Play service is needed to test in-app billing. Genymotion emulators with Google Apps (there are two currently - one for phone and one for tablet) work with Google Play service, hence the testing of in-app billing.
  • When imlementing in-app billing by following Google's instructions, it is critical to put IInAppBillingService.aidl and the helper java files in package com.android.vending.billing.  Otherwise, one would get an exception: SecurityException Binder invocation to an incorrect interface (Inapp Billing).
  • When following the instructions of Google to set up Goolge Play Service SDK, one needs to select the Copy option for importing the SDK library project in lieu of copying the folder first. 
  • To access an app's private data with n DDMS, one needs to run some adb shell commands.  The device needs to be rooted.
  • One can download a set icons from Google, or get icons of an Android version (e.g. 21) from C:\Program Files (x86)\Android\android-sdk\platforms\android-21\data\res\
  • Android normally does not allow an app to take a screenshot for security reasons.  
  • SurfaceView displaying H.264 video does not provide any means to capture its image.  None of the methods to capture a View's image content works with H.264 video.

 Use ProGuard is an art, not a science.  One needs to experiment with it to find the right ProGuard configuration.

  • Use the new two-configuration-file scheme.
  • Library jars may need to be filtered by using "-libraryjars libs\thirdparty.jar"  If a library jar is used by library project that is used by the app, it may or may not need to be filtered.  The filter syntax is "-libraryjars ..\libraryproject\libs\thirdparty.jar"
  • To use Gson, reference the recommended configuration
  • It is critical to exclude classes used for serialization (use -keep class net.me.android.package.** { *; }, or -keep  net.me.android.app.Foo$innerClass { *; })
  • If a jar file such as ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar causes duplicate class definitions for org.xmlpull.v1.*, take xmlpull jar out of the the original jar with a zip file tool such as 7-zip).

To help app reviews:

  • AndroidKi It is unclear how to earn points to get a review.

For testing Android app, DigiLand tablets from Best Buy are not bad choices.  Its 10" model has uses beyond testing.  They represent inexpensive generic Android devices. so if an app works on them, most likely it will work on other Android devices.

iVew 10" Table with Android 7.1 looks like a good choice for app testing too.

This article was updated on 15:35:04 2024-12-27