ANDRO icon indicating copy to clipboard operation
ANDRO copied to clipboard

Implement Framework Path Storage for APKTool

Open AryanVBW opened this issue 7 months ago • 0 comments
trafficstars

Description

The APKTool currently attempts to use a default framework directory that may be inaccessible, resulting in warnings and potential build issues.

Current Behavior

When running the build process, the following warning appears:

WARNING: Could not write to (/Users/username/Library/apktool/framework), using /var/folders/f_/5mq0p_fs5p12fcpp9mfzdjfw0000gn/T/ instead...
Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable

Expected Behavior

The APKTool should use a stable, persistent directory for framework files to ensure consistent builds.

Reproduction Steps

  1. Run the APK build process
  2. Observe warnings about using a temporary directory for framework files

Proposed Fix

  1. Update the build command in const.js to include a stable framework path:
// Add new constants to better organize paths
exports.frameworkDir = path.join(__dirname, '../app/factory/framework');

// Improve build command with better framework path
exports.buildCommand = 'java -jar "' + exports.apktool + '" b "' + 
  exports.decompileDir + '" -o "' + exports.apkBuildPath + 
  '" -f --frame-path "' + exports.frameworkDir + '"';
  1. Create the framework directory if it doesn't exist:
// In the initialization code
const fs = require('fs');
if (!fs.existsSync(CONST.frameworkDir)) {
    fs.mkdirSync(CONST.frameworkDir, { recursive: true });
}

Additional Context

Using a stable framework directory will improve build consistency and reduce warnings.

AryanVBW avatar Apr 06 '25 03:04 AryanVBW