Diagnosing Android Battery Drain with Built‑in Tools and Battery Historian
13 min read
Learn step‑by‑step how to pinpoint the cause of Android battery drain using the system Battery usage screen, ADB batterystats, and the open‑source Battery Historian tool.
October 10, 2026 20:00
Why Android Battery Drain Happens
Even when you aren’t actively using your phone, background services, misbehaving apps, or hardware components can keep the processor awake and drain the battery. Android records a wealth of data about wake‑locks, network usage, GPS, and CPU activity. By analysing that data you can answer questions such as:
- Which app consumed the most power in the last 24 hours?
- Is a particular wake‑lock keeping the device awake?
- Did a recent OS update change the power profile?
This guide shows you how to extract that information using only the built‑in Battery usage screen and the free, open‑source Battery Historian utility – all without rooting your device.
Before You Start
- Charge your phone to at least 50 %. The analysis works best when the device isn’t in a low‑power state.
- Enable Developer options: Settings > About phone > Tap
Build number seven times.
- Turn on USB debugging: Settings > System > Advanced > Developer options > USB debugging.
- Install platform‑tools (ADB) on your computer.
- Have a Java Runtime (JRE 8 or newer) ready – Battery Historian runs as a JAR file.
If any step feels unfamiliar, refer to our short USB debugging tutorial first.
Part 1 – Quick Check with Android’s Built‑in Battery Usage Screen
- Open Settings → Battery. The exact path may differ on Samsung (Settings > Device care > Battery) or Pixel (Settings > Battery).
- Tap Battery usage. You’ll see a list of apps ordered by power consumption for the selected time range.
- At the top, change the time filter to
Last 24 hours or Last 7 days to spot trends.
- Tap an app name to view a breakdown (screen, CPU, network, GPS, etc.).
- If an app shows a high Background activity percentage, note its package name (e.g.,
com.example.app).
What you see here is a high‑level view – useful for a quick sanity check. However, it does not reveal wake‑locks, exact timestamps, or the impact of system services. For deeper analysis we move to the next part.
Part 2 – Exporting Detailed Batterystats with ADB
Android keeps a binary log of power‑related events called batterystats. We’ll pull that log, reset it for a clean baseline, and later feed it to Battery Historian.
Step 1 – Connect Your Phone
- Connect the phone to your computer via USB.
- On the phone, confirm the Allow USB debugging? prompt.
- Open a terminal (Command Prompt, PowerShell, or Bash) and verify the connection:
adb devices
You should see a device ID followed by device.
Step 2 – Reset the Existing Statistics (Optional but Recommended)
- Run the following command to clear the current batterystats buffer:
adb shell dumpsys batterystats --reset
- This action erases all historical data – do it only when you’re ready to start a fresh monitoring period.
Warning: After a reset the built‑in Battery usage screen will show “No data” until enough activity accumulates.
Step 3 – Let the Phone Run Normally
Use the device as you normally would for at least 4–6 hours, or overnight if the drain is severe. Avoid forcing a reboot during this window because it clears the in‑memory buffer.
Step 4 – Pull the Batterystats File
- After the monitoring period, execute:
adb shell dumpsys batterystats > batterystats.txt
- The file
batterystats.txt is now saved in the current working directory of your terminal.
This plain‑text dump contains timestamps, wake‑lock events, network packets, and per‑app CPU usage – exactly what Battery Historian needs.
Part 3 – Visualising the Data with Battery Historian
Battery Historian converts the raw dump into an interactive HTML report. It works on Windows, macOS, and Linux.
Step 1 – Download Battery Historian
- Open a browser and navigate to the Android Open Source Project’s Battery Historian page (search for “Battery Historian GitHub”).
- Download the latest
battery-historian.jar file. The file size is roughly 10 MB.
- Save it to the same folder that contains
batterystats.txt for convenience.
If you cannot reach the repository, the tool is also bundled with the Android SDK under platform-tools – look for battery-historian.jar there.
Step 2 – Run the Historian Server
- Open a terminal in the folder containing both files.
- Execute the following command (requires Java):
java -jar battery-historian.jar -port 9999 batterystats.txt
- The tool starts a local web server and prints a URL such as
http://localhost:9999/.
Leave the terminal window open – closing it will stop the server.
Step 3 – Open the Report in a Browser
- Open your preferred browser and navigate to the URL shown in the terminal.
- You’ll see a timeline view with several tracks: Screen, CPU, Wake‑locks, Network, Location, etc.
Hover over any bar to see the exact timestamp and the responsible package name.
Step 4 – Interpreting Common Patterns
- Continuous Wake‑Lock (green bar under “Wake‑Locks”): Indicates an app or service is preventing the device from entering deep sleep. Look for the package name; if it’s a system app you may need to adjust its settings or update the firmware.
- Spikes in CPU without user interaction often point to background sync or a misbehaving service.
- Frequent GPS usage (purple bar) is a classic drain cause – check apps with location permission.
- Network activity bursts may be caused by auto‑sync, push notifications, or a rogue app downloading data in the background.
Once you identify the culprit, you can take concrete actions: disable the app’s background activity, revoke a permission, or uninstall the app entirely.
Part 4 – Acting on the Findings
Below are typical remediation steps based on the patterns you might see.
4.1 – Misbehaving App Keeps a Wake‑Lock
- Open Settings → Apps & notifications → See all apps.
- Select the offending app.
- Tap Battery → Background restriction and choose Restricted.
- If the app still holds a wake‑lock, consider Force stop or Uninstall.
4.2 – Excessive Location Requests
- Go to Settings → Location → App permission.
- Switch the permission for the noisy app from Allow all the time to Allow only while using the app or Deny.
- Optionally, enable Google Location Accuracy only if you need high‑precision services.
4.3 – Network‑Heavy Background Sync
- Open Settings → Accounts → select the account (Google, Dropbox, etc.).
- Turn off Sync for apps you don’t need to update constantly.
- For a more granular approach, go to Settings → Network & internet → Data usage → App data usage and set Background data to Disabled for the culprit.
Troubleshooting Common Issues
- ADB reports “device unauthorized”. Re‑connect the USB cable, check the prompt on the phone, and make sure you have accepted the RSA fingerprint.
- No data appears in Battery Historian. Ensure you ran the
--reset command *after* a full charge cycle, then let the phone run for several hours before pulling the dump again.
- Battery Historian fails to start (Java error). Verify you have Java 8+ installed and that the
java command is in your PATH. Use java -version to confirm.
- OEM skins hide the Battery usage screen. On heavily skinned devices (e.g., Xiaomi, Huawei), the path may be Settings > Battery & performance > Battery usage.
Alternative Approaches (When Battery Historian Is Not Viable)
If you cannot install Java or prefer a lighter tool, consider these options:
- AccuBattery (Play Store) – provides real‑time estimates and a historical view of per‑app consumption without root.
- GSam Battery Monitor (Play Store) – offers detailed wake‑lock and alarm statistics, though some features are behind a paywall.
- ADB command
dumpsys battery – gives a snapshot of current battery state (level, temperature, health) but not a timeline.
These alternatives trade off depth for convenience; Battery Historian remains the most comprehensive free solution.
Putting It All Together
By combining the quick glance of Android’s native Battery usage screen with the granular timeline from Battery Historian, you gain a full picture of what’s draining your phone. The workflow looks like this:
- Check the built‑in Battery usage for obvious offenders.
- Reset batterystats, let the device run, then pull the dump via ADB.
- Run Battery Historian, locate wake‑locks, GPS, or network spikes.
- Apply targeted fixes (background restriction, permission changes, uninstall).
- Re‑run the analysis to confirm the issue is resolved.
Repeating the cycle after each major change ensures you don’t trade one drain source for another.
Final Thoughts
Battery life is a balance between hardware efficiency and software behaviour. The tools described here are built into Android or freely available, meaning you don’t need to root or flash custom ROMs to get reliable data. Armed with this knowledge you can confidently identify and eliminate the hidden power hogs that turn a full‑day charge into a few hours of use.