Hi all! I have a problem downloading a file when building on android. I use Starling and gafmedia graphics for this I upload a zip file like this:
loader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(flash.events.ProgressEvent.PROGRESS, onProgress);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest("assets/game.zip"));
For html5, everything works, but when launched on android, the download progress hangs at 0. How to download files for android correctly? Permissions in the manifest I specified:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Do you have asset in android build (rename apk to zip and unpack)?
Assets path present in project file?
Also you could check test project.
in the root of the apk the following folders:
assets
lib
META-INF
res
AndroidManifest.xml
classes.dex
resources.arsc
assets is the folder I need
after I registered it in the project file, I began to get an error:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Xiaomi/polaris/polaris:8.0.0/OPR1.170623.032/V9.5.19.0.ODGMIFA:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 16944, tid: 16966, name: SDLThread »> com.example.myapp «<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10
Cause: null pointer dereference
x0 0000007c7a500260 x1 000000002fe551f9 x2 0000000000000000 x3 0000007c7a504740
x4 0000000000000001 x5 0000007c7c2dc3f0 x6 0000007c7a50480c x7 0000007c7a7fde18
x8 0000007c7a7fded0 x9 0000000000000010 x10 0000000000000001 x11 0000000000000040
x12 0000000000000000 x13 ffff000000000000 x14 00000000ffffffff x15 0000000000000000
x16 0000007c7c2e2b98 x17 0000007d1b2366c0 x18 0000007c8fc87270 x19 0000000000000000
x20 0000007c7a7fded0 x21 0000007c7a500284 x22 0000000000000000 x23 0000007c7a7fded0
x24 0000007c7a5047bc x25 0000007c7a50480c x26 0000007c7a504740 x27 0000007c7a7fdec8
x28 0000007c7c2dc3f0 x29 0000007c7a7fe5b0 x30 0000007c7b93dc1c
sp 0000007c7a7fddf0 pc 0000007c7b93dc2c pstate 0000000060000000
backtrace:
#00 pc 0000000000ab1c2c /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#01 pc 0000000000e9ac08 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#02 pc 0000000000a100ec /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#03 pc 0000000000a0cbe8 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#04 pc 0000000000592664 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#05 pc 0000000000b2f6c0 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#06 pc 0000000000a048f4 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#07 pc 0000000000df47f8 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#08 pc 0000000000ad48f8 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#09 pc 0000000000ad49b8 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#10 pc 0000000000e9aca0 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#11 pc 00000000005e9b58 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#12 pc 0000000000d3413c /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#13 pc 0000000000d34178 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#14 pc 0000000000e9ac08 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#15 pc 000000000053951c /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#16 pc 0000000000daf1cc /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#17 pc 0000000000e9aaf4 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#18 pc 0000000000e940cc /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#19 pc 00000000000a9850 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/liblime.so
#20 pc 0000000000109ac4 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/liblime.so
#21 pc 0000000000109cec /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/liblime.so
#22 pc 0000000000107dc0 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/liblime.so
#23 pc 00000000000c94bc /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/liblime.so
#24 pc 0000000000dada78 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#25 pc 0000000000866b94 /d
ata/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#26 pc 0000000000298b2c /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so
#27 pc 0000000000e74430 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/libApplicationMain.so (hxcpp_main+40)
#28 pc 000000000049e254 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/lib/arm64/liblime.so (Java_org_libsdl_app_SDLActivity_nativeRunMain+484)
#29 pc 00000000000038a4 /data/app/com.example.myapp-6ltsDa_1ugzEZ6qnuKBjyQ==/oat/arm64/base.odex (offset 0x2000)
Could you show project file? Did you try sample project?
here is the project file
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://lime.software/project/1.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://lime.software/project/1.0.2 http://lime.software/xsd/project-1.0.2.xsd">
<!-- _________________________ Application Settings _________________________ -->
<app title="Vikings" file="game-jam-template" main="Main" version="0.0.1" company="HaxeFlixel" />
<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file
or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
<app preloader="flixel.system.FlxPreloader" />
<!--Minimum without FLX_NO_GAMEPAD: 11.8, without FLX_NO_NATIVE_CURSOR: 11.2-->
<set name="SWF_VERSION" value="11.8" />
<!-- ____________________________ Window Settings ___________________________ -->
<!--These window settings apply to all targets-->
<window width="800" height="600" fps="60" background="#000000" hardware="true" vsync="false" />
<!--HTML5-specific-->
<window if="html5" resizable="false" />
<!--Desktop-specific-->
<window if="desktop" orientation="landscape" fullscreen="false" resizable="true" />
<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />
<!--<template path="temp/AndroidManifest.xml" rename="app/src/main/AndroidManifest.xml" />
<window if="android" path="temp/AndroidManifest.xml" rename="app/src/main/AndroidManifest.xml" />
<window if="mobile" path="temp/AndroidManifest.xml" rename="app/src/main/AndroidManifest.xml" />-->
<!-- _____________________________ Path Settings ____________________________ -->
<set name="BUILD_DIR" value="export" />
<source path="src" />
<assets path="assets" rename="assets" embed="false" />
<!--<assets path="assets" rename="assets" embed="false" />-->
<!--<assets path="assets" />-->
<!-- _______________________________ Libraries ______________________________ -->
<haxelib name="flixel" />
<haxelib name="openfl"/>
<template path="templates"/>
<!--In case you want to use the addons package-->
<!--<haxelib name="flixel-addons" />-->
<!--In case you want to use the ui package-->
<!--<haxelib name="flixel-ui" />-->
<!--In case you want to use nape with flixel-->
<!--<haxelib name="nape-haxe4" />-->
<!-- ______________________________ Haxedefines _____________________________ -->
<!--Enable the Flixel core recording system-->
<!--<haxedef name="FLX_RECORD" />-->
<!--Disable the right and middle mouse buttons-->
<!--<haxedef name="FLX_NO_MOUSE_ADVANCED" />-->
<!--Disable the native cursor API on Flash-->
<!--<haxedef name="FLX_NO_NATIVE_CURSOR" />-->
<!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game-->'
<haxedef name="FLX_NO_MOUSE" if="mobile" />
<haxedef name="FLX_NO_KEYBOARD" if="mobile" />
<haxedef name="FLX_NO_TOUCH" if="desktop" />
<!--<haxedef name="FLX_NO_GAMEPAD" />-->
<!--Disable the Flixel core sound tray-->
<!--<haxedef name="FLX_NO_SOUND_TRAY" />-->
<!--Disable the Flixel sound management code-->
<!--<haxedef name="FLX_NO_SOUND_SYSTEM" />-->
<!--Disable the Flixel core focus lost screen-->
<!--<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />-->
<!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!-->
<haxedef name="FLX_NO_DEBUG" unless="debug" />
<!--Enable this for Nape release builds for a serious peformance improvement-->
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" />
<!-- _________________________________ Custom _______________________________ -->
<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
</project>
Something wrong with it, GAF requires Starling, above template for(from) Flixel
I took a template from Flixel and added Starling to it, for html5 everything worked