Merge pull request #12 from luoyesiqiu/master

Fix the spelling of some words
This commit is contained in:
Windy 2019-05-17 00:47:06 +08:00 committed by GitHub
commit d93f456fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View File

@ -137,10 +137,10 @@ public class MainCommand extends BaseCommand {
String manifestFilePath = unzipApkFilePath + "AndroidManifest.xml"; String manifestFilePath = unzipApkFilePath + "AndroidManifest.xml";
// parse the app main application full name from the manifest file // parse the app main application full name from the manifest file
ManifestParser.Pair pair = ManifestParser.parseManidestFile(manifestFilePath); ManifestParser.Pair pair = ManifestParser.parseManifestFile(manifestFilePath);
String applicationName; String applicationName;
if (pair != null && pair.applictionName != null) { if (pair != null && pair.applicationName != null) {
applicationName = pair.applictionName; applicationName = pair.applicationName;
} else { } else {
System.out.println(" Application name not found error !!!!!! "); System.out.println(" Application name not found error !!!!!! ");
applicationName = DEFAULT_APPLICATION_NAME; applicationName = DEFAULT_APPLICATION_NAME;

View File

@ -16,13 +16,13 @@ public class ManifestParser {
/** /**
* Get the package name and the main application name from the manifest file * Get the package name and the main application name from the manifest file
* */ * */
public static Pair parseManidestFile(String filePath) { public static Pair parseManifestFile(String filePath) {
AXmlResourceParser parser = new AXmlResourceParser(); AXmlResourceParser parser = new AXmlResourceParser();
File file = new File(filePath); File file = new File(filePath);
String packageName = null; String packageName = null;
String applictionName = null; String applicationName = null;
if (!file.exists()) { if (!file.exists()) {
System.out.println(" manifest file not exsit!!! filePath -> " + filePath); System.out.println(" manifest file not exist!!! filePath -> " + filePath);
return null; return null;
} }
try { try {
@ -50,12 +50,12 @@ public class ManifestParser {
if ("application".equals(name)) { if ("application".equals(name)) {
if ("name".equals(attrName)) { if ("name".equals(attrName)) {
applictionName = parser.getAttributeValue(i); applicationName = parser.getAttributeValue(i);
} }
} }
if (packageName != null && packageName.length() > 0 && applictionName != null && applictionName.length() > 0) { if (packageName != null && packageName.length() > 0 && applicationName != null && applicationName.length() > 0) {
return new Pair(packageName, applictionName); return new Pair(packageName, applicationName);
} }
} }
} else if (type == XmlPullParser.END_TAG) { } else if (type == XmlPullParser.END_TAG) {
@ -64,18 +64,18 @@ public class ManifestParser {
} }
} catch (XmlPullParserException | IOException e) { } catch (XmlPullParserException | IOException e) {
e.printStackTrace(); e.printStackTrace();
System.out.println("parseManidestFile failed, reason --> " + e.getMessage()); System.out.println("parseManifestFile failed, reason --> " + e.getMessage());
} }
return new Pair(packageName, applictionName); return new Pair(packageName, applicationName);
} }
public static class Pair { public static class Pair {
public String packageName; public String packageName;
public String applictionName; public String applicationName;
public Pair(String packageName, String applictionName) { public Pair(String packageName, String applicationName) {
this.packageName = packageName; this.packageName = packageName;
this.applictionName = applictionName; this.applicationName = applicationName;
} }
} }