Create expansion file for AS3 android Air App Flash cs6

倖福魔咒の 提交于 2019-12-13 12:20:03

问题


I have created an AS3 mobile app and exported successfully through flash CS6.

In this .apk I have included my video files (going to be a presentation for Android Tablet). The total size of the .flvs alone is 64mb.

When I tried to upload to Google play I got the (expected) warning about the file size being >50mb.

I have spend two hours trying to find a fix, including using the jobb.bat , zipalign.bat , putting the files into the format of main.1.obb and many other options.

The Google website seems to think that I am using Eclipse (which I’m not I used Flash CS6), but I tried all those tools anyway, but yielded zero results.

I have tried http://developer.android.com/google/play/expansion-files.html -

But seems extremely complex and assumes I have eclipse. I even tried to import the “android-sdk\extras\google\play_apk_expansion” into Flash builder, but is not the right project extension.

I looked all over Stack Overflow to articles such as :

[https://stackoverflow.com/questions/14385776/how-to-attach-a-expansion-file-to-an-as3-air-application/15232051#15232051][2]

– But no response as of yet

AS3 / AIR Google Play application id and expansion files access

- But no clear answer, and I don’t even know how this got the .obb file in the first place.

APK 50meg+ Expansion Packs and Flash

-But I don’t have a Amazon bucket account. Also not sure what android shared storage is.

Steps to create APK expansion file

– But is using older version of google ( I don’t have the “Add Extra Button” ) Also this is not from a Flash As3 project , and again relies on Eclipse.

APK 50meg+ Expansion Packs and Flash

-But this person already has the .obb file (HOW ?).

As you can see I have tried many different ways, but I can’t simple create the expansion way.

So in Short ;

    Dose anyone one have a clear cut step by step technique on how to upload an .apk
    created in Flash CS6 that is >50MB to Google Play ?

回答1:


You don't have to prepare obb - no need to use jobb.

The easiest way to use expansion file for air app is to make one small swf as preloader and use it as a main apk and the other swf file (that will be loaded) with all big data is stored in obb file.

so:
preloader.swf -> apk
app.swf -> obb

In this scenario you don't have to make an obb file, you just upload new apk to google play and after uploading apk in expansion file section change 'no expansion file' to 'upload a new file' and select your app.swf file. Google will change swf to obb you don't need to do it.

When you upload your first apk for a new app you won't be able to add an obb file. You have to upload just apk and then add new version of apk - this enables obb option.

Now you have to load app.swf from apk in your preloader class. I'm using something like that:

private var mainVersion:String="1000001";
private var path:String = "Android/obb/com.your.app.id";
private var filename:String= "main." + mainVersion + ".com.your.app.id.obb";//patch for second obb
private var file:File;
private var fileStream:FileStream;
private var bytes:ByteArray;
private var applicationLoader:Loader;

public function App() 
{
    file = File.documentsDirectory.resolvePath(path + "/" + filename);

    if (file.exists)
    {
        loadSwf();
    }
}

private function loadSwf():void 
{
    fileStream = new FileStream(); 
    fileStream.open(file, FileMode.READ);
    bytes = new ByteArray();
    fileStream.readBytes(bytes);
    fileStream.close(); 

    var cont:LoaderContext = new LoaderContext();
    cont.allowCodeImport = true;

    applicationLoader = new Loader();
    applicationLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleAppLoaded);
    applicationLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, handleProgress);

    applicationLoader.loadBytes(bytes, cont);
}

private function handleProgress(e:ProgressEvent):void 
{
    trace(int(100 * e.bytesLoaded / e.bytesTotal))
    //just add progress bar if you want
}

private function handleAppLoaded(e:Event):void 
{
    addChild(applicationLoader);
}

And you can add a splash screen in preloader ;)

If you have to update obb file you have to also recompile apk with new mainVersion

If you ant to use zip file instead of swf, you have to upload a zip file, and in preloader you have to process it - unpack and use data from unpacked folder.



来源:https://stackoverflow.com/questions/15232572/create-expansion-file-for-as3-android-air-app-flash-cs6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!