[MERGED] Android Build in the Editor

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

Previous topic - Next topic

eri0o

#40
🔐 Keystore

I can put a menu for creating the keystore, but I have no idea where to put such menu.

About the error message, I thought I had put a check for that but apparently it didn't got committed somehow. I am going to fail the build earlier if the keystore settings are empty/invalid.

Edit: there's now a Generate Keystore button in preferences to load the keystore generation dialog.




â˜'️ Requirements

About the requirements, it's:

- SDK is needed for the Android API that is accessible through Java or Native. We will always need it. It matches the compile API target. This one changes at least once per year because of Google Play policies.

- Build Tools are the tools for building. Ideally we always want these to be the latest as possible. They are not dependant of the target you are building or the SDK. The emulator it comes is probably some interface, but it doesn't download any images. We will always need it. We can change this only if there's a bug building newer SDKs.

- NDK may be needed too. We are not directly using it to build C++, but some minification of native code apparently needs it. Theoretically it should be possible to build the runtime library project to a jar and then depend of this jar elsewhere, but I could not figure out a sane way to do this (without needing to push this as a package in Maven). I don't want to pursue eliminating this now and going the jar approach. NDK is similar do build tools in being independent of target version. I also may be wrong here and we don't depend on NDK already.

These versions are all anotated in the Gradle build scripts. The Editor requests and install them.

The current minimal target is set to 29 because of SDL2 version we are using. For Play Store this needs to be 31 minimum. This requires some minor updates in the manifests which I plan to do later. See  https://developer.android.com/distribute/play-policies

I know how to ask for installation and it should ask for installation, but if it asks about license approval I could not figure out how to not use Android Studio for accepting the licenses.

Crimson Wizard

Is it possible to post a list of components that I have to check and install in the SDK Manager? Because I tried installing the ones from error message, was not able to find all of them in the list, and even after i installed some of them it kept reporting same missing components again.

eri0o

On the top post there's a FAQ, in the first entry I mentioned the SDK, it's a bit weird, but I need to have something installed to get the sdkmanager. Once the sdkmanager is in place I can use it to install other things.

It does come with a little yes script that can be used to accept following licenses, perhaps I could use and assume that everyone trying to use agrees with the licenses - just need to check the script works on Windows.

Anyway, AGS Editor above should try to install things after a sdkmanager is installed, if it's not doing that, it's a bug.

Crimson Wizard

#43
Right now I have following installed (checked in the SDK manager):

SDK Platforms:
* Android 11 (api level 30)
* Android 10 (api level 29)

SDK Tools:
* Android SDK build tools: 32.0.0, 30.0.3, 29.0.3
* NDK (side by side): 22.0... , 21.3...
* Android command line tools 6.0
* Android emulator 30.3.5
* Android SDK platform tools 30.0.5


May someone else say what do they have?

May the problem be that I set wrong path to ANDROID_HOME? Do I need to set it to the Android Studio root folder, or to one of the subfolders?

eri0o

#44
ANDROID_HOME is set to the SDK path (should be a dir named Sdk, see first post!)

JAVA_HOME should be the path to JDK, which is confusingly a directory that ends in jre (but it's not JRE!), and this one is on the Android Studio directory (again, see first post)

Question: which Android Studio you have?

I can try to come up with some heuristics to try to search and find out both above, so I can automatically fill ANDROID_HOME and JAVA_HOME but I don't know at which point I should run this.

Crimson Wizard

#45
Ok, sorry, I made a mistake. There apparently have been some older version of SDK from couple of years ago, which I thought is current one.
The directory in "...\AppData\Local\Android\Sdk" was practically empty with only 1 file inside.

I fully deleted Android Studio and SDK from my system to be certain, and resintalled again using most recent version, and double checked the new paths. Now the building is running (still waiting for result while I type this).

UPDATE: it completed successfully now, and there's app-mygame-release.apk.
Maybe a silly question, but should not it use game's name? or I missed another instruction?

eri0o

#46
You forgot to set the package name of your game in the general settings! If you did and still got that, it's a bug! :)

Edit: adjusted to get clearer error messages on wrong/missing config of ANDROID_HOME, JAVA_HOME and Keystore path. Also I had forgotten to set the app name you see when browsing apps and now it should correctly pick your game name you already use in game windows. Updated the file links on the first post.

Mehrdad

#47
@eri0o

Thanks for updates. Please integrate unicode last version (by CW) too. I tested it and the result was correct for showing symbols on Android.

@Crimson Wizard

Did you test it on the device too? If yes, Do you have my problem too?
My official site: http://www.pershaland.com/

Crimson Wizard

#48
Quote from: Mehrdad on Wed 16/02/2022 06:02:30Please integrate unicode last version (by CW) too.

Please note that we cannot integrate it with the official Android port yet, as unicode feature is not ready; I'm planning to work on it properly soon. We may only post a test version which merges unicode with Android, but it will not be guaranteed to be final, and should be used to create actual game releases.
Currently you may use the existing method of putting unicode in game - using the translations.

eri0o

I am working on a keystore generation GUI... It will be a little while before everything is rightly working but...

Spoiler
[close]

Joseph DiPerla

Wow nice! This is shaping up to be a great Android Development tool.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Mehrdad

Quote from: Crimson Wizard on Wed 16/02/2022 08:46:02

Please note that we cannot integrate it with the official Android port yet, as unicode feature is not ready; I'm planning to work on it properly soon. We may only post a test version which merges unicode with Android, but it will not be guaranteed to be final, and should be used to create actual game releases.
Currently you may use the existing method of putting unicode in game - using the translations.


OK. Sure. Thanks for your hardworks


@eri0o

Create keystore is so fantastic. Great feature!. Nice job!
My official site: http://www.pershaland.com/

eri0o

#52
Finally managed to add the Keystore Generation in the Editor.

I updated the links on the first post. Now in the Editor Preferences, there is a new Tab called Android!

In this tab, you can set JDK path, SDK path, and keystore information. If JDK and SDK are set correctly, test should indicate that they are found.

There is also now a button Generate Keystore where you can write your keystore information and generate one. After it's sucessfully generated, if you click OK, it will fill your preferences settings with this information, if you click cancel, then nothing happens. After you also click OK in the Preferences, settings are applied and  new builds will use the newly set keystore. I tested a bunch, but if you find something wrong, please report.

Edit: did a few improvements on this pane, updated to v4.

I think the only part missing now is getting the icons in place, once that is done, the building part should be alright and then once any merging issues are fixed I will look into touch input details. Probably in a new thread...

Edit2: finally got icons working! Updated it to v5

Now I only expect bug fixing in this. The features I meant to have at this time with Android Building are all there.

Edit3: renamed Package Name to App ID, in v6. This is to match more recent android documentation that now uses Application ID when referring to it.

I also updated the screenshots and text in the first post.

Edit4: Ok, updated it to v7, now it only keeps the cmd.exe screen if the build fails for some reason. Successful builds will automatically close and report the build success.

Edit5: disabled Gradle daemon by default, but added an option to turn it back on. I highly recommend turning it on, specially if you intend to build to android lots of times. Version is now v8

@Mehrdad, have you ACTUALLY tested with Software mode? Can you confirm by using the setting and confirming with Ctrl+v that you have the same graphical glitch with both Software and OGL renderers? I can't reproduce, but I am trying to figure out what could be the case - haven't actually figured nothing yet...

eri0o

#53
v9, probably final revision. Makes the app not require any permission at all since all the game is inside the app and assets packaged in the game itself, there's no need to external disk access.


Mehrdad

@eri0o
Android Build: ANDROID_HOME is not a valid SDK path. Can't find sdkmanager.

I hadn't this problem in previous builds. SDK path is correct
My official site: http://www.pershaland.com/

eri0o

What do you mean SDK path is correct? Which Android Studio version you are using? What's the used path? Where's your sdkmanager.bat?

Mehrdad

My SDK path is:  E:\Archive\Softwares\android-sdk-windows\android-sdk-windows
JDK: C:\Program Files\Android\Android Studio\jre

It was ok in previous versions and I got apk but I have this error now!
My official site: http://www.pershaland.com/

eri0o

#57
this is weird... Do you have a directory that looks like the one below? I need to figure out where is the sdkmanager.bat in your install.



Did you downloaded the android sdk by hand? If you can't find the sdkmanager.bat file above, do you remember the link of where you got it? (or if it's size is not too unwieldly, if it's possible to share it through some filesharing way...)

Mehrdad

#58
No I haven't this derectory.Yes, I downloaded the android sdk by hand.
I haven't sdkmanager.bat. I have SDK manager.exe in the same directory that I mentioned
My official site: http://www.pershaland.com/

eri0o

So sdkmanager.exe is at the root of that directory? Can you pass me a list of directories right in that directory? (maybe there's a cmdline-tools named directory there...)

Can you also tell me your Android Studio version?

SMF spam blocked by CleanTalk