我以 GitHub 为例. 它工作正常,但我需要用我的 apk 上传 obb 文件。
我的部分代码:
AndroidPublisher.Edits.Insert editRequest = edits.insert(bundleID, null);
AppEdit edit = editRequest.execute();
final String editId = edit.getId();
final AbstractInputStreamContent apkFile = new FileContent("application/vnd.android.package-archive", new File(apkPath));
AndroidPublisher.Edits.Apks.Upload uploadRequest = edits.apks().upload(bundleID, editId, apkFile);
Apk apk = uploadRequest.execute();
List<Integer> apkVersionCodes = new ArrayList<>();
apkVersionCodes.add(apk.getVersionCode());
AndroidPublisher.Edits.Tracks.Update updateTrackRequest = edits.tracks().update(bundleID, editId, TRACK_ALPHA, new Track().setVersionCodes(apkVersionCodes));
updateTrackRequest.execute();
// Commit changes for edit.
AndroidPublisher.Edits.Commit commitRequest = edits.commit(bundleID, editId);
commitRequest.execute();
我该怎么做?
最佳答案
要上传新的扩展文件并将其与 APK 相关联:
String expansionFileType = "main"; // either "main" or "patch"
FileContent file = new FileContent("application/octet-stream", new File(path));
edits.expansionfiles().upload(appId, editId, versionCode, expansionFileType, file).execute();
如果您想将现有的扩展文件与 APK 相关联:
String expansionFileType = "main";
int previousVersionCode = // find the version code here
ExpansionFile obbFile = new ExpansionFile().setReferencesVersion(previousVersionCode);
edits.expansionfiles().update(appId, editId, versionCode, expansionFileType, obbFile).execute();
关于java - 如何通过 Android Publisher Java API v2 将 obb 文件上传到 Google Play,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35629725/