0
votes

Apk cannot be build because of errors, some obvious troubleshooting doesnt fix it

I start an AIR Mobile AS3 App project. Finally I can say it correctly found its AIR and Flex folders. There have been threads about such issues but not with latest versions of Flex and mostly with AIR. So a new project with latest flex and AIR, I installed the AppMan package Flex SDK + AIR SDK 4.6.0. + 32.0.0

Obvious paths in the SetupSDK.bat are:

..(whatever drive)\FlashDevelop-5.3.3\Apps\flexairsdk\4.6.0+32.0.0
..(whatever drive)\FlashDevelop-5.3.3\Tools\android (that includes platform-tools containing adb.exe)

… and so application.xml must have ? application xmlns="http://ns.adobe.com/air/application/32.0"

defaults in 28.0 but that changes nothing

Yes certificate is created from the bat

And that's it, a simple embedded image display: I have to switch between Debug and Release when pressing F5 because repeating twice Debug or Repeat causes the error that var value for image is empty, but if you alternate it displays image in Device window so i will assume it compiles well.

Or deleting the project.swf generated on compilation also allows to display the image if running Debug or Release for first time.

But t he error is when running the PackageApp.bat and [1] for normal apk

2
Show the AS3 code part that causes the error var value for image is empty. Are you... well, whatever you're doing. For a faster answer: Start by showing some code that re-creates this issue. - VC.One

2 Answers

1
votes

http://www.flashdevelop.org/community/viewtopic.php?f=6&t=12144

This solved the issue. I had to install JRE 1.6 too since 1.8 has bugs with FD. set the path for java.home in jvm.config to use the JRE 1.6 folder, no more 'Variable not defined', it was common message, and now I can F5 without the error, thanks for the above tips for Bitmap still.

0
votes

Regarding your code at: http://oneclickpaste.com/26534/

In Main.as try to close the import with a ; (just in case it's giving a weird technical issue).
example: import com.mee.ptest.PicTest;

In PicTest.as you need to fix this line: iPic = new PicTest.cTestPic();
To become as: iPic = new cTestPic() as Bitmap;.

Example for PicTest.as:

package com.mee.ptest 
{
    import flash.display.Bitmap;
    import flash.display.Sprite;

    public class PicTest extends Sprite 
    {
        [Embed(source="../../../assets/testpic.jpg")]
        private static var cTestPic :Class;
        private var iPic :Bitmap;               

        public function PicTest()  
        {
            iPic = new cTestPic() as Bitmap;
            addChild(iPic);
        }

    }

}

And then example for Main.as:

import flash.desktop.NativeApplication;
import flash.events.Event;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.display.Bitmap;

import flash.display.*; 
import com.mee.ptest.PicTest;

public class Main extends Sprite 
{   
    public var pic : PicTest;

    public function Main() 
    {
        stage.scaleMode = StageScaleMode.NO_SCALE;
        stage.align = StageAlign.TOP_LEFT;
        stage.addEventListener(Event.DEACTIVATE, deactivate);

        Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

        //# check if app is ready to display visual items...
        if (stage) {  show_Pic(); }
        else { addEventListener( Event.ADDED_TO_STAGE, show_Pic ); }

    }

    private function show_Pic() :void 
    {
        pic = new PicTest();
        addChild(pic);
    }

    private function deactivate(e:Event) :void 
    {
        // make sure the app behaves well (or exits) when in background
        //NativeApplication.nativeApplication.exit();
    }

}