Skip to content

Fail when Android bytecode compilation fails - #4

Open
FilipeMarch wants to merge 1 commit into
masterfrom
fix-bytecode-compilation-failure
Open

Fail when Android bytecode compilation fails#4
FilipeMarch wants to merge 1 commit into
masterfrom
fix-bytecode-compilation-failure

Conversation

@FilipeMarch

Copy link
Copy Markdown
Member

Summary

Fail the Android Gradle build when Python bytecode compilation fails.

Problem

The generated OptimizePythonTask ran compileall but ignored its exit code.
It then deleted the Python source files regardless of the result.

This could produce an APK without required .pyc files. At runtime Python
failed during initialization with:

  failed to get the Python codec of the filesystem encoding

Changes

  • Capture the compiler output.
  • Print compiler errors in the Gradle log.
  • Check the compileall exit code.
  • Abort the build before deleting .py files when compilation fails.
  • Add a regression test for the generated Gradle template.

Validation

  • Focused regression test passed.
  • Python compilation checks passed.

@Novfensec
Novfensec requested a review from psychowasp August 11, 2026 11:47
@Novfensec

Copy link
Copy Markdown
Collaborator

@psychowasp We should merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants