[EXPERIMENTAL] Android Build in the Editor (v9)

Started by eri0o, 08 Feb 2022, 21:44

« previous - next »

eri0o

This usually means that JAVA_HOME is set to directory where JDK was not installed. Did you set up Java through a separate installer or are you using the one that is provided along Android Studio? If you are the one with android Studio, can you tell me which version?

Laura Hunt

#21
I installed everything though Android Studio, the latest version 2021.1.1 Patch 1. The path is correct, C:\Program Files\Android\Android Studio\jre.

Crimson Wizard

#22
Quote from: Laura Hunt on 12 Feb 2022, 18:32
Also, an interesting side effect was that in the compiled Windows version, frame-linked sounds were not playing at all. I don't know what this has to do with the changes introduced for the Android build, but I can confirm that when I compiled and ran my game with the "vanilla" AGS 3.6.0.17 Alpha 18 build, those sounds played correctly.

There's something broken in the master branch after the audio refactor i did few days ago.

From my own tests, ViewFrame sounds sometimes play and sometimes don't, which seem random.

eri0o

#23
Quote from: Laura Hunt on 12 Feb 2022, 21:01
I installed everything though Android Studio, the latest version 2021.1.1 Patch 1. The path is correct, C:\Program Files\Android\Android Studio\jre.

Thanks, I found the error! I will upload a new version that should take care of this, just need to check if I made any more mistakes on this part. :/

Edit: actually turns out it was 3 errors. I am still checking to see if there's something more I missed.

eri0o

#24
@Laura Hunt, I think I fixed all the errors (erh, at least the reported ones, if there are more, please tell me!). Thanks for the screen caps and the error messages! They were very helpful! I setup from a new install in my PC here and it appears it's working. I updated the files on the google drive linked in the first post!

Ah, right, about the sound, what CW said. It should be fixed soon.

@Mehrdad, I added the rotation config through Default Setup and updated the main post. It should be working now. About the click, I agree there are necessary enhancements for touch input. I wrote the general gist of what I think here, but I won't be working in this just right now. For now I want to get the build working.

Laura Hunt

With the new build I'm not getting the reported errors anymore, but:

Quote> Task :app:validateSigningRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'C:\Users\xxxxx\Documents\AGS Projects\ioawn4t - Android\Compiled\Android\mygame\app\Γ?¬C:\Users\xxxxx\keystore.jks' not found for signing config 'release'.

I guess this error is on my side, but I generated my key through Android Studio itself so I have no idea what might have gone wrong (Build->Generate APK->Create new->Filled everything out->Selected 'release' as build variant.)

Mehrdad

#26
Quote
@Mehrdad, I added the rotation config through Default Setup and updated the main post. It should be working now. About the click, I agree there are necessary enhancements for touch input. I wrote the general gist of what I think here, but I won't be working in this just right now. For now I want to get the build working.

@eri0o

Great!. I tested "Lanscape" now and works perfect but with a little issue. After run, I have some multi-screen ( Below picture). But it solves itself after some clicks. (like mobile back key )

I have Android 5.1.  With Api 19 or 20 I think so. It's really old cellphone :-D

I tested back click too and works perfect for "F1,F2,..." and "show keyboard" and "exit"

As I said before we need to "release mouse" instead "press down" on mobiles. User wants search hotspots with finger moves on screen. It start to walking with "press down" and mobile users don't want it.

Thanks so much again for your hardworks

My official site: http://www.pershaland.ir/

eri0o

@Laura Hunt, I will investigate, it may be something like special characters on path, spaces on a folder name or something else not related. I will try to reproduce here and see if I can figure it out.

@Mehrdad, the image is weird, I don't know what could be yet. Have you tried changing the renderer, like do you get that same image with both OGL and Software renderer? I have no idea what could be to cause that image yet.

About control scheme I don't fully understand what you mean yet, but again, multi touch or a more natural touch scheme is not something I am going to look into now. This would require touch specific events which would allow the developer to script whatever scheme they feel they want, instead of hardcoding any behavior at all.

Laura Hunt

Quote from: eri0o on 13 Feb 2022, 08:50
@Laura Hunt, I will investigate, it may be something like special characters on path, spaces on a folder name or something else not related. I will try to reproduce here and see if I can figure it out.

There are no special characters or spaces in the path or anything of the sort, so it's likely that I've done something wrong at some point, given that it works for Mehrdad and Joseph. If you can figure it out or provide detailed instructions as to how to create a keystore that would be great, but if not, no worries. At least Mehrdad has confirmed that it works correctly, and I'm sure somebody else will step in to test it too :)

eri0o

#29
I meant more there's an hyphen in your game dir, after a space character, I don't know if this may trigger something somewhere to think the directory may be a parameter. (Yes, I should escape characters as needed, but I am still writing the escaping code so for now it's not good :/)

Anyhow, if you set the password for the keystore and the keystore location in the AGS Editor -> Preferences -> Advanced -> the things under Android, when setting the Android Keystore path the Editor do checks to see if it's really there. There's also a very weird thing that Android Studio asks now is that the keystore and the key passwords are the same. I haven't tried using different ones to see what kinda of error message it outputs. I am out of home now, will check when I get back.

Laura Hunt

#30
Quote from: eri0o on 13 Feb 2022, 09:18
I meant more there's an hyphen in your game dir, after a space character, I don't know if this may trigger something somewhere to think the directory may be a parameter. (Yes, I should escape characters as needed, but I am still writing the escaping code so for now it's not good :/)

My game dir was "ioawn4t - Android", so I changed it to "ioawn4tAndroid" and moved it to a path with no spaces or hyphens whatsoever, and I'm still getting the same error.

Quote from: eri0o on 13 Feb 2022, 09:18
Anyhow, if you set the password for the keystore and the keystore location in the AGS Editor -> Preferences -> Advanced -> the things under Android, when setting the Android Keystore path the Editor do checks to see if it's really there. There's also a very weird thing that Android Studio asks now is that the keystore and the key passwords are the same. I haven't tried using different ones to see what kinda of error message it outputs. I am out of home now, will check when I get back.

Both passwords are the same, yes. And the .jks file is definitely there in the path that I entered (no spaces or anything there either).

btw, when I close the editor, the process OpenJDK Platform Binary keeps running hogging a ton of memory, and it keeps some files locked until I kill it from the Task Manager. Not sure if this is useful to know!


Mehrdad

#31
Quote from: eri0o on 13 Feb 2022, 08:50

@Mehrdad, the image is weird, I don't know what could be yet. Have you tried changing the renderer, like do you get that same image with both OGL and Software renderer? I have no idea what could be to cause that image yet.

About control scheme I don't fully understand what you mean yet, but again, multi touch or a more natural touch scheme is not something I am going to look into now. This would require touch specific events which would allow the developer to script whatever scheme they feel they want, instead of hardcoding any behavior at all.

I forgot adjust it on openGL and it's on D3D. Maybe problem is here.Also, I'll change "Fullscreen scaling style" too. I'll test it and let you know. Please if anyone has my problem let me know too maybe my Android is too old. ( Android 5.1)

For touch: My mean is please add "release mouse" to AGS system. It works on "press mouse" now and it's not suiatble for mobiles
My official site: http://www.pershaland.ir/

Crimson Wizard

#32
Quote from: Mehrdad on 13 Feb 2022, 08:10
As I said before we need to "release mouse" instead "press down" on mobiles. User wants search hotspots with finger moves on screen. It start to walking with "press down" and mobile users don't want it.

@Mehrdad, indeed AGS currently does not have a ready event for released mouse, but you can change your script to react to the mouse state change (pressed - released) in the repeatedly_execute.

To do this:
1) have a global variable to remember last mouse button state
2) check in repeatedly_execute for the current mouse button state
3) compare to the last saved state. If button's state changed, do the action.
4) save new state in the variable.

Code: ags

bool was_mouse_down;

function repeatedly_execute()
{
     bool mouse_down = Mouse.IsButtonDown(eMouseLeft);
     if (mouse_down && !was_mouse_down)
     {
         // user just pressed the button
     }
     else if (!mouse_down && was_mouse_down)
     {
         // user just released the button
     }
     was_mouse_down = mouse_down; // remember new state
}


Also I may recommend speaking with Wadjet Eye (Dave and Janet Gilberts) and other people who ported their games to mobile, perhaps they will have some advices.

Mehrdad

@Crimson Wizard

Sorry, I didn't right understand. Do must I make global variables? And after that how can I fill your conditions?

I remember to play Gemini Rue on my cellphone and had this problem.
My official site: http://www.pershaland.ir/

Crimson Wizard

#34
Quote from: Mehrdad on 13 Feb 2022, 13:12
Sorry, I didn't right understand. Do must I make global variables? And after that how can I fill your conditions?

You fill them with actions corresponding to the event. Just like you fill on_mouse_click now.

For a simple example:
Code: ags

     else if (!mouse_down && was_mouse_down)
     {
         // user just released the button
         // call room interaction (walking, using objects, etc)
         Room.ProcessClick(mouse.x, mouse.y);
     }


If there are more problems with this code, I suggest discussing this in the "Technical help" forum, as this is mostly a scripting question.


eri0o

#35
I just added a minor FAQ on the first post. I surely would like to automate things a bit more but I am afraid Google may change some things just too fast. I haven't yet figured the signing problem (I just blew up my install and started from scratch and it's working, so I could not reproduce it yet), if someone else hit it too, please let me know.

I also haven't yet figured what to do about the icons. This icons.zip has how they look like. I am thinking of simply asking for a directory in the project called AndroidIcons with the contents of this zip prepared for your game. Not sure on this yet. If anyone has any ideas, please share.

Mehrdad

@eri0o
I tested again with openGL and "Fill whole screen" mode. I had same problem again. It improve after a refresh screen like pressing the back button or on/off screen and so on 

Does anyone have this problem?
My official site: http://www.pershaland.ir/

eri0o

Hey Mehrdad. I don't have that issue on my phones so far. I tried a few ideas but could not reproduce. In the back button, the keys entry, one of them is Ctrl+V, if you hit it, it should load a display with some information. Can you capture a screenshot of that when you have that problem? Or does it "clean" the screen as soon as you hit back button?

Mehrdad

 It "clean" the screen as soon as you hit back button or others. So I can't capture the screen   (wtf)
My official site: http://www.pershaland.ir/

Crimson Wizard

#39
I'm testing this Android building now. After setting up ANDROID_HOME and JAVA_HOME, I'm getting following error in the command window:

Hide: ShowHide

Quote
FAILURE: Build failed with an exception.

* Where:
Build file 'D:\Dev\ags-games\ags-camdemo\Compiled\Android\mygame\app\build.gradl
e' line: 31

* What went wrong:
A problem occurred evaluating project ':app'.
> path may not be null or empty string. path=''


What is this "path" variable refering to, do I need to also set it?
EDIT: Oh, looking at the code, this is keyStoreProperties not set. I wish there was some kind of error message thrown with more details.

UPDATE 1: I hate Android Studio because it looks strange and I cannot find anything it its menus.
So ended up generating keystore from command line following instructions:
https://stackoverflow.com/questions/3997748/how-can-i-create-a-keystore

UPDATE 2: next problem:

Hide: ShowHide

Quote
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.

> Failed to install the following Android SDK packages as some licences have not
been accepted.
     patcher;v4 SDK Patch Applier v4
     emulator Android Emulator
     build-tools;30.0.3 Android SDK Build-Tools 30.0.3
     platform-tools Android SDK Platform-Tools
     platforms;android-29 Android SDK Platform 29
     tools Android SDK Tools
  To build this project, accept the SDK license agreements and install the missi
ng components using the Android Studio SDK Manager.

So, there are missing components, but I have two questions:
- why is emulator required to build the game?
- is the SDK platform version a variable somewhere, or this is hardcoded, and we must use exactly that version?

SMF spam blocked by CleanTalk