Skip to content

Commit

Permalink
fix: gradle export for APKs without strings.xml (PR #2050)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitram84 authored Dec 3, 2023
1 parent ca03406 commit 1e57e85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void run() {
.orElseGet(() -> resContainers.stream()
.filter(resContainer -> resContainer.getFileName().contains("strings.xml"))
.findFirst()
.orElseThrow(IllegalStateException::new));
.orElse(null));

ExportGradleProject export = new ExportGradleProject(root, projectDir, androidManifest, strings);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public AndroidManifestParser(ResourceFile androidManifestRes, ResContainer appSt

this.androidManifest = parseAndroidManifest(androidManifestRes);
this.appStrings = parseAppStrings(appStrings);

validateAttrs();
}

public boolean isManifestFound() {
Expand All @@ -60,12 +58,6 @@ public ApplicationParams parse() {
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;
Expand Down Expand Up @@ -113,6 +105,9 @@ private String getApplicationLabel() {
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");

Expand Down

0 comments on commit 1e57e85

Please sign in to comment.