Skip to content

Commit

Permalink
2.1.1
Browse files Browse the repository at this point in the history
Support Android 4.4+
Fix a bug merging some APKs that contain classes.dex files in subfolders
Cleanup unused code, resources, dependencies
Add some additional logs to crash report to help diagnose issues
update usage video
  • Loading branch information
AbdurazaaqMohammed committed Oct 28, 2024
1 parent e503af6 commit 95d72de
Show file tree
Hide file tree
Showing 78 changed files with 116 additions and 1,990 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ There are already some apps that can perform this task like Apktool M, AntiSplit

In addition, Antisplit G2 (com.tilks.arscmerge), the fastest and lightest of the existing apps, has a large problem; it does not remove the information about splits in the APK from the AndroidManifest.xml. If a non-split APK contains this information it will cause an "App not installed" error on some devices. Fortunately the implementation by REAndroid contains a function to remove this automatically and it carries over to this app.

Version 2.x - Material You design, support Android 5.0+
Version 2.x - Material You design, support Android 4.4+

Version 1.x - Support Android 1.6+

# Usage
Video - https://www.youtube.com/watch?v=Nd3vEzRWY-Q
Video - https://youtu.be/Vk566iMG6Gs

There are 3 ways to open the split APK to be merged:
There are 3 ways to open a split APK to be merged:
* Share the file and select AntiSplit M in the share menu
* Press (open) the file and select AntiSplit M in available options
* Open the app from launcher and press the button then select the split APK file.

There is also a menu in the app that allows selecting an app installed on the device as a split APK.

Note: if you are planning to further modify the APK, you only need to sign it after the modifications.

Note: Some apps verify the signature of the APK or take other measures to check if the app was modified, which may cause it to crash on startup.
Expand Down
14 changes: 10 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ android {

defaultConfig {
applicationId = "com.abdurazaaqmohammed.AntiSplit"
minSdk = 21
minSdk = 19
targetSdk = 35
versionCode = 38
versionName = "2.1.0"
versionCode = 39
versionName = "2.1.1"
multiDexEnabled = true
}

buildTypes {
Expand All @@ -35,7 +36,12 @@ android {
dependencies {
implementation("org.apache.commons:commons-compress:1.24.0")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.2")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("com.google.android.material:material:1.12.0")
}
dependenciesInfo {
// Disables dependency metadata when building APKs.
includeInApk = false
// Disables dependency metadata when building Android App Bundles.
includeInBundle = false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ public class LegacyUtils {

public static final boolean supportsFileChannel = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
public static final boolean supportsWriteExternalStorage = Build.VERSION.SDK_INT < 30;
public static final boolean aboveSdk20 = Build.VERSION.SDK_INT > 20;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static android.provider.Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION;
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
import static com.abdurazaaqmohammed.AntiSplit.main.LegacyUtils.aboveSdk20;
import static com.reandroid.apkeditor.merge.LogUtil.logEnabled;

import android.Manifest;
Expand Down Expand Up @@ -104,7 +105,6 @@ public class MainActivity extends AppCompatActivity implements Merger.LogListene
private ArrayList<Uri> uris;
private boolean urisAreSplitApks = true;
public static boolean errorOccurred;
//public static boolean revanced;
public static boolean checkForUpdates;
public static String lang;
public static int theme;
Expand Down Expand Up @@ -142,10 +142,12 @@ protected void onCreate(Bundle savedInstanceState) {
lang = settings.getString("lang", "en");
if(lang.equals(Locale.getDefault().getLanguage())) rss = getResources();
else updateLang(LocaleHelper.setLocale(MainActivity.this, lang).getResources(), null);
getWindow().addFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
int transparent = rss.getColor(android.R.color.transparent);
getWindow().setNavigationBarColor(transparent);
getWindow().setStatusBarColor(transparent);
if(aboveSdk20) {
getWindow().addFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
int transparent = rss.getColor(android.R.color.transparent);
getWindow().setNavigationBarColor(transparent);
getWindow().setStatusBarColor(transparent);
}

if (!LegacyUtils.supportsWriteExternalStorage) {
EdgeToEdge.enable(this);
Expand All @@ -163,8 +165,8 @@ protected void onCreate(Bundle savedInstanceState) {
sortMode = settings.getInt("sortMode", 0);
LogUtil.setLogListener(this);


findViewById(R.id.fromAppsButton).setOnClickListener(v3 -> {
View selectFromInstalledApps = findViewById(R.id.fromAppsButton);
if(aboveSdk20) selectFromInstalledApps.setOnClickListener(v3 -> {
AlertDialog ad = new MaterialAlertDialogBuilder(MainActivity.this).setNegativeButton(rss.getString(R.string.cancel), null).create();
PackageManager pm = getPackageManager();
List<PackageInfo> packageInfoList = pm.getInstalledPackages(0);
Expand Down Expand Up @@ -253,6 +255,7 @@ public void afterTextChanged(Editable s) {
ad.setView(dialogView);
styleAlertDialog(ad);
});
else selectFromInstalledApps.setVisibility(View.GONE);

findViewById(R.id.settingsButton).setOnClickListener(v -> {
ScrollView settingsDialog = (ScrollView) LayoutInflater.from(this).inflate(R.layout.setty, null);
Expand Down Expand Up @@ -529,19 +532,15 @@ public static void deleteDir(File dir) {

/** @noinspection ResultOfMethodCallIgnored*/
private void cleanupAppFolder() {
if(!doesNotHaveStoragePerm(this)) {
File appFolder = new File(Environment.getExternalStorageDirectory(), "AntiSplit-M");
if(appFolder.exists()) {
File[] children = appFolder.listFiles();
if(children != null) {
if (children.length == 0) appFolder.delete();
else {
for (File child : children) if (child.isFile() && child.length() == 0) child.delete();
children = appFolder.listFiles();
if (children.length == 0) appFolder.delete();
}
}
}
if(doesNotHaveStoragePerm(this)) return;
File appFolder = new File(Environment.getExternalStorageDirectory(), "AntiSplit-M");
if(!appFolder.exists()) return;
File[] children = appFolder.listFiles();
if(children == null) return;
if (children.length == 0) appFolder.delete();
else {
for (File child : children) if (child.isFile() && child.length() == 0) child.delete();
if (appFolder.listFiles().length == 0) appFolder.delete();
}
}

Expand Down Expand Up @@ -830,7 +829,7 @@ protected void onPostExecute(String[] result) {
currentVer = null;
}
boolean newVer = false;
char[] curr = TextUtils.isEmpty(currentVer) ? new char[] {'2', '0', '7'} : currentVer.replace(".", "").toCharArray();
char[] curr = TextUtils.isEmpty(currentVer) ? new char[] {'2', '1', '1'} : currentVer.replace(".", "").toCharArray();
char[] latest = latestVersion.replace(".", "").toCharArray();

int maxLength = Math.max(curr.length, latest.length);
Expand Down Expand Up @@ -1012,12 +1011,20 @@ private void showError(Exception e) {
errorOccurred = !mainErr.equals(rss.getString(R.string.sign_failed));
toggleAnimation(this, false);

StringBuilder stackTrace = new StringBuilder().append(mainErr).append('\n');
for (StackTraceElement line : e.getStackTrace()) {
stackTrace.append(line).append('\n');
StringBuilder stackTrace = new StringBuilder(mainErr);

for (StackTraceElement line : e.getStackTrace()) stackTrace.append(line).append('\n');
StringBuilder fullLog = new StringBuilder(stackTrace).append('\n')
.append("SDK ").append(Build.VERSION.SDK_INT).append('\n')
.append(rss.getString(R.string.app_name)).append(' ');
String currentVer;
try {
currentVer = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
} catch (Exception ex) {
currentVer = "2.1.1";
}
StringBuilder fullLog = new StringBuilder(stackTrace.toString());
fullLog.append('\n').append(logField.getText());
fullLog.append(currentVer).append('\n').append("Storage permission granted: ").append(!doesNotHaveStoragePerm(this))
.append('\n').append(logField.getText());

getHandler().post(() -> runOnUiThread(() -> {
View dialogView = getLayoutInflater().inflate(R.layout.dialog_button_layout, null);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 95d72de

Please sign in to comment.