Android build error in 0.6 - external libraries not supported?

Hello!, I got this error when I tried to build my project for android, I’m using an external library for math operations, the library works well in most targets, even in webgl, is this a bug or am I missing something?

Can you post your khafile.js. It is saying that there is a problem with it. Armory generates the file automatically when you build your project. It should be adjacent to the blend.

Sure, here is the file.

something interesting I noticed when I opened the file, there is no dot between (“hxmath”) and project…
I don’t know if that’s a bug when it auto generates.

Sorry, I can’t get to Google drive ( a problem on my side not your side ). Could you use a GitHub gist or just post it in a code block? Thanks. :slight_smile:

This is the content of the file.

// Auto-generated
let project = new Project(‘SuperRemake64v0.1’);

project.addSources(‘Sources’);
project.addLibrary(“C:/Users/Aryok/Desktop/Armory v0.6/Armory/armsdk/armory”);
project.addLibrary(“C:/Users/Aryok/Desktop/Armory v0.6/Armory/armsdk/iron”);
project.addLibrary(“hxmath”);
project.addLibrary(“C:/Users/Aryok/Desktop/Armory v0.6/Armory/armsdk/lib/haxebullet”);
project.addParameter(‘-dce full’);
project.addParameter(‘arm.Mario’);
project.addParameter(“–macro keep(‘arm.Mario’)”);
project.addParameter(‘arm.PreLand’);
project.addParameter(“–macro keep(‘arm.PreLand’)”);
project.addParameter(‘arm.TripleJump’);
project.addParameter(“–macro keep(‘arm.TripleJump’)”);
project.addParameter(‘arm.DoubleJump’);
project.addParameter(“–macro keep(‘arm.DoubleJump’)”);
project.addParameter(‘arm.SideFlip’);
project.addParameter(“–macro keep(‘arm.SideFlip’)”);
project.addParameter(‘arm.Stop’);
project.addParameter(“–macro keep(‘arm.Stop’)”);
project.addParameter(‘arm.GroundPoundStand’);
project.addParameter(“–macro keep(‘arm.GroundPoundStand’)”);
project.addParameter(‘arm.DiveStand’);
project.addParameter(“–macro keep(‘arm.DiveStand’)”);
project.addParameter(‘arm.AirKick’);
project.addParameter(“–macro keep(‘arm.AirKick’)”);
project.addParameter(‘arm.Turning2’);
project.addParameter(“–macro keep(‘arm.Turning2’)”);
project.addParameter(‘arm.BackFlip’);
project.addParameter(“–macro keep(‘arm.BackFlip’)”);
project.addParameter(‘arm.DiveRoll’);
project.addParameter(“–macro keep(‘arm.DiveRoll’)”);
project.addParameter(‘arm.SingleJump’);
project.addParameter(“–macro keep(‘arm.SingleJump’)”);
project.addParameter(‘arm.CrouchSlide’);
project.addParameter(“–macro keep(‘arm.CrouchSlide’)”);
project.addParameter(‘arm.GroundPoundLanding’);
project.addParameter(“–macro keep(‘arm.GroundPoundLanding’)”);
project.addParameter(‘arm.VirtualGamepad’);
project.addParameter(“–macro keep(‘arm.VirtualGamepad’)”);
project.addParameter(‘arm.Step’);
project.addParameter(“–macro keep(‘arm.Step’)”);
project.addParameter(‘arm.FollowCamera’);
project.addParameter(“–macro keep(‘arm.FollowCamera’)”);
project.addParameter(‘arm.Turning1’);
project.addParameter(“–macro keep(‘arm.Turning1’)”);
project.addParameter(‘arm.GroundPound’);
project.addParameter(“–macro keep(‘arm.GroundPound’)”);
project.addParameter(‘arm.LongJump’);
project.addParameter(“–macro keep(‘arm.LongJump’)”);
project.addParameter(‘arm.Hit’);
project.addParameter(“–macro keep(‘arm.Hit’)”);
project.addParameter(‘arm.Land’);
project.addParameter(“–macro keep(‘arm.Land’)”);
project.addParameter(‘arm.MovingPunch’);
project.addParameter(“–macro keep(‘arm.MovingPunch’)”);
project.addParameter(‘arm.Run’);
project.addParameter(“–macro keep(‘arm.Run’)”);
project.addParameter(‘armory.trait.physics.bullet.RigidBody’);
project.addParameter(“–macro keep(‘armory.trait.physics.bullet.RigidBody’)”);
project.addParameter(‘arm.DiveSlide’);
project.addParameter(“–macro keep(‘arm.DiveSlide’)”);
project.addParameter(‘arm.Idle’);
project.addParameter(“–macro keep(‘arm.Idle’)”);
project.addParameter(‘arm.WallJump’);
project.addParameter(“–macro keep(‘arm.WallJump’)”);
project.addParameter(‘arm.CrouchStand’);
project.addParameter(“–macro keep(‘arm.CrouchStand’)”);
project.addParameter(‘arm.Dive’);
project.addParameter(“–macro keep(‘arm.Dive’)”);
project.addParameter(‘arm.StartCrouching’);
project.addParameter(“–macro keep(‘arm.StartCrouching’)”);
project.addParameter(‘arm.WallHit’);
project.addParameter(“–macro keep(‘arm.WallHit’)”);
project.addParameter(‘armory.trait.physics.bullet.PhysicsWorld’);
project.addParameter(“–macro keep(‘armory.trait.physics.bullet.PhysicsWorld’)”);
project.addParameter(‘arm.StopStand’);
project.addParameter(“–macro keep(‘arm.StopStand’)”);
project.addParameter(‘arm.Punch’);
project.addParameter(“–macro keep(‘arm.Punch’)”);
project.addParameter(‘arm.Crouching’);
project.addParameter(“–macro keep(‘arm.Crouching’)”);
project.addParameter(‘arm.Coin’);
project.addParameter(“–macro keep(‘arm.Coin’)”);
project.addShaders(“build_PHBoy/compiled/Shaders/.glsl", { noembed: false});
project.addAssets(“build_PHBoy/compiled/Assets/**”, { notinlist: true });
project.addAssets("build_PHBoy/compiled/Shaders/
.arm”, { notinlist: true });
project.addAssets(“Bundled/SuperMario256/SuperMario256.ttf”, { notinlist: false });
project.addAssets(“Bundled/config.arm”, { notinlist: true });
project.addAssets(“Bundled/fullscreen.png”, { notinlist: true });
project.addAssets(“Bundled/joystick.png”, { notinlist: true });
project.addAssets(“Bundled/patreon.jpg”, { notinlist: true });
project.addAssets(“Bundled/paypal.jpg”, { notinlist: true });
project.addDefine(‘arm_hosek’);
project.addDefine(‘arm_legacy’);
project.addDefine(‘rp_renderer=Forward’);
project.addDefine(‘rp_background=Clear’);
project.addDefine(‘rp_gi=Off’);
project.addDefine(‘arm_no_audio’);
project.addDefine(‘kha_no_ogg’);
project.addDefine(‘arm_physics’);
project.addDefine(‘arm_bullet’);
project.addDefine(‘arm_published’);
project.addDefine(‘arm_soundcompress’);
project.addDefine(‘arm_skin_mat’);
project.addDefine(‘arm_skin’);
project.addDefine(‘arm_config’);
project.addDefine(‘arm_loadscreen’);
project.addDefine(‘arm_resizable’);
project.addLibrary(“hxmath”)project.targetOptions.android_native.package = ‘org.armory3d.arm’;
project.targetOptions.android_native.screenOrientation = ‘landscape’;

resolve(project);

I think its this line right here, missing the semicolon and the newline after ("hxmath"). How are you adding the library? Did you just drop it in the Libraries folder next to the blend for your project?

I added the library the way I followed in a tutorial, basically created a text file called “ExternalLibs” in blenders text editor with only one line

project.addLibrary(“hxmath”)

then in armory modules selected that file

Ok, then all you have to do is add a semicolon ( and/or a newline ) to the end of that line in the text file in blender and you should be good.

Weird it was working with everything else, compiler never gave me errors only for android, I’ll try and let you know

1 Like

It looks like the reason it only broke with android is because it only adds extra text after your line of code when you are publishing to android. That is what those lines at the end are:

project.targetOptions.android_native.package = 'org.armory3d.arm';
project.targetOptions.android_native.screenOrientation = 'landscape';

They only get added to the file for android builds. Without them, there is still that extra newline added to the end right before resolve(project); so it works fine.

I see, that explains why it was failing.

The error seems to be gone, but now I got these errors

That seems like an issue with the traits using the hxmath class, but you said it is working for a Krom build right?

Maybe post a Gist with one of those traits so I can see the lines that it is complaining about.

Thanks zicklag, yes I think it’s because I’m mixing regular iron.math with this, only android is complaining, I’ll try to fix one of those and get back.

1 Like

This is the first error in the dive class, here line 7 is line 23 of my source file.

setVel and getVel expects a hxmath type

but my function getForward returns an iron.math type

I don’t know if this information is useful.

this is the library that I’m using https://github.com/tbrosman/hxmath
Maybe you can try it, I might be doing something wrong in my setup.

Nvm, I think I know what is going on, I’m not doing casting, I tried with that error above, this is what I did:

player.setVel(player.getVel().addWith(cast (player.getForward().mult(2.5), Vector3)));

and it got rid of that error, I keep casting with the rest.

Edit:
Yeah that was it, finally could compile for android, now I will see if android studio builds without errors.

1 Like