net.dongliu.apk.parser.bean.ApkMeta Java Examples
The following examples show how to use
net.dongliu.apk.parser.bean.ApkMeta.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AndroidParser.java From appcenter-plugin with MIT License | 5 votes |
@Nonnull private ApkMeta metaInfo() throws IOException { if (apkMeta != null) return apkMeta; apkMeta = ApkParsers.getMetaInfo(file); return apkMeta; }
Example #2
Source File: ApkInfoPrinterActivity.java From ApkToolPlus with Apache License 2.0 | 5 votes |
private String buildMetaDataTree(ApkMeta apkMeta){ StringBuilder treeBuilder = new StringBuilder(); treeBuilder.append("packageName : ").append(apkMeta.getPackageName()).append("\n"); treeBuilder.append("label : ").append(apkMeta.getLabel()).append("\n"); treeBuilder.append("icon : ").append(apkMeta.getIcon()).append("\n"); treeBuilder.append("versionName : ").append(apkMeta.getVersionName()).append("\n"); treeBuilder.append("versionCode : ").append(apkMeta.getVersionCode()).append("\n"); treeBuilder.append("minSdkVersion : ").append(apkMeta.getMinSdkVersion()).append("\n"); treeBuilder.append("targetSdkVersion : ").append(apkMeta.getTargetSdkVersion()).append("\n"); treeBuilder.append("maxSdkVersion : ").append(apkMeta.getMaxSdkVersion()).append("\n"); return treeBuilder.toString(); }
Example #3
Source File: ApkParsers.java From apk-parser with BSD 2-Clause "Simplified" License | 5 votes |
/** * Get apk meta info for apk file, with locale * * @throws IOException */ public static ApkMeta getMetaInfo(String apkFilePath, Locale locale) throws IOException { try (ApkFile apkFile = new ApkFile(apkFilePath)) { apkFile.setPreferredLocale(locale); return apkFile.getApkMeta(); } }
Example #4
Source File: ApkParsers.java From apk-parser with BSD 2-Clause "Simplified" License | 5 votes |
/** * Get apk meta info for apk file * * @throws IOException */ public static ApkMeta getMetaInfo(File file, Locale locale) throws IOException { try (ApkFile apkFile = new ApkFile(file)) { apkFile.setPreferredLocale(locale); return apkFile.getApkMeta(); } }
Example #5
Source File: ApkParsers.java From apk-parser with BSD 2-Clause "Simplified" License | 5 votes |
/** * Get apk meta info for apk file * * @throws IOException */ public static ApkMeta getMetaInfo(byte[] apkData, Locale locale) throws IOException { try (ByteArrayApkFile apkFile = new ByteArrayApkFile(apkData)) { apkFile.setPreferredLocale(locale); return apkFile.getApkMeta(); } }
Example #6
Source File: ApkFileTest.java From apk-parser with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testParserMeta() throws IOException { String path = getClass().getClassLoader().getResource("apks/Twitter_v7.93.2.apk").getPath(); try (ApkFile apkFile = new ApkFile(path)) { apkFile.setPreferredLocale(Locale.ENGLISH); ApkMeta apkMeta = apkFile.getApkMeta(); assertEquals("Twitter", apkMeta.getLabel()); } }
Example #7
Source File: ApkFileTest.java From apk-parser with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testParserMeta_Type_0204() throws IOException { String path = getClass().getClassLoader().getResource("apks/NetworkStack_210000000.apk").getPath(); try (ApkFile apkFile = new ApkFile(path)) { apkFile.setPreferredLocale(Locale.ENGLISH); ApkMeta apkMeta = apkFile.getApkMeta(); assertEquals("NetworkStack", apkMeta.getLabel()); } }
Example #8
Source File: ByteArrayApkFileTest.java From apk-parser with BSD 2-Clause "Simplified" License | 5 votes |
@Test public void testParserMeta() throws IOException { String path = getClass().getClassLoader().getResource("apks/Twitter_v7.93.2.apk").getPath(); byte[] bytes = Files.readAllBytes(Paths.get(path)); try (ByteArrayApkFile apkFile = new ByteArrayApkFile(bytes)) { apkFile.setPreferredLocale(Locale.ENGLISH); ApkMeta apkMeta = apkFile.getApkMeta(); assertEquals("Twitter", apkMeta.getLabel()); } }
Example #9
Source File: App.java From java-play-store-uploader with MIT License | 4 votes |
/** * Perform apk upload an release on given track * * @throws Exception Upload error */ private void upload() throws Exception { // configure proxy if (this.proxyHost != null && !this.proxyHost.isEmpty()) { System.setProperty("https.proxyHost", this.proxyHost); } if (this.proxyPort != null && !this.proxyPort.isEmpty()) { System.setProperty("https.proxyPort", this.proxyPort); } // load key file credentials System.out.println("Loading account credentials..."); Path jsonKey = FileSystems.getDefault().getPath(this.jsonKeyPath).normalize(); GoogleCredential cred = GoogleCredential.fromStream(new FileInputStream(jsonKey.toFile())); cred = cred.createScoped(Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER)); // load apk file info System.out.println("Loading apk file information..."); Path apkFile = FileSystems.getDefault().getPath(this.apkPath).normalize(); ApkFile apkInfo = new ApkFile(apkFile.toFile()); ApkMeta apkMeta = apkInfo.getApkMeta(); final String applicationName = this.appName == null ? apkMeta.getName() : this.appName; final String packageName = apkMeta.getPackageName(); System.out.println(String.format("App Name: %s", apkMeta.getName())); System.out.println(String.format("App Id: %s", apkMeta.getPackageName())); System.out.println(String.format("App Version Code: %d", apkMeta.getVersionCode())); System.out.println(String.format("App Version Name: %s", apkMeta.getVersionName())); apkInfo.close(); // load release notes System.out.println("Loading release notes..."); List<LocalizedText> releaseNotes = new ArrayList<LocalizedText>(); if (this.notesPath != null) { Path notesFile = FileSystems.getDefault().getPath(this.notesPath).normalize(); String notesContent = new String(Files.readAllBytes(notesFile)); releaseNotes.add(new LocalizedText().setLanguage(Locale.US.toString()).setText(notesContent)); } else if (this.notes != null) { releaseNotes.add(new LocalizedText().setLanguage(Locale.US.toString()).setText(this.notes)); } // init publisher System.out.println("Initialising publisher service..."); AndroidPublisher.Builder ab = new AndroidPublisher.Builder(cred.getTransport(), cred.getJsonFactory(), cred); AndroidPublisher publisher = ab.setApplicationName(applicationName).build(); // create an edit System.out.println("Initialising new edit..."); AppEdit edit = publisher.edits().insert(packageName, null).execute(); final String editId = edit.getId(); System.out.println(String.format("Edit created. Id: %s", editId)); try { // upload the apk System.out.println("Uploading apk file..."); AbstractInputStreamContent apkContent = new FileContent(MIME_TYPE_APK, apkFile.toFile()); Apk apk = publisher.edits().apks().upload(packageName, editId, apkContent).execute(); System.out.println(String.format("Apk uploaded. Version Code: %s", apk.getVersionCode())); // create a release on track System.out.println(String.format("On track:%s. Creating a release...", this.trackName)); TrackRelease release = new TrackRelease().setName("Automated upload").setStatus("completed") .setVersionCodes(Collections.singletonList((long) apk.getVersionCode())) .setReleaseNotes(releaseNotes); Track track = new Track().setReleases(Collections.singletonList(release)); track = publisher.edits().tracks().update(packageName, editId, this.trackName, track).execute(); System.out.println(String.format("Release created on track: %s", this.trackName)); // commit edit System.out.println("Commiting edit..."); edit = publisher.edits().commit(packageName, editId).execute(); System.out.println(String.format("Success. Commited Edit id: %s", editId)); // Success } catch (Exception e) { // error message String msg = "Operation Failed: " + e.getMessage(); // abort System.err.println("Opertaion failed due to an error!, Deleting edit..."); try { publisher.edits().delete(packageName, editId).execute(); } catch (Exception e2) { // log abort error as well msg += "\nFailed to delete edit: " + e2.getMessage(); } // forward error with message throw new IOException(msg, e); } }
Example #10
Source File: ApkMetaTranslator.java From ApkToolPlus with Apache License 2.0 | 4 votes |
public ApkMeta getApkMeta() { return apkMeta; }
Example #11
Source File: ApkParsers.java From apk-parser with BSD 2-Clause "Simplified" License | 4 votes |
/** * Get apk meta info for apk file * * @throws IOException */ public static ApkMeta getMetaInfo(String apkFilePath) throws IOException { try (ApkFile apkFile = new ApkFile(apkFilePath)) { return apkFile.getApkMeta(); } }
Example #12
Source File: ApkParsers.java From apk-parser with BSD 2-Clause "Simplified" License | 4 votes |
/** * Get apk meta info for apk file * * @throws IOException */ public static ApkMeta getMetaInfo(File file) throws IOException { try (ApkFile apkFile = new ApkFile(file)) { return apkFile.getApkMeta(); } }
Example #13
Source File: ApkParsers.java From apk-parser with BSD 2-Clause "Simplified" License | 4 votes |
/** * Get apk meta info for apk file * * @throws IOException */ public static ApkMeta getMetaInfo(byte[] apkData) throws IOException { try (ByteArrayApkFile apkFile = new ByteArrayApkFile(apkData)) { return apkFile.getApkMeta(); } }