< Back to all hacks

#24 Don't Kill GMS (WiFi Routing Dependency)

Debloat
Problem
Killing GMS frees 270 MB but breaks WiFi routing — default gateway route disappears.
Solution
NEVER kill com.google.android.gms or gsf on Android 6. GMS manages DHCP routing.
Lesson
GMS manages DHCP routing on Android 6. No GMS = no internet (even with static IP initially).

Context

Google Mobile Services (GMS) is the single largest RAM consumer on the Moto E2 — 270 MB across multiple processes (com.google.android.gms, com.google.android.gms.persistent, com.google.process.gfirst). When RAM optimization started, killing GMS seemed like the obvious biggest win.

The first kill attempt freed 270 MB instantly — then all internet connectivity died. No DNS, no HTTP, no ping. Even though the phone still had a WiFi IP address.

Implementation

The issue is that on Android 6, GMS manages the DHCP client that populates the routing table. When GMS dies, the default route in routing table 1030 is removed:

# Before killing GMS:
ip route show table 1030
# default via 192.168.1.254 dev wlan0 proto dhcp

# After am force-stop com.google.android.gms:
ip route show table 1030
# (empty — no default route)

# Result:
ping 8.8.8.8
# Network is unreachable

The phone retains its IP address (wpa_supplicant handles WiFi association independently) but has no route to the internet. The route is proto dhcp — managed by GMS's DHCP client.

The workaround: Configure a static IP on the router's DHCP reservation, then the route becomes proto static and survives GMS death. This is documented in Hack #25. However, GMS respawns within 2 minutes anyway (Android's service restart policy), so the RAM savings are temporary.

Verification

# Check routing table BEFORE any GMS operations:
ip route show table 1030
# Expected: default via 192.168.1.254 dev wlan0

# Check GMS is running:
ps | grep gms
# Expected: multiple GMS processes

# NEVER run this without reading Hack #25 first:
# am force-stop com.google.android.gms  # BREAKS INTERNET

Gotchas

  • This applies to Android 6.0 specifically. Newer Android versions may handle DHCP differently
  • Even with static IP configured on the router, the route inside Android is still managed by GMS initially. It takes a network toggle (WiFi off/on) for the static route to take effect
  • GMS respawns within ~2 minutes via Android's service restart policy. You cannot permanently kill it without root
  • com.google.android.gsf (Google Services Framework) is also dangerous to kill — it manages GMS and other Google integrations
  • The only permanent solution is Hack #25 (static IP + periodic GMS kill from ADB shell)

Result

MetricBeforeAfter
RAM freed0270 MB (temporary)
InternetWorkingBROKEN
RecoveryN/AReboot or WiFi toggle
Lesson learnedN/AGMS = DHCP = routing