2013-09-21 122 views
2

我有一个80Mb的apk,所以我无法在谷歌Play商店上传它。我搜索了很多,发现我必须创建.obb文件作为主要扩展文件。如何使用jobb工具创建.obb文件作为主apk扩展文件?

另外我发现我可以使用jobb tool创建一个.obb文件,该文件位于sdk > tools > jobb.bat之内,但不幸的是它刚启动后就关闭了。

所以我错过了什么?

+0

请停止创建'.obb'标签。 .obb文件完全由'apk-expansion-files'标签覆盖,这已经是你的问题了。 – Charles

回答

1

我用Google搜索,发现我们shold不得不作出的.zip与0% (No compression)是提在http://developer.android.com/google/play/expansion-files.html

Tip: If you're packaging media files into a ZIP, you can use media playback calls on the files with offset and length controls (such as MediaPlayer.setDataSource() and SoundPool.load()) without the need to unpack your ZIP. In order for this to work, you must not perform additional compression on the media files when creating the ZIP packages. For example, when using the zip tool, you should use the -n option to specify the file suffixes that should not be compressed: zip -n .mp4;.ogg main_expansion media_files

OR 如何让0%压缩ZIP使用winrar?

enter image description here

看到这里的压缩方法

,所以我们应该有上传此拉链在Play商店。

,所以你不需要使用ZipHelper.java

只是简单地使用

ZipResourceFile expansionFile=null; 

      try { 
       expansionFile = APKExpansionSupport.getAPKExpansionZipFile(getApplicationContext(),3,0); 

        AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor("test.mp4"); 
        MediaPlayer mPlayer = new MediaPlayer(); 
        mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
        mPlayer.setDataSource(fd.getFileDescriptor(),fd.getStartOffset(),fd.getLength()); 
        mPlayer.prepare(); 
        mPlayer.start(); 

      } catch (IOException e) { 
       // TODO Auto-generated catch block 
       e.printStackTrace(); 
      } 
+0

这可能是不正确回答*自己的问题的一个很好的例子 – PulseJet

+0

我正在使用mac创建obb文件,因此您可以帮助我制作obb文件吗? 我在主资源文件夹中有多个文件夹,我不知道如何使用zip命令来包含所有文件夹。 –

3

试试这个

$ JOBB -d /温度/资产/ -o新OBB-file.obb -k秘密密钥-pn com.my.app.package -pv 11

在哪里

-d <directory> : Set the input directory for creating an OBB file. 
-o <filename> : Specify the filename for the OBB file. 
-k <key>  : Specify a password for encrypting a new OBB file 
-pn <package> : Specify the package name for the application that mounts the OBB file,    which corresponds to the package value specified in your application's manifest. 
-pv <version> : Set the minimum version for the application that can mount the OBB file, which corresponds to the android:versionCode value in your application's manifest. 

试试这个命令。

检查以下链接http://developer.android.com/tools/help/jobb.html

+0

感谢您的回答,但在哪里写这coomand?我的jobb工具在启动后立即关闭。 –

+0

不要点击jobb工具,只要去控制台,并尝试此命令确保环境变量设置为android sdk的工具文件夹 – Nikhil

+0

以及我正在尝试这个。 –