Implement Framework Path Storage for APKTool
- Dominant language
- Smali
- Stars
- 132
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
### 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:
```javascript
// 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 + '"';
```
2. Create the framework directory if it doesn't exist:
```javascript
// 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.
Contributor guide
Assessment
This issue has not been assessed yet.