Find deprecated Android APIs

Proprietary

Search-only bundle that flags Android APIs the platform has deprecated or removed: findViewById, AsyncTask, the single-arg getColor/getDrawable/getColorStateList resource getters, the zero-arg Handler() constructor, kotlinx.android.synthetic imports, the moved kotlinx.android.parcel.Parcelize import, startActivityForResult/onActivityResult/requestPermissions, LocalBroadcastManager, deprecated Fragment lifecycle methods, Resources.getDrawable / getColor, startService, PreferenceManager, Vibrator.vibrate(long), Context.registerReceiver without flags, and MutableLiveData allocations.

org.openrewrite.kotlin.android.FindDeprecatedAndroidApis$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.android.FindDeprecatedAndroidApis$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Find findViewById call sites
  2. Find AsyncTask instantiations
  3. Find AsyncTask.execute / executeOnExecutor calls
  4. Find deprecated Context.getColor/getDrawable/getColorStateList calls
  5. Find resources.getDrawable(...) (one-arg) calls
  6. Find resources.getColor(...) (one-arg) calls
  7. Find Handler() constructor calls without an explicit Looper
  8. Find kotlinx.android.synthetic.* imports
  9. Find kotlinx.android.parcel imports
  10. Find startActivityForResult calls
  11. Find onActivityResult overrides
  12. Find direct requestPermissions(...) calls
  13. Find onRequestPermissionsResult overrides
  14. Find LocalBroadcastManager.getInstance(...) usage
  15. Find Fragment.setRetainInstance(true) calls
  16. Find FragmentManager.executePendingTransactions() calls
  17. Find Fragment.onAttach(Activity) overrides
  18. Find Fragment.onActivityCreated overrides
  19. Find AlertDialog.Builder(this) constructions
  20. Find startService(...) calls
  21. Find PreferenceManager.getDefaultSharedPreferences(...) calls
  22. Find android.preference.PreferenceManager imports
  23. Find Vibrator.vibrate(long) (one-arg) calls
  24. Find Context.registerReceiver(...) calls
  25. Find MutableLiveData allocations