|
20 | 20 | import brut.androlib.meta.UsesFramework;
|
21 | 21 | import brut.androlib.options.BuildOptions;
|
22 | 22 | import brut.androlib.res.AndrolibResources;
|
| 23 | +import brut.androlib.res.data.ResConfigFlags; |
23 | 24 | import brut.androlib.res.data.ResPackage;
|
24 | 25 | import brut.androlib.res.data.ResTable;
|
25 | 26 | import brut.androlib.res.data.ResUnknownFiles;
|
|
35 | 36 | import org.apache.commons.io.FileUtils;
|
36 | 37 | import org.apache.commons.io.FilenameUtils;
|
37 | 38 | import org.jf.dexlib2.iface.DexFile;
|
| 39 | +import org.xml.sax.SAXException; |
38 | 40 |
|
39 | 41 | import javax.xml.parsers.ParserConfigurationException;
|
40 | 42 | import javax.xml.transform.TransformerException;
|
@@ -491,12 +493,13 @@ public boolean buildResourcesFull(File appDir, UsesFramework usesFramework)
|
491 | 493 | if (buildOptions.netSecConf) {
|
492 | 494 | MetaInfo meta = readMetaFile(new ExtFile(appDir));
|
493 | 495 | if (meta.sdkInfo != null && meta.sdkInfo.get("targetSdkVersion") != null) {
|
494 |
| - if (Integer.parseInt(meta.sdkInfo.get("targetSdkVersion")) < 24) { |
| 496 | + if (Integer.parseInt(meta.sdkInfo.get("targetSdkVersion")) < ResConfigFlags.SDK_NOUGAT) { |
495 | 497 | LOGGER.warning("Target SDK version is lower than 24! Network Security Configuration might be ignored!");
|
496 | 498 | }
|
497 | 499 | }
|
498 | 500 | File netSecConfOrig = new File(appDir, "res/xml/network_security_config.xml");
|
499 | 501 | if (netSecConfOrig.exists()) {
|
| 502 | + LOGGER.info("Replacing existing network_security_config.xml!"); |
500 | 503 | netSecConfOrig.delete();
|
501 | 504 | }
|
502 | 505 | ResXmlPatcher.modNetworkSecurityConfig(netSecConfOrig);
|
@@ -539,7 +542,7 @@ public boolean buildResourcesFull(File appDir, UsesFramework usesFramework)
|
539 | 542 | apkFile.delete();
|
540 | 543 | }
|
541 | 544 | return true;
|
542 |
| - } catch (IOException | BrutException | ParserConfigurationException | TransformerException ex) { |
| 545 | + } catch (IOException | BrutException | ParserConfigurationException | TransformerException | SAXException ex) { |
543 | 546 | throw new AndrolibException(ex);
|
544 | 547 | }
|
545 | 548 | }
|
|
0 commit comments