mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-07 10:35:52 +01:00
Fix removal of META-INF/services folder
- copy the META-INF/services folder to the destination APK folder so it does not get dropped
This commit is contained in:
parent
25a65186a9
commit
154da4c643
@ -239,6 +239,14 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
if (in.containsDir("META-INF")) {
|
if (in.containsDir("META-INF")) {
|
||||||
in.copyToDir(originalDir, "META-INF");
|
in.copyToDir(originalDir, "META-INF");
|
||||||
|
|
||||||
|
if(in.containsDir("META-INF/services")){
|
||||||
|
// If the original APK contains the folder META-INF/services folder
|
||||||
|
// that is used for service locators (like coroutines on android),
|
||||||
|
// copy it to the destination folder so it does not get dropped.
|
||||||
|
LOGGER.info("Copying META-INF/services directory");
|
||||||
|
in.copyToDir(outDir, "META-INF/services");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (DirectoryException ex) {
|
} catch (DirectoryException ex) {
|
||||||
throw new AndrolibException(ex);
|
throw new AndrolibException(ex);
|
||||||
@ -560,6 +568,7 @@ public class Androlib {
|
|||||||
buildLibrary(appDir, "lib");
|
buildLibrary(appDir, "lib");
|
||||||
buildLibrary(appDir, "libs");
|
buildLibrary(appDir, "libs");
|
||||||
buildLibrary(appDir, "kotlin");
|
buildLibrary(appDir, "kotlin");
|
||||||
|
buildLibrary(appDir, "META-INF/services");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildLibrary(File appDir, String folder) throws AndrolibException {
|
public void buildLibrary(File appDir, String folder) throws AndrolibException {
|
||||||
@ -570,7 +579,7 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
|
|
||||||
File stored = new File(appDir, APK_DIRNAME + "/" + folder);
|
File stored = new File(appDir, APK_DIRNAME + "/" + folder);
|
||||||
if (apkOptions.forceBuildAll || isModified(working, stored)) {
|
if (apkOptions.forceBuildAll || isModified(working, stored) || folder.contains("services")) {
|
||||||
LOGGER.info("Copying libs... (/" + folder + ")");
|
LOGGER.info("Copying libs... (/" + folder + ")");
|
||||||
try {
|
try {
|
||||||
OS.rmdir(stored);
|
OS.rmdir(stored);
|
||||||
@ -788,5 +797,5 @@ public class Androlib {
|
|||||||
"AndroidManifest.xml" };
|
"AndroidManifest.xml" };
|
||||||
private final static String[] APK_STANDARD_ALL_FILENAMES = new String[] {
|
private final static String[] APK_STANDARD_ALL_FILENAMES = new String[] {
|
||||||
"classes.dex", "AndroidManifest.xml", "resources.arsc", "res", "r", "R",
|
"classes.dex", "AndroidManifest.xml", "resources.arsc", "res", "r", "R",
|
||||||
"lib", "libs", "assets", "META-INF", "kotlin" };
|
"lib", "libs", "assets", "META-INF", "kotlin"};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user