android - getAPKExpansionZipFile() returns null -


Since my game has 100MB, I need to use the extension file. I will create the code in the main activity Create in the create ()

  zip rorsufffile extension file = null; Try {expansionFile = APKExpansionSupport.getAPKExpansionZipFile (getApplicationContext (), 2.0); } Hold (IOException e) {e.printStackTrace (); }  

I do not use the patch extension file, only main, so I think 0 is correct as the version. When I log in to check that detail file Successfully loaded, I get zero value.

  if (expansionFile == null) Gdx.app.log ("EXPANSION_FILE", "NULL"); And Gdx.app.log ("EXPANSION_FILE", "NOT NULL");  

I followed the instructions and I manually placed the main.domain.com com.my.game.obb file in the folder on my Nexus device:

 < Other objects in code> internal storage \ Android \ obb \ com.my.game \  

Android \ obb folder are other obb files, so it should be in the right place. Any clues to not mount the OBB extension file?

UPDATE

I have implemented DownloaderActivity and download this extension file without problems. This was giving me the "no zip archive" log message. I found a way to avoid this, I zipped the OBB file and uploaded it to the Developer Console. It automatically gets converted to OBB anyway, but this time when I downloaded it on my Nexus, now I do not give zero value for ZipResourceFile and it now gives me the message "no zip archive" But whenever I am using Asset Manager from Libidex I still can not access the files from it.

I found another way, which I am now testing.

Resolve the problem where getAPKExpansionZipFile () returns to the exit, but not to use the JOBB tool Upload all zip content and upload it to Google Play will automatically convert it to OBB.

The complete solution for loading images from the extension file:

I have created a static variable in my own game class, which is ZipResourceFile < Is an example of / code>. I have made it stationary, because I wanted to load the extension code in the main activity class and want to use it in my FileHandle class to get the picture from it Was there. If you think it is up to you in a different way

in class load extension file

I did it in the () function.

  try {gameInfo.expansionFile = APKExpansionSupport.getAPKExpansionZipFile (getBaseContext (), 22,0); } Hold (IOException e) {e.printStackTrace (); }  

The values ​​given in the function are as follows:

  getAPKExpansionZipFile (reference ctx, int mainversion, int patchversion)  

The main version is exactly the same as the manifest file declared in:

  android: versionCode = "22"  

Also Your expansion file also needs the same number in your name:

  main.mainVersion.com.name.title  

create your own filehandle class This is where it's your specific file Tar file looks for "image.png".

  public class extends customFileHandle FileHandle {public CustomFileHandle (string filename) {super (fileName); } @ Override public inputstream read () {InputStream input = zero; Try {input = GameInfo.expansionFile.getInputStream (file.getPath (). ('\\', '/')); } Hold (IOException e) {e.printStackTrace (); } Return input; }}  

Create your own FileHandleResolver class. This is where you use your custom filehandle.

  Return to Public Segment CustomFileHandleResolver FileHandleResolver {@Override Public FileHandle Resolution (string filename) {new customfilehand (filename); }}  

Take an example of Asset Manager and pass the constructor to your file-wide resolor.

  assetManager = new AssetManager (new custom fileholder () (rolver));  

If I do not leave any steps, then it needs to load your file from the extension file. As I mentioned in the beginning, I found a problem using the Jobb Tool to pack files in the OBB file. This creates getAPKExpensionZipFile () to clear it, so instead I zipped all the files here for more detailed explanation:


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -