mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-01 06:34:25 +02:00
parent
3264f142cb
commit
2b9728e9f3
@ -296,25 +296,12 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
|
|
||||||
new File(appDir, APK_DIRNAME).mkdirs();
|
new File(appDir, APK_DIRNAME).mkdirs();
|
||||||
buildSources(appDir);
|
|
||||||
buildNonDefaultSources(appDir);
|
|
||||||
|
|
||||||
File manifest = new File(appDir, "AndroidManifest.xml");
|
File manifest = new File(appDir, "AndroidManifest.xml");
|
||||||
File manifestOriginal = new File(appDir, "AndroidManifest.xml.orig");
|
File manifestOriginal = new File(appDir, "AndroidManifest.xml.orig");
|
||||||
|
|
||||||
if (manifest.isFile() && manifest.exists()) {
|
buildSources(appDir);
|
||||||
try {
|
buildNonDefaultSources(appDir);
|
||||||
|
buildManifestFile(appDir, manifest, manifestOriginal);
|
||||||
if (manifestOriginal.exists()) {
|
|
||||||
manifestOriginal.delete();
|
|
||||||
}
|
|
||||||
FileUtils.copyFile(manifest, manifestOriginal);
|
|
||||||
ResXmlPatcher.fixingPublicAttrsInProviderAttributes(manifest);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
throw new AndrolibException(ex.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildResources(appDir, meta.usesFramework);
|
buildResources(appDir, meta.usesFramework);
|
||||||
buildLib(appDir);
|
buildLib(appDir);
|
||||||
buildLibs(appDir);
|
buildLibs(appDir);
|
||||||
@ -327,7 +314,7 @@ public class Androlib {
|
|||||||
|
|
||||||
// we copied the AndroidManifest.xml to AndroidManifest.xml.orig so we can edit it
|
// we copied the AndroidManifest.xml to AndroidManifest.xml.orig so we can edit it
|
||||||
// lets restore the unedited one, to not change the original
|
// lets restore the unedited one, to not change the original
|
||||||
if (manifest.isFile() && manifest.exists()) {
|
if (manifest.isFile() && manifest.exists() && manifestOriginal.isFile()) {
|
||||||
try {
|
try {
|
||||||
if (new File(appDir, "AndroidManifest.xml").delete()) {
|
if (new File(appDir, "AndroidManifest.xml").delete()) {
|
||||||
FileUtils.moveFile(manifestOriginal, manifest);
|
FileUtils.moveFile(manifestOriginal, manifest);
|
||||||
@ -338,6 +325,26 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buildManifestFile(File appDir, File manifest, File manifestOriginal)
|
||||||
|
throws AndrolibException {
|
||||||
|
|
||||||
|
// If we decoded in "raw", we cannot patch AndroidManifest
|
||||||
|
if (new File(appDir, "resources.arsc").exists()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (manifest.isFile() && manifest.exists()) {
|
||||||
|
try {
|
||||||
|
if (manifestOriginal.exists()) {
|
||||||
|
manifestOriginal.delete();
|
||||||
|
}
|
||||||
|
FileUtils.copyFile(manifest, manifestOriginal);
|
||||||
|
ResXmlPatcher.fixingPublicAttrsInProviderAttributes(manifest);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new AndrolibException(ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void buildSources(File appDir)
|
public void buildSources(File appDir)
|
||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
if (!buildSourcesRaw(appDir, "classes.dex") && !buildSourcesSmali(appDir, "smali", "classes.dex")) {
|
if (!buildSourcesRaw(appDir, "classes.dex") && !buildSourcesSmali(appDir, "smali", "classes.dex")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user