Android

Disable or Enable packages using adb

Reference

Connect device using USB or WiFi.

List installed packages:

adb shell pm list packages

Find the name of package to disable — usually of the form com.developer.appname.

To disable package:

adb shell pm disable-user --user 0 <package_name>

To enable it again:

adb shell pm enable <package_to_enable>

It is also possible to uninstall a package but this will require the package APK if a reinstall is required. The command to uninstall is:

adb shell pm uninstall -k --user 0 <package>

-k to keep data and cache.

Remove bloatware

Universal Android Debloater
https://gitlab.com/W1nst0n/universal-android-debloater/

Backup APKs

The debloat script has an option to backup apks. To do this manually:

adb backup -apk -all -system -f "${PHONE:-phone}-`date +%Y%m%d-%H%M%S`.adb"

Manual removal of apps on Xperia Z5 compact

Stock ROM (Android 7.1) had apps pre-installed that I do not need or use. These are the steps I followed to disable them.

Note: It should have been possible to disable apps using adb following the steps mentioned above but that will require the package ID of all the apps. As that would be time consuming, I followed this approach (might not be the most efficient).

For apps that can be uninstalled

Uninstall them manually from Settings → Apps.

Amazon, AVG, Browser (small app), Facebook, Lifelog, News suite, Office suite, Playstation app, Sketch, Sticker creator and TrackID.

For apps that cannot be uninstalled

Disable them manually from Settings → Apps.

Movie creator, Lounge, Email, Chrome, Smart connect, Youtube extension, Youtube karoake extension, Xperia Japanese keyboard, Wikipedia extension, Weather, Weather widget, Top contacts provider, Top contacts widget, Tasks, Talkback, Style cover widget, Sound photo, Print service recommendation service, Photo Analyzer, Podcast, Photo and video widget, Photo slideshow, Multicamera, Japanese keyboard layout, Google lyrics extension, Google text-to-speech engine, Face in picture, Creative effect, AR mask, AR effect, Active clip and Calendar.

For apps that cannot be uninstalled or disabled

Use adb to disable them.

Note: Do not disable com.sonyericsson.extras.liveware
(Clock fails to start if you do so).

Command to disable app:

adb shell pm disable-user --user 0 com.facebook.appmanager

Similarly for the rest:

com.facebook.system
com.google.android.apps.photos
com.google.android.googlequicksearchbox
com.google.android.music
com.google.android.videos
com.mobisystems.fileman
com.realvnc.android.remote
com.sonymobile.xperiatransfermobile
com.sonymobile.styleportrait.addon.blue
com.sonymobile.styleportrait.addon.bubble
com.sonymobile.styleportrait.addon.daily
com.sonymobile.styleportrait.addon.paint
com.sonymobile.styleportrait.addon.red
com.sonymobile.styleportrait.addon.star
com.sonymobile.styleportrait.addon.sunshine
com.sonymobile.styleportrait.addon.suntan
com.sonymobile.mirrorlink.manualswitch
com.sonymobile.mirrorlink.server11
com.sonymobile.mirrorlink.system
com.sonymobile.xperialounge.services
com.sonymobile.xperiaservices
com.sonymobile.support
com.sonymobile.googleanalyticsproxy
com.sonymobile.getmore
com.sonymobile.getmore.client
com.sonymobile.gettoknowit
com.sonymobile.exchange
com.sonymobile.dualshockmanager
com.sonymobile.entrance
com.sonymobile.anondata
com.sonymobile.enterprise.service
com.android.wallpaper.livepicker
com.sonymobile.mx.android

Android Studio and SDK

Android Studio install instructions
Git with Android Studio

Configuration

Configure .bashrc:

# Android setup
# Required to fix libGL error
# export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
export ANDROID_HOME=~/Android/Sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export PATH=$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH

Fix for libGL error

Reference

For Android Studio, create a shell script ~/bin/android-studio.sh with the following:

#!/bin/bash
export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
~/Programs/android-studio/bin/studio.sh %f

and then update the launcher command in
~/.local/share/applications/jetbrains-studio.desktop