[MERGED] Android Build in the Editor

Started by eri0o, Tue 08/02/2022 21:44:30

Previous topic - Next topic

AndreasBlack

Is this tutorial still the method to build for android in the latest AGS beta? I'm trying to make it work, but i get a failure when setting the folder for SDK. I'm probably missing some windows files or such. Windows 7 anything obvious i should have downloaded apart from android studio and all the sdk files? The Java JRE folder seems fine, but setting it to the C:\Users\Andreas\AppData\Local\Android\sdk throw's me an error: I've created a storekey using the dos prompt, i have no idea if that works either, since i get this error..

"can't find sdkmanager" it says..

Downloaded all the sdk libraries as in the tutorial, accepted the licenses unless i mispressed, but i don't think i did! Anyway to check? I've never used Android Studio. Do i need to create a sdkmanager.bat file in notepad or something? Clueless, sorry as always for being annoying  (laugh)

eri0o

Can you tell me exactly what Android Studio version you downloaded?

In the first post there's a FAQ, you need to follow the steps there to install the SDK.

Btw, I don't know if Android Studio works on Windows 7 since I never used it there and the OS is unsupported by MS, so there's that too.

Crimson Wizard

Quote from: eri0o on Sat 21/05/2022 01:12:18
Btw, I don't know if Android Studio works on Windows 7 since I never used it there and the OS is unsupported by MS, so there's that too.

It worked for me last time I tried.

AndreasBlack

#83
Quote from: eri0o on Sat 21/05/2022 01:12:18
Can you tell me exactly what Android Studio version you downloaded?


I've tried to follow your instructions. The link in the first step i've hit download on that one version! "Android Studio Chipmunk | 2021.2.1 for Windows 64-bit (929 MiB" Then i've downloaded inside the Android Studio all the SDK's i could see. Etc. Accepted the licenses, like i wrote before. So in my mind i've followed the steps, as good as i could. I got an error too btw while trying to create the keystore inside of AGS, so i had to follow a tutorial on google instead where i did it in the command prompt.  (roll)

martag

Hello, I was able to generate an APK, install it and run it on my Android. I have two questions>

1. Is this the same APK that potentially can go in the Google Store or is there another procedure for that?
2. Any tricks to remove the white arrow cursor?

I will also need to fix the portrait mode. I saw that you spoke about this in the chat, I will go through the previous messages of this conversation. Thanks in advance! ;-D

Crimson Wizard

Quote from: martag on Sun 22/05/2022 21:47:42
2. Any tricks to remove the white arrow cursor?

Is this arrow cursor a part of the game? in such case you may hide the cursor either using Mouse.Visible property, or switching cursor graphics with a transparent 1x1 sprite. This may be done under condition that the game is run on Android, for example:
Code: ags

function game_start() {
    if (System.OS == eOSAndroid) {
        Mouse.Visible = false;
    }
}

eri0o

#86
Quote from: martag on Sun 22/05/2022 21:47:42
1. Is this the same APK that potentially can go in the Google Store or is there another procedure for that?

@martag, APKs are not accepted in Google Play, you need to generate an AAB. On the AGS Editor, in General Settings, in the Android group select either AAB or AAB Embedded. Basically it goes like this:


  • If your game is up to 85 MB, you can select AAB Embedded - Game is delivered with Store generated APK.
  • If your game is bigger than that, you must select AAB - Game is delivered as an asset to the APK, it looks like APK for the player, but download works slightly different behind the scenes.

Your game top limit in size is 500MB for Google Play, so use sprite compression, reduce audio quality and overall try to stay below 500MB. There's no easy way to go to sizes bigger than this right now in Google Play using AGS Engine. AABs are not easy to test locally currently, there's a command line tool from Google, but it can only work with AAB Embedded.

Google ups the SDK API target limit around every six to twelve months, I usually keep track of this, but if Google Play Console complains the API is too low we can up the version number easily.

AndreasBlack

#87
For those who might run into the same problem as me. Here's the solution, yes it might sound dumb at first, but hear me out. You have to go "computer, c: (if that's where yoru windows user directory is)

Mine is C:\Users\Andreas\AppData\Local\Android\Sdk

This is really odd behaviour, i'm just saying. Chosing the link by clicking directly on Andreas\appdata\local\android\sdk did not work. Perhaps it's like always. Unique bug cause my brain is strange!  (laugh) Or that's "wrong" of me. It's something about the pathfinding not working correctly that way i suppose, in my mind c:\users should be automatically "recognised". You need the "c:\users" and not just "\andreas\appdata". That's my best guess to why it didn't work before!

Edit: a Question. So my game is 320x200 and i used the "render sprites at screen resolution" option, but that seems to not be happening. When my character looks like quasimodo in the face, it's quite obvious somethings gone bad  (laugh) Am i missing something? Anti-alias sprites perhaps?



Crimson Wizard

#89
Quote from: AndreasBlack on Mon 23/05/2022 21:56:33
Edit: a Question. So my game is 320x200 and i used the "render sprites at screen resolution" option, but that seems to not be happening. When my character looks like quasimodo in the face, it's quite obvious somethings gone bad  (laugh) Am i missing something? Anti-alias sprites perhaps?

Please, could you be more specific, what is "not happening"? What do you expect, what happens in reality? Does "it" happen on desktop PC? How do you set the config on android?

eri0o

I began writing the manual entry for building for Android from AGS, hope to have it finished soon, hopefully it can help anyone using it - still trying to figure out the best order to approach each subject.

AndreasBlack

#91
Quote from: Crimson Wizard on Sat 28/05/2022 22:08:11


Please, could you be more specific, what is "not happening"? What do you expect, what happens in reality? Does "it" happen on desktop PC? How do you set the config on android?

I've just tried the latest AGS 3.6 beta 6, same issue.
For the PC Version Build (Built at the same time as the Android version) "Render Sprites at Screen Resolution" it works! But Android does not work.

When the characters scale they should somewhat still be in their "high resolution look" and not get pixelated and loose details. So "Render sprites at Screen Resolution" Again. No effect on the android build. At least not my Android build! I do get some warnings when building. Perhaps they are the cause. I have no idea! These are the warnings i get inside the dosprompt window.


Maybe the android port somehow misses the feature? Here's an example of how it looks. Clearly when the characters scale he turns ugly, when he shouldn't.

Edit: The photo is ofc screenshot from my Samsung Galaxy S7 running the latest build to show how it looks. Perhaps it's the phones fault. :-D

[imgzoom]https://i.imgur.com/EjAdTM6.jpg[/imgzoom]


Edit: Here's a normal link it doesn't show the error message fully on the board, so here it is (the error/warnings when building) in it's full detail: https://i.imgur.com/9NbZuXT.jpg



eri0o

Any chance you can hit Ctrl+v (it's under Keys, at the end of the key list after you hit back) or use I believe Debug(1,0) ? It could be you are using the software renderer instead of the hardware renderer. Also I don't think that option exists in android.cfg, so you need to set it in your game through scripting.

https://adventuregamestudio.github.io/ags-manual/System.html#systemrenderatscreenresolution

AndreasBlack

#93
Quote from: eri0o on Tue 31/05/2022 14:41:07
Any chance you can hit Ctrl+v (it's under Keys, at the end of the key list after you hit back) or use I believe Debug(1,0) ? It could be you are using the software renderer instead of the hardware renderer. Also I don't think that option exists in android.cfg, so you need to set it in your game through scripting.

https://adventuregamestudio.github.io/ags-manual/System.html#systemrenderatscreenresolution

Thanks will try your idea, maybe that's what's happening! I'm using Direct3d 9 in the Default Setup btw. I have to build the game again with debugging enabled to be able to do what you ask, i suppose. Will try later and edit this post the result.

Oh, and btw pushing the back button and trying to enter a password aka using the text parser throw's me an error and game crash. I believe the error probably has to do with that i use an ä letter, not sure tho.

Edit: Just to make sure. It's the android build i'm discussing only here!

eri0o

AGS should use OGL if you specified D3D and it doesn't find it (there's no D3D in Android). So it's probably the setting itself, please try setting it like at game_start and see if it solves your problem. You can also later make a GUI in your game to config to let the player configure if sprites should be rendered at screen resolution or not if you feel the need to do so.

Code: ags
System.RenderAtScreenResolution = true;


About the keyboard input, can you tell me how you are receiving the player keys? Like, is it a custom Gui and label with on_key_press, is it a textbox, are you using Game.InputBox, ... What's the way you are acquiring the keys? When I tested this before it was working but maybe something got broken or there's some specific character I did not test...

AndreasBlack

#95
Quote from: eri0o on Tue 31/05/2022 16:13:59
AGS should use OGL if you specified D3D and it doesn't find it (there's no D3D in Android). So it's probably the setting itself, please try setting it like at game_start and see if it solves your problem. You can also later make a GUI in your game to config to let the player configure if sprites should be rendered at screen resolution or not if you feel the need to do so.

Code: ags
System.RenderAtScreenResolution = true;


About the keyboard input, can you tell me how you are receiving the player keys? Like, is it a custom Gui and label with on_key_press, is it a textbox, are you using Game.InputBox, ... What's the way you are acquiring the keys? When I tested this before it was working but maybe something got broken or there's some specific character I did not test...


Edit 2: The code you've wrote did nothing it's still Software Rendering. But did you see my warning messages in the screenshot posted previously? Perhaps they are the cause, i don't know. You might know!

Turns out, it's not the choice of D3D that's causing it. I've changed to Open-GL and ctrl+v clearly shows software renderer like you've said before. So now we know that!
The error message is regarding the "ätbajs". I have other parser answer alternatives too, but even if i write any of those answers they still give me the error and the app is crashing. and Btw just to give you even more headaches, there seems to be an issue with trying to reinstall the app. I've tried several times now. Un-installed the previous game, downloaded the new app with Open-GL in the settings this time obviously into the phone, etc. And it says program wasn't installed and i click "done" and can't seem to install it again, yes, it's uninstalled, re-booted the phone, i've tried the re-upload the apk to google drive, gonna try again ofc, but it happened before, so it's not a one time thing, unfortunaly. Any idea why this is happening? Now i've turned off the phone, see if that helps.. 

Code: ags

function cmdbox_OnActivate(GUIControl *control)
{cmdbox.Visible = false;


    Wait(1);
    Parser.ParseText  (cmdbox.Text);
    String badword = Parser.SaidUnknownWord();
    
    
    
    if (badword !=null)  

  {

   player.SayAt(110, 75, 100, "Wrong password");
   

   
   player.ChangeRoom(1, 506, 121);
   cmdbox.Text = (""); //rensa texten pÃ¥ GUi
    
}

    else if (Parser.Said("ätbajs")) 
{ 
player.ChangeRoom(4);

}

Crimson Wizard

#96
Quote from: AndreasBlack on Tue 31/05/2022 16:51:46
Edit 2: The code you've wrote did nothing it's still Software Rendering.

That code is not for changing renderer type, but "Render at screen resolution" setting. It is not supported by software renderer btw.
It's possible to test if renderer type is software or not using "System.HardwareAcceleration".

QuoteOh, and btw pushing the back button and trying to enter a password aka using the text parser throw's me an error and game crash. I believe the error probably has to do with that i use an ä letter, not sure tho.

Please tell, what error is that? Does it happen on desktop?

AndreasBlack

#97
Quote from: Crimson Wizard on Tue 31/05/2022 17:34:33

Please tell, what error is that? Does it happen on desktop?

It's funny you'd say that. Cause i've just tried that "System.HardwareAcceleration" that is, and yes, it's not showing. Just red it in the manual, ha ha! So what else could be causing it? Any ideas? Is it that my phone is the wrong Android for the build itself? I installed all sdk packages even Jelly Bean 4.1 or something like that, if that's got something to do with it? That my phone is the "wrong" android system. Like mine may not be 8.1, bla bla bla?

As for the question, i did write that it's only regarding Android, so nothing we are discussing now happens on the PC build, everything is working fine there! It's just the Android. It's basically stating that "Ã,,tbajs parser else if error" something along that line. Cause unfortunaly. The phone won't let me install the app again  8-0. So i've re-started the phone, turned off the phone, and if i'm lucky it will let me install again! I wonder what's causing this. I know sometimes it shows "install unknown source" and i've ofc clicked yes there to install, but i'm not getting any such messages it just says "The app has not installed" and i have one choice which is to tap "done".  (roll)

Edit: Moved the downloaded APK to an SDcard in the phone, that worked, random luck, i suppose. The error message is as follows: Error: Said: supplied word 'tbajs' is not in the dictionary or is an ignored word Text %)*bajs"

I can't do the exact symbal that shows up before "bajs".
so it's obvious to me that it probably has to do with the letter Ã,, being in usage in the word itself. But it's funny. Because i actually wrote another else if answer which was not "ätbajs". So it's a bit of a weird error, i think.
And again, just to be clear. This all works in the PC Build.

Mareike

Hi,
it is great that you can build your AGS game for Android, unfortunatelly it looks like I have a compatibility problem somewhere. I checked the compatibility table for Java and Gradle but I still cannot compile my game for android.
It would be really great if someone has a hint for solving this issue.

Best
Mareike


-----------------------------------------------------------------
My Output:
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.5/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\xxx\Documents\PaC\xxx\Compiled\Android\mygame\settings.gradle' (C:\Users\xxx\.gradle\caches\7.5\scripts\2so6athllb9um441ymy4k1vxd).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Drücken Sie eine beliebige Taste . . .



--------------------------------------------------------------------------------
My Versions:
java version "20.0.2" 2023-07-18
Java(TM) SE Runtime Environment (build 20.0.2+9-78)
Java HotSpot(TM) 64-Bit Server VM (build 20.0.2+9-78, mixed mode, sharing)


------------------------------------------------------------
Gradle 8.1.1
------------------------------------------------------------

Build time:   2023-04-21 12:31:26 UTC
Revision:     1cf537a851c635c364a4214885f8b9798051175b

Kotlin:       1.8.10
Groovy:       3.0.15
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          20.0.2 (Oracle Corporation 20.0.2+9-78)
OS:           Windows 10 10.0 amd64

--------------------------------------------------------------
AGS Editor .NET (Build 3.6.0.48)
v3.6.0, May 2023
Copyright © 2006-2011 Chris Jones and 2011-2023 others.
See the Licenses folder for copyrights of used libraries.
DockPanel Suite © 2007 Weifen Luo
irrKlang © 2001-2018 Nikolaus Gebhardt / Ambiera
Magick.NET © 2013-2019 Dirk Lemstra
Newtonsoft JSON.NET © 2007 James Newton-King
Scintilla © 1998-2003 Neil Hodgson
System: Windows 10

eri0o

#99
The Android Build can only work with Android Studio, as written in the manual. Which Android Studio are you using?

I also always recommend using the latest AGS (3.6.1.8) and latest Android Studio - use the JetBrains Toolbox to follow the Android Studio releases and easily upgrade. This is because Google Play Store has strict requirements for what version of the API you are targeting and how you build - and following up includes upgrading other things like SDL and keep compatibility in AGS engine with newer android versions. So if you are using an older version of the engine, even if it builds, you won't be able to release. We are using Gradle 8.3 currently which is compatible with the latest Android Studio - and near future upgrades.

I see your error reports a previous Gradle version, and one possible issue is that version isn't compatible with java 20 - I can't tell if you installed it manually or not. In any case I recommend using the java from Android Studio and not a manually installed version. Unfortunately there isn't much we can do regarding the build environment with Google using Google Play to keep upgrades going - we do try to keep it working in older Android versions, as long it's supported by the newer tooling, I believe it should work from Android 5 to 14.

SMF spam blocked by CleanTalk