ANDRO
ANDRO copied to clipboard
Implement Framework Path Storage for APKTool
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
- Run the APK build process
- Observe warnings about using a temporary directory for framework files
Proposed Fix
- Update the build command in
const.jsto 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 + '"';
- 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.