[EXPERIMENTAL] Android Build in the Editor (v9)

Started by eri0o, 08 Feb 2022, 21:44

« previous - next »

Mehrdad

#60
Yes, it's in root directory






Android Studio 3.3.2
built on February 16, 2019
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
My official site: http://www.pershaland.ir/

eri0o

So this is an older version than the one I was prepared to support, this is before the version naming changes - newer is not 4, they've abandoned that version scheme for one that reflects year (of the base Intellij version or something), stable is 2021 for example.

To be honest the best thing I can think of is to avoid any error checking in ags side at build time and rely in gradle to do it's thing. But it's error reporting is often cryptical. So maybe an option to avoid sanity checking.

I am not sure yet on what to do and come up with something that works but not breaks for others. Supporting many android studios at the pace Google is updating things it's practically a full-time job, so going with only latest version of AS was the compromise I could keep up.

Mehrdad

#62
That error is in AGS editor and not when it make build.

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

Crimson Wizard

@Mehrdad, have you set an actual path to android sdk in the Preferences window?

Mehrdad

Quote from: Crimson Wizard on 27 Feb 2022, 06:09
@Mehrdad, have you set an actual path to android sdk in the Preferences window?


Yes, Actually I get apk before. It says this message in the new version
My official site: http://www.pershaland.ir/

eri0o

Sorry, just to explain, this sdkmanager.exe doesn't exist anymore, this was a previous sdkmanager that had even a graphical interface. In recent versions the sdkmanager is a Java library made of libraries under the cmdline-tools/lib or tools/lib, with an entry point file named sdkmanager.bat, that partially makes up the API. The actual files behind the sdkmanager changes between command line tools and the Android Studio command line tools.

I made everything accounting for the files and SDK installed by the latest Android Studio. The command line tools and Android Studio from Mehrdad are at least three years old... And the new versions are a bit different too, because they expect now that the user will place the directories in the right place manually. It's very tricky to assemble everything by hand, I really would prefer to not support that - I can seriously spend a lot of lines describing how to glue things together, but everything will be very brittle on each update...

Mehrdad

It's sad news for me. Google doesn't support  IP Iran at all and we can't access to last updates in Android Studio. The only way was manual SDK and so on that we could get it from our sites.
Anyway, updates don't work with VPN and VPS even and google knows them!!
Actually, I can't get apk anymore. If I found any way let you know.
My official site: http://www.pershaland.ir/

eri0o

for now you can create a directory named tools at the root of your android sdk, then create a directory named bin inside it and then an empty text file there called sdkmanager.bat and it will work. I am relying on sdkmanager to update/verify installation of things, so this will work as a temporary proxy. Recap, create an empty text file in ANDROID_HOME/tools/bin/sdkmanager.bat.

I am still thinking on what to do for a prettier way... My premise was to rely on current Android Studio and docs, older versions everything was very confusing... Now it's just... Confusing.

Mehrdad

#68
I had tools directory so i made "bin" and "sdkmanager.bat" : 
E:\Archive\Softwares\android-sdk-windows\android-sdk-windows\tools\bin

And the same message in AGS editor. Where is my wrong?
My official site: http://www.pershaland.ir/

eri0o

Did you actually placed the sdkmanager.bat inside the bin directory? If you did that and still get the error then show me a screenshot of your preferences tab in the Editor because there's some missing information.

Crimson Wizard

#70
@eri0o,
QuoteI am relying on sdkmanager to update/verify installation of things

May these steps be simply considered optional and skipped with a warning?
If Mehrdad had apk created earlier, does not that mean that the building itself worked? Perhaps if sdkmanager is not present, or there's another problem with it, you may simply issue a warning and try continue with building?

My guess is, there may be other potential problems there, e.g. if your script wants to install things, that requires internet connection, if I understand right. What if there's no internet connection.

Maybe it's even worth adding a user preference which tells whether perform this step, as user may want to not connect to the internet or download anything while building the game.

eri0o

#71
This is what I suggested above.

Quote from: eri0o on 26 Feb 2022, 18:15
To be honest the best thing I can think of is to avoid any error checking in ags side at build time and rely in gradle to do it's thing. But it's error reporting is often cryptical. So maybe an option to avoid sanity checking.

The suggested fake bat script though should bypass the checking as I mentioned, if that works than adding the suggested checks as mentioned.

But full offline build is not possible, at least once Gradle has to connect and download the Java dependencies. Only after that such offline build would be possible. So instead of going for an offline check (e.g. gradle --offline %TASK%), a separate check is needed for complying with no sdkmanager.

Currently it uses the sdkmanager location to verify that the SDK is in place. So what needs to be done is:

- add a preference option that disables sanity checking, this is easily doable.
- figure a way to not use sdkmanager to check that the SDK is in place and separate dependency installation in some way. (this is harder and may take a while)
- add another preference for turning --offline flag in gradle on with a warning that at least once it needs to be run without such option to cache dependencies (we depend currently on androidx.core). This is easy to do too.

Maybe there's some way to pack the dependencies in a jar with the runtime so instead of getting the runtime as Java files get it as a jar library, but I don't know yet how to do that, when I tried it only packed the compiled Java files and the AGS native library files, not the androidx dependencies.

Mehrdad

#72
Quote from: eri0o on 28 Feb 2022, 17:39
Did you actually placed the sdkmanager.bat inside the bin directory? If you did that and still get the error then show me a screenshot of your preferences tab in the Editor because there's some missing information.

Yes I did
My official site: http://www.pershaland.ir/

SMF spam blocked by CleanTalk