Skip to content

## Root service fails to start on Android 15/16 - external cache directory not created #1852

@pbzinwindows

Description

@pbzinwindows

Please check before submitting an issue

  • I know what my device, OS and App Manager versions are
  • I know how to take logs
  • I know how to reproduce the issue which may not be specific to my device

Describe the bug

Root service fails to start on Android 15/16 - external cache directory not created

Environment

  • Android 16 QPR1
  • App Manager debug build
  • Magisk root

Issue

Root services fail to initialize because /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/cache doesn't exist and can't be accessed:

E RootService: External directory unavailable.
E RootService: Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/cache: permission denied.

Root Cause

On Android 15/16, /storage/emulated/0/Android/data/ directories are not automatically created during installation. This creates a chicken-and-egg problem: root is needed to create the directory, but RootService initialization requires the directory to exist first.

Workaround

adb shell
su
mkdir -p /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/cache
chown -R 10533:10533 /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/
chmod -R 755 /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/

Note: Replace 10533 with your app's actual UID (check with dumpsys package io.github.muntashirakon.AppManager.debug | grep userId)

Suggested Fix

Option 1: Use root to create the directory before initializing RootService

Option 2: Fallback to internal cache (context.getCacheDir()) when external cache is unavailable

Option 3: Don't require cache directory before establishing root access

This affects fresh installs on Android 15/16+, not upgrades from older versions.

To Reproduce

open appmanager

Expected behavior

root mode working

Screenshots

No response

Logs

E RootService: External directory unavailable.
E RootService: java.lang.IllegalStateException: External directory unavailable.
E RootService: Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/cache: permission denied.
E RootService: at io.github.muntashirakon.AppManager.utils.FileUtils.getBestExternalPath(FileUtils.java:207)
E RootService: at io.github.muntashirakon.AppManager.utils.FileUtils.getExternalCachePath(FileUtils.java:172)
E RootService: at io.github.muntashirakon.AppManager.ipc.RootServiceManager.lambda$startRootProcess$0(RootServiceManager.java:175)

E Ops: at io.github.muntashirakon.AppManager.ipc.ServiceConnectionWrapper.bindService(ServiceConnectionWrapper.java:98)
E Ops: at io.github.muntashirakon.AppManager.ipc.LocalServices.bindAmService(LocalServices.java:93)

Device info

  • Device: note 13 4g
  • OS Version: 16 qpr1
  • App Manager Version: latest
  • Mode: Root/ADB/NonRoot root

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions