Let's build for Android!

Started by eri0o, Mon 08/01/2018 00:35:15

Previous topic - Next topic

eri0o

Ah, thanks CW! That makes it easier! :)

Amir

I did what u said eri0o and finally no red errors, I was able to create an APK file (app-debug.apk I haven't named it yet) I tried it with android 9 and 10, black screen and keeps crashing. I started everything from scratch because I did a lot of experiments with the old project but the same result, the app chrashes.

Could it be because the game's files were created by AGS 3.4.3? or because of the gradle version that I changed to 7?
Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

eri0o

#62
Could just start from scratch, it should be


  • get source code
  • put libraries in the specified directory
  • put the game files in the asset directory

Click play -> it should run on your phone.

Which directory did you put the game files? As I mentioned in the README, for local testing through the IDE it has to be in mygame/app/src/main/assets directory.

Only after you get working there, after everything in the project is changed to have your game name and icons and you confirm it's really working, then use the other directory, because using the other directory, which is the right one for Google Play, and will require an external tool for local testing - unfortunately right now the bundletool is not integrated in Android Studio, so bundles generated by Android Studio can't be easily tested using only it's graphical interface, I expect it will be integrated in the future.

more details in Android/mygame/README.md

If the game files are in the right directory and it's still crashing, can you give a list of the name of the files placed in the directory?

Crimson Wizard

Quote from: Amir on Wed 15/09/2021 13:19:59
Could it be because the game's files were created by AGS 3.4.3?

3.6.0 engine should be capable of running 3.4.3 games.

This may be tested by placing acwin.exe from the 3.6.0 Editor download at your game's Compiled/Data folder and running that acwin.exe.

Does it display any error at the crash?

Amir

I just tried that.


but I can build my game with AGS 3.6.0 if that is the reason that the app dosn't work. As I said, The files in the Data folder, that I use in Android Studio were created by AGS 3.4.3

@eri0o I showed everything important in the video. And it dosn't run on my phone after "Play", it crashes again. What do u think where the problem is?
the file android.cfg was already there in assets

Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

eri0o

#65
Just to confirm, you are using this tablet here:

https://www.samsung.com/us/business/support/owners/product/galaxy-tab-a-7-0-wi-fi/

?

I have no idea why it would crash, can you attach the generated APK somewhere so I could look? From the video I can't readily identify anything - except I would start a new project without the gradle upgrade, I would use the project as it comes from the AGS repository.

Also does the crash has any message at all?
Is it happening at install time or runtime, after installing?

I also noticed you already renamed parts of the app, but from the video I can't tell if you renamed every part. It would be best to start again with the project like it comes from the AGS repository.

When using Artic Fox and newer versions of Android Studio it's not needed to rename all that stuff anymore, in old android studio it was required to match the Java package and the app package name. This is not needed anymore, I will add a brief paragraph in the README to explain this - I just need to check but I think now you just need to say the package name in the manifest and it will all workout.

Amir

Yes, or it's called exactly Galaxy Tab A (2016) but I've tried 2 other phones too.

Weird  :-\
Ok, I'll send you a message with a link.

no special message "app has ended"
runtime, after installing
Yes by hitting the green play button.


Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

eri0o

#67
Thanks, just send me through a PM here and I will look.

My guess is the renaming was not done fully, like if the Android Manifest was not updated to point to the Java package name after you renamed




But all the refactoring and all those steps of renaming can be skipped in the newer version of Android Studio, I just need to recheck, but I was working towards making just setting in one place (which would be here) , I need to do a recheck to see if it's all good. When I started Google hadn't shipped yet Artic Fox, so I couldn't verify.

The relevant change is mentioned here:
http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename

And then the project.properties file applies here: https://github.com/adventuregamestudio/ags/blob/master/Android/mygame/app/build.gradle#L19

I need to recheck this though because it was all very confusing. But the general idea is to avoid any text renaming beyond the basic local.static.properties and project.properties files, which can be generated by any text/ini writer and could be integrated in the Editor build process eventually.

(for now mygame/app/src/main/res/values/project.xml is also needed, but the idea to eventually move the string there to one of the properties file above)




@Amir, on you manifest it's still referencing the un-renamed java package com.mystudioname.mygamename.MainActivity but on your video, this java package is renamed for your game already.

I picked up your game and put inside an empty project just to be safe and build and run and it worked here

Spoiler
[close]

Crimson Wizard

Quote from: Amir on Wed 15/09/2021 16:50:03
I just tried that.


Yes, 3.6.0 requires SDL2.dll to work. It also has to be copied there.

Amir

Aha I see. What should I do now? Should I add this: applicationId "com.studio.myappname" ? Or should I wait until you create a new repository?
Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

Amir

QuoteYes, 3.6.0 requires SDL2.dll to work. It also has to be copied there.

Yes, it works now  :) but unfortunately that doesn't help with creating a working app in Android Studio.
Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

eri0o

#71
I don't know what was changed and what was not changed, I would try to start from scratch. Don't rename anything, get it working first, after it's working do any change you want.

(When a debug apk is made on Android Studio it builds for your device, because it's all that is needed when debugging locally, unfortunately my Android devices don't match your architecture, so I can't run the apk you sent to read the error messages on the logcat tab)

Amir

#72
(misunderstanding)
Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

eri0o

Download the project in a new folder, place the libraries in the directory, place the game files in the asset directory and hit play. Do not rename anything until you see the game launch on the device.

Amir

I misunderstood you. Ok I will try that.
Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

Amir

#75
(yesterday before I renamed I hit play) I got the error message:
AGSNative
Loading game failed with error: Main game file not found or could not be opened. Filname: ac2game.dta..
The game files may be incomplete, corrupt or from unsupported version of AGS.

Today I tried the app but without Android Studio and it worked but too slowly and then I wanted to try to quit the game and then continue playing I quitted the game then I got the same error "AGSNative....." I have to restart the device so that it works again.

What is ac2game.dta? 

Edit: I'm trying right now again on another device.
Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

Crimson Wizard

#76
Quote from: Amir on Thu 16/09/2021 17:21:28
(yesterday before I renamed I hit play) I got the error message:
AGSNative
Loading game failed with error: Main game file not found or could not be opened. Filname: ac2game.dta..
The game files may be incomplete, corrupt or from unsupported version of AGS.

What is ac2game.dta? 

ac2game.dta is an internal game file generated by AGS Editor, it contains basic game settings.

This error message is usually an indication that either the game is not packaged correctly, or its got corrupted somehow.
But since you are working with APK on Android, this may also mean that engine cannot read APK / AAB contents properly.

Which native libraries are you using in the end? Older engine version did not support reading game files from Android packages, which may be a cause of this error (theoretically).

Amir

Ah ok.

I'm using the libraries from AGS-3.6.0.8. without these libraries I get a lot of errors.
But you r right Crimson Wizard now I know why, while building I got a message:
your antivirus program might be impacting your build performance. Android Studio checked the following directories:.....
I excluded those directories in my Windows Security and now it works.

But the game looks awful. It wont rotate it stays vertical on the device, so small and pixelated and it runs very slow and the short sounds are not complete, u only hear half of them.
@eri0o U have the APK file u can see that. It runs by AGS engine Android port a thousand times better I haven't had those problems as far as I can remember even though Im using the same device.

(I haven't created a package yet I mean the steps move and rename)

It would be helpful if someone else tried it with Android Studio and confirmed my problems.
Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

Crimson Wizard

Quote from: Amir on Thu 16/09/2021 19:29:04
But the game looks awful. It wont rotate it stays vertical on the device, so small and pixelated and it runs very slow and the short sounds are not complete, u only hear half of them.
@eri0o U have the APK file u can see that. It runs by AGS engine Android port a thousand times better I haven't had those problems as far as I can remember even though Im using the same device.

To clarify, when you say "it runs by engine Android port better", do you mean the universal game launcher? Because it's all the Android engine port inside. So the differences may be either in the engine's version (3.4.*? vs 3.6.0) or some settings applied to the created APK.

I'd suggest to separate problems and make a list of them, as some may be a problem in 3.6.0 engine itself, others related to the new Android port, and so on.

For example, in regards to the short sounds, I'd very much recommend checking that out with the Windows version. In general it's best to try a desktop (Windows/Linux) engine to see which of the problems persist there.

Amir

Ok,I will check it out again for security with engine Android port and also with version 3.6.0. I always wanted to try AGS 3.6.0 and have postponed it. Now its time.

Quoteit runs by engine Android port better", do you mean the universal game launcher?

Im not sure what is the universal game launcher but I mean I could rotate it to be horizontal fully on the screen therefore clean and large and much faster. Sound was bad. As if someone had knocked on the door in between, it sounded like that. But as I said, I will check it out again.

Truly, truly, I say to you, blessed are those who play adventure games, for theirs is the kingdom of heaven.

SMF spam blocked by CleanTalk