-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial build for Android Studio #5991
Conversation
This is a very basic setup of Android Studio build with many unsolved issues such as: - release build requires signing - the path in internal storage is org.libsdl.app - source code of SDL2 and SDL2 mixer must be put under `android/app/jni` directory - source code of fheroes2 directory subfolders must be put under `android/app/jni/src` and we shouldn't do this - settings for the application are not set - midi music does not work and etc and etc However, you can build a debug version and run it on an Android device. I do not have one so I tested on an emulator. All comments and recommendations are welcome as I have limited knowledge in Android development but we need to make such step to move forward.
Hi @oleg-derevenetz , I would say that this is more work in progress pull request rather than a ready for production solution so I am asking your help in this pull request if you have expertise in this area. |
Hi @zenseii , could you please try this solution on your machine to see if you are able to compile it? |
Hi, @ihhub! What should the name of the EDIT: |
Hi @ihhub. EDIT: I am indeed building on Windows but I believe you were too, @ihhub? |
I'm afraid I don't have much expertise in this area, because I developed only small apps for Android just for fun about two years ago (without using SDL), and I can't say that it gave me a lot of fun :) But of course, if I can help in any way, I will try to help. |
Hi @ihhub
What you really need is to make your own app package with name, say, |
Hi @zenseii , to solve this issue please try to put the project under a short path directory like D:\1 and then compile it. @oleg-derevenetz , this is a good idea and I will try to do it. |
This can be done by, say, copying the contents of SDL archive to, say, |
Hi @ihhub you can try to use pre-built Android package from this PR's artifacts: fheroes2/fheroes2-prebuilt-deps#17 Remove all extra files, download the |
Hi @oleg-derevenetz , sure. I will do it within today. |
Hi @ihhub
I changed the layout to make it more "canonical":
So now this archive should be extracted to
It would be good to move these JNI deps from |
Hi @oleg-derevenetz , so far no luck. What I did:
|
@oleg-derevenetz , after lengthy compilation I still receive the same errors. Looks like we need to add these files: |
Hi @ihhub OMG, the manifest file. Try to add some minimal manifest file to the |
It should contain BOTH |
This I did :) |
@ihhub Try to add the following
or maybe even
|
did the magic. |
@ihhub Yeah, I forgot that even a library still requires the some minimal manifest. I'll add something to the prebuilt package. |
@ihhub Does the sound work now? |
Despite of fact to have a successful build the application fails to startup:
I suspect that we still need to add a Java class which you mentioned before. |
Yes, it seems so :) Try to add package fheroes2.org;
import org.libsdl.app.SDLActivity;
public class MainActivity extends SDLActivity
{
} And replace |
with changes needed within app leads to |
@ihhub Try to add the following to the
|
|
Hi @ihhub Did you add this dependency to the |
Oops, no, I didn't. My apologies. After changing it this errors occurs:
So to fix this I changed
I am not sure that the last change is necessary. And now it works! |
@ihhub NDK on Does the sound work? |
Hi @oleg-derevenetz , the sound works as well as external music but no MIDI. I will make changes into this pull request. |
Interesting, because SDL_mixer is built with the Tmidity library. Maybe Timidity needs some additional files? P.S. Try to comment out the |
Ah, there are also additional files needed for Timidity: https://github.com/libsdl-org/SDL_mixer/blob/main/README.txt I have no idea where they should be placed on Android. |
Let's fix MIDI issue in a separate pull request. I found more issues with it and it's easier to track all of them separately. |
Hi @oleg-derevenetz , could you please add manifest file to artifacts? |
Hi @ihhub
Done. |
Hi @ihhub I performed the minor cleanup, made the build parallel ( |
Hi @ihhub, I have built this branch on my Linux machine and everything went well! :) I wanted to upload this project on an android device to ensure that it was correctly working and the app managed to boot up without any issues! The only thing left for me to do is upload the required files to start the game on my android device. I'm not sure to know where I should upload them so that the android app could see them. I know that savefile and config are currently stored in: /data/data/org.fheroes2/files |
Hi @felix642 , we are solving this in Discord :) |
Hi @oleg-derevenetz , thank for the changes! Do you have anything else to update in this pull request? If not we can proceed with merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ihhub I have no new ideas so far :)
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@oleg-derevenetz , thanks a lot for helping me with this pull request! |
This is a very basic setup of Android Studio build with many unsolved issues such as:
android/app/jni
directoryandroid/app/jni/src
(we shouldn't do this but for POC it is that this way)However, you can build a debug version and run it on an Android device. I do not have one so I tested on an emulator using Android Studio on Windows.
All comments and recommendations are welcome as I have limited knowledge in Android development but we need to make such step to move forward.
Thing to be done in this PR: