我使用jobb工具创建了一个加密的.obb文件.我使用以下代码来安装obb文件:
public void mountExpansion() {
final StorageManager storageManager = (StorageManager) getContext()
.getSystemService(Context.STORAGE_SERVICE);
String packageName = "name.of.the.package";
String filePath = Environment.getExternalStorageDirectory()
+ "/Android/obb/" + packageName + "/" + "main."
+ version + "." + packageName + ".obb";
final File mainFile = new File(filePath);
if (mainFile.exists()) {
Log.d("STORAGE", "FILE: " + filePath + " Exists");
} else {
Log.d("STORAGE", "FILE: " + filePath + " DOESNT EXIST");
}
String key = "thisIsMyPassword";
if (!storageManager.isObbMounted(mainFile.getAbsolutePath())) {
if (mainFile.exists()) {
if(storageManager.mountObb(mainFile.getAbsolutePath(), key,
new OnObbStateChangeListener() …
Run Code Online (Sandbox Code Playgroud) 我的游戏APK文件大小增加了100mb所以我需要拆分它.所以现在我有两个扩展名为.apk和.obb的文件.但是在Play商店,没有办法上传OBB文件.
这是我的Play商店帐户截图:
我上传了APK文件,但上传OBB文件的位置?
编辑: 上传APK文件后,我无法获得上传扩展文件的任何选项.我得到关于上传文件的这种概述.
我已经实施了APK扩展文件下载服务,全部来自http://developer.android.com/google/play/expansion-files.html
我可以下载APK扩展文件,我可以使用下面的代码看到该文件
try {
ZipResourceFile expansionFile = APKExpansionSupport
.getAPKExpansionZipFile(this, 3, 0);
ZipEntryRO[] zip = expansionFile.getAllEntries();
Log.e("", "" + zip[0].mFile.getAbsolutePath());
Log.e("", "" + zip[0].mFileName);
Log.e("", "" + zip[0].mZipFileName);
Log.e("", "" + zip[0].mCompressedLength);
AssetFileDescriptor fd = expansionFile
.getAssetFileDescriptor(zip[0].mFileName);
if (fd != null && fd.getFileDescriptor() != null) {
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(fd.getFileDescriptor());
mp.start();
} else {
Log.e("", "fd or fd.getFileDescriptor() is null");
}
} catch (IOException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
我的obb有文件test.mp4
和我的代码Log.e("", "" + zip[0].mFileName);
打印test.mp4.
我的 …
我在Android Studio(Windows 10)上.我一直在尝试按照https://developer.android.com/google/play/expansion-files.html中的步骤进行操作,但我仍然停留在"准备使用下载程序库"部分.我已下载并安装了Google Play许可证库和Google Play下载程序库.我已经创建了相应的模块.但是,当我转到模块设置并指定库存储库的路径时,我收到错误,当我再次打开模块设置时,库存储库字段保持空白.我得到的错误是:
10:23:57 PM IncorrectOperationException: Error while applying changes: cannot create file from text: C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_apk_expansion\downloader_library\
10:36:23 PM IncorrectOperationException: Error while applying changes: cannot create file from text: C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_licensing\library\
Run Code Online (Sandbox Code Playgroud)
我指定的库存储库路径是:
C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_apk_expansion\downloader_library
C:\Users\n56\AppData\Local\Android\sdk\extras\google\market_licensing\library\
Run Code Online (Sandbox Code Playgroud)
我已经尝试过各种各样的事情,例如转义反斜杠,导入模块而不是单击New Modules但没有可用.
将不胜感激任何帮助.TIA.
android android-library android-studio apk-expansion-files android-gradle-plugin
我有一个包含一系列声音文件的扩展文件。较长的为 .mp3 文件,较短的音效为 .wav 文件。我将它们打包在 .zip 文件中,未进行压缩。我使用 Google 提供的 Zip 文件阅读器和下载器库。
我像这样打开声音文件:
MediaPlayer mPlayer;
...
AssetFileDescript asd = expansionFile.getAssFileDescriptor(fileName);
FileDescriptor soundFile = asd.getFileDescriptor();
mPlayer = new MediaPlayer();
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mPlayer.setDataSource(soundFile);
mPlayer.prepare();
mPlayer.start();
Run Code Online (Sandbox Code Playgroud)
奇怪的是它每次都播放相同的声音文件。它似乎是它首先发现的任何东西。asd.getDeclaredLength()
和的字节大小asd.getLength()
正是它应该的大小。这意味着文件描述符至少找到了文件,但由于某种原因 MediaPlayer 播放它决定的任何随机文件。
我在这里到底缺少什么?任何帮助将不胜感激。
谢谢。
android android-mediaplayer android-resources apk-expansion-files
我遇到了扩展文件进程的问题,我不知道是什么问题.我希望有人可以提供帮助.
我按照Google的步骤进行了操作; 但我不能保证我已经100%正确地完成了它.
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
import com.android.vending.expansion.zipfile.ZipResourceFile;
import com.android.vending.expansion.zipfile.ZipResourceFile.ZipEntryRO;
import com.google.android.vending.expansion.downloader.Constants;
import com.google.android.vending.expansion.downloader.DownloadProgressInfo;
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
import com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller;
import com.google.android.vending.expansion.downloader.Helpers;
import com.google.android.vending.expansion.downloader.IDownloaderClient;
import com.google.android.vending.expansion.downloader.IDownloaderService;
import com.google.android.vending.expansion.downloader.IStub;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent; …
Run Code Online (Sandbox Code Playgroud) 我必须在我的应用程序中播放本地视频,但它有200 MB的视频大小.而谷歌播放不允许超过50MB的apk文件.
此应用程序适用于手机和平板电脑.因此,我需要按照分辨率上传视频.简而言之,我需要在谷歌上传两个文件夹来播放phione视频和平板电脑视频.
如何在Google Play中使用apk上传额外的文件,如何在用户从Google Play下载应用程序时在我的应用程序中使用这些上传的文件?