Skip to content

Commit

Permalink
Merge pull request SuperMonster003#264 from kvii/pr_project_build
Browse files Browse the repository at this point in the history
解决工程型代码打包的 apk 安装后无法运行的问题。
  • Loading branch information
SuperMonster003 authored Oct 23, 2024
2 parents c2f0980 + 66ee2fb commit a7960ab
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions app/src/main/java/org/autojs/autojs/ui/project/BuildActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,28 @@ private void doBuildingApk() {

private ApkBuilder.AppConfig createAppConfig() {
if (mProjectConfig != null) {
return ApkBuilder.AppConfig.fromProjectConfig(mSource, mProjectConfig);
return ApkBuilder.AppConfig.fromProjectConfig(mSource, mProjectConfig)
.setAbis(getSelectedAbis())
.setLibs(getSelectedLibs());
}
String jsPath = mSourcePath.getText().toString();
String versionName = mVersionName.getText().toString();
int versionCode = Integer.parseInt(mVersionCode.getText().toString());
String appName = mAppName.getText().toString();
String packageName = mPackageName.getText().toString();

return new ApkBuilder.AppConfig()
.setAppName(appName)
.setSourcePath(jsPath)
.setPackageName(packageName)
.setVersionName(versionName)
.setVersionCode(versionCode)
.setAbis(getSelectedAbis())
.setLibs(getSelectedLibs())
.setIcon(mIsDefaultIcon ? null : () -> BitmapUtils.drawableToBitmap(mIcon.getDrawable()));
}

private ArrayList<String> getSelectedAbis() {
ArrayList<String> abis = new ArrayList<>();

for (int i = 0; i < mFlexboxAbis.getChildCount(); i += 1) {
Expand All @@ -445,6 +459,10 @@ private ApkBuilder.AppConfig createAppConfig() {
}
}

return abis;
}

private ArrayList<String> getSelectedLibs() {
ArrayList<String> libs = new ArrayList<>();

for (int i = 0; i < mFlexboxLibs.getChildCount(); i += 1) {
Expand All @@ -459,15 +477,7 @@ private ApkBuilder.AppConfig createAppConfig() {
}
}

return new ApkBuilder.AppConfig()
.setAppName(appName)
.setSourcePath(jsPath)
.setPackageName(packageName)
.setVersionName(versionName)
.setVersionCode(versionCode)
.setAbis(abis)
.setLibs(libs)
.setIcon(mIsDefaultIcon ? null : () -> BitmapUtils.drawableToBitmap(mIcon.getDrawable()));
return libs;
}

private ApkBuilder callApkBuilder(File tmpDir, File outApk, ApkBuilder.AppConfig appConfig) throws Exception {
Expand Down

0 comments on commit a7960ab

Please sign in to comment.