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:
Adib Faramarzi 2019-05-30 18:46:59 +04:30
parent 25a65186a9
commit 154da4c643

View File

@ -239,6 +239,14 @@ public class Androlib {
}
if (in.containsDir("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) {
throw new AndrolibException(ex);
@ -560,6 +568,7 @@ public class Androlib {
buildLibrary(appDir, "lib");
buildLibrary(appDir, "libs");
buildLibrary(appDir, "kotlin");
buildLibrary(appDir, "META-INF/services");
}
public void buildLibrary(File appDir, String folder) throws AndrolibException {
@ -570,7 +579,7 @@ public class Androlib {
}
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 + ")");
try {
OS.rmdir(stored);