godotengine / godotengine/android-editor-buildenv-app

[GABE] APK export fails with "Operation not permitted" on Android 11+ (Scoped Storage)

Open
#52 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
68
Forks
11
Avg merge
21m
Merged PRs (30d)
1

Description

[English Version]

Subject: [GABE] APK export fails with "Operation not permitted" on Android 11+ (Scoped Storage)

Dear GABE Development Team,

First of all, thank you for your excellent work on GABE, which makes it possible to develop and export Godot games entirely on Android devices.

I am writing to report a permission-related issue that prevents the successful export of APK files on devices running Android 11 or higher.

Problem Description:
When I trigger a Gradle export from the Godot Editor on Android, the build process itself succeeds (BUILD SUCCESSFUL), but the final copyAndRenameBinary task fails with the following error:

Could not copy file '/project/build/outputs/apk/standard/debug/android_debug.apk'
to '/storage/emulated/0/Projects/.../build/ren.apk'.
> /storage/emulated/0/Projects/.../build/ren.apk (Operation not permitted)

Key Discovery:
I checked "Settings > Apps > GABE > Permissions" on my device and found that GABE does not have any permission switch related to "Files" or "Storage" in the system permission list. There is neither a "Storage" permission nor an "All files access" permission toggle.

Afterwards, I sought help through AI, and the AI told me that this might be because GABE currently uses the Storage Access Framework (SAF) to obtain access to the project directory. While this allows the GABE main process to access the project folder, the Gradle daemon process, as a child process, does not inherit these SAF grants. Therefore, when the Gradle task attempts to copy the APK from the internal build directory (/project/build/...) to the user's project directory on external storage, it fails with "permission denied".

Environment:
- Device Model: Redmi Note 12T Pro
- System Version: HyperOS 3.0 (based on Android 15)
- GABE Version: 1.0.1
- Godot Version: v4.7.stable.official [5b4e0cb0f]

Thank you again for your efforts. I hope GABE continues to improve!

---

[中文版本]

标题:[GABE] Android 11+ 导出 APK 时出现“Operation not permitted”权限错误

尊敬的 GABE 开发团队:

首先,非常感谢你们开发了 GABE,让开发者能完全在 Android 设备上编译和导出 Godot 游戏。

我遇到了一个权限相关的问题,导致在 Android 11 及以上系统中无法成功导出 APK。

问题描述:
当我在 Android 版 Godot 编辑器中触发 Gradle 导出时,构建过程本身是成功的(BUILD SUCCESSFUL),但最后一个 copyAndRenameBinary 任务会失败,错误信息如下:

Could not copy file '/project/build/outputs/apk/standard/debug/android_debug.apk'
to '/storage/emulated/0/Projects/.../build/ren.apk'.
> /storage/emulated/0/Projects/.../build/ren.apk (Operation not permitted)

关键发现:
我检查了手机的“设置 > 应用管理 > GABE > 权限”,发现 GABE 在系统权限列表中没有任何与“文件”或“存储”相关的权限开关。既没有“存储”权限,也没有“所有文件访问权限”的开关。

之后我通过AI寻求帮助,AI告诉我,这可能是因为 GABE 目前使用的是存储访问框架(SAF)来获取项目目录的访问权限。这种方式虽然能让 GABE 主进程访问项目文件夹,但 Gradle 守护进程作为子进程,并没有继承这些 SAF 授权。因此,当 Gradle 任务试图将 APK 从内部构建目录(/project/build/...)复制到用户项目目录(外部存储)时,就会因“权限不足”而失败。

环境信息:
- 设备型号:红米 Note 12T Pro
- 系统版本:澎湃OS 3.0(基于 Android 15)
- GABE 版本:1.0.1
- Godot 版本:v4.7.stable.official [5b4e0cb0f]

再次感谢你们的努力!希望 GABE 越来越好。

Image
Image
Image

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing a Gradle APK export from the Godot editor on Android 11 or newer and follow the copyAndRenameBinary task. Trace how the APK moves from /project/build/outputs/apk/standard/debug/android_debug.apk to the project directory under /storage/emulated/0. Done means the export completes without the Operation not permitted error.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.