fix: gradle export for APKs without strings.xml (PR #2050)
This commit is contained in:
@@ -55,7 +55,7 @@ public class ExportGradleTask implements Runnable {
|
||||
.orElseGet(() -> resContainers.stream()
|
||||
.filter(resContainer -> resContainer.getFileName().contains("strings.xml"))
|
||||
.findFirst()
|
||||
.orElseThrow(IllegalStateException::new));
|
||||
.orElse(null));
|
||||
|
||||
ExportGradleProject export = new ExportGradleProject(root, projectDir, androidManifest, strings);
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ public class AndroidManifestParser {
|
||||
|
||||
this.androidManifest = parseAndroidManifest(androidManifestRes);
|
||||
this.appStrings = parseAppStrings(appStrings);
|
||||
|
||||
validateAttrs();
|
||||
}
|
||||
|
||||
public boolean isManifestFound() {
|
||||
@@ -60,12 +58,6 @@ public class AndroidManifestParser {
|
||||
return parseAttributes();
|
||||
}
|
||||
|
||||
private void validateAttrs() {
|
||||
if (parseAttrs.contains(AppAttribute.APPLICATION_LABEL) && appStrings == null) {
|
||||
throw new IllegalArgumentException("APPLICATION_LABEL attribute requires non null appStrings");
|
||||
}
|
||||
}
|
||||
|
||||
private ApplicationParams parseAttributes() {
|
||||
String applicationLabel = null;
|
||||
Integer minSdkVersion = null;
|
||||
@@ -113,6 +105,9 @@ public class AndroidManifestParser {
|
||||
if (application.hasAttribute("android:label")) {
|
||||
String appLabelName = application.getAttribute("android:label");
|
||||
if (appLabelName.startsWith("@string")) {
|
||||
if (appStrings == null) {
|
||||
throw new IllegalArgumentException("APPLICATION_LABEL attribute requires non null appStrings");
|
||||
}
|
||||
appLabelName = appLabelName.split("/")[1];
|
||||
NodeList strings = appStrings.getElementsByTagName("string");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user