Skip to content
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

Is possible develop app using full command line, no android studio on linux? #20

Open
kitech opened this issue Sep 7, 2019 · 10 comments
Assignees

Comments

@kitech
Copy link

kitech commented Sep 7, 2019

android studio is so heavy

Be nice if there are some document about command line.

@Maddimax
Copy link
Contributor

Maddimax commented Sep 9, 2019

Hi,

You can run builds on the command line if you have android studio installed ( no need to open it here ).

./boden build -p android -t bodendemo

This will build the bodendemo app without launching Android Studio. You can run the app in an emulator:

./boden run -p android -c Debug -t bodendemo

There is no direct command to debug the application though yet.

We are planning to improve/add documention for the build tool in the future.

@mcraveiro
Copy link
Contributor

Hi @Maddimax,

Thanks very much for a very useful tool. Further to your answer to @kitech, is it also possible to have a more "native" workflow using CMake and Ninja directly rather than the boden tool? I ask because I am going to try to compile a hello world over the next couple of days that uses my "more traditional" c++ workflow (e.g. emacs, vcpkg, LSP-mode, etc). Let me know if there are any showstoppers with this idea :-) I will try to also report back on the experiences in case anyone else is interested in it.

Many thanks for your time.

@Maddimax
Copy link
Contributor

Hi @mcraveiro,

Yes its possible to use plain cmake.

If you run the boden tool with the debug output ( -d ), it will print out the cmake arguments it uses to switch between android / ios etc.

./boden prepare -p ios -b make -c Release -d would show you that the cmake arguments are:

'-DIOS_PLATFORM=SIMULATOR64', '-DCMAKE_TOOLCHAIN_FILE=/Users/mtillmanns/projects/ash/boden/cmake/toolchains/ios.make.toolchain.cmake', '-DCMAKE_BUILD_TYPE=Release', '-A std'

There are some limitations though:

  • The android make buildsystem currently does not create the .apk, you need to use the boden tool to generate and build android studio projects for that.
  • iOS codesigning needs to be done manually

so the easier way would still be to just call the ./boden tool from your ide of choice.

@Maddimax Maddimax self-assigned this Sep 13, 2019
@mcraveiro
Copy link
Contributor

mcraveiro commented Sep 13, 2019

Thanks for the very prompt response @Maddimax, and excellent news! As I am only targeting android and as I intend to do this as a learning exercise, I will try to do it the hard way. Even if I end up using the tool and the IDE in the end, hopefully this will give me a better understanding of what is going on underneath the covers. Out of (morbid) curiosity, with regards to:

The android make buildsystem currently does not create the .apk, you need to use the boden tool to generate and build android studio projects for that.

Do you think this will change in the future, or is this just something to do with the APK format itself? It looks rather complicated [1].

[1] https://en.wikipedia.org/wiki/Android_application_package

@Maddimax
Copy link
Contributor

Maddimax commented Sep 13, 2019

Generating .apks using make is on our Todo list, but not with a high priority at the moment. Its not just generating the apk package, but also implementing all the dependency mechanisms and java compilation that gradle does for you. I'm afraid it will be some time before we get around to doing this.

@mcraveiro
Copy link
Contributor

Wow, that would be awesome, whenever that happens! I'm sure you get a lot of non-requested feedback so I'll try not to spam you too much :-) but let me describe where I am coming from and why I think Boden is really cool - I suspect there are more devs like me. I'd like to get into the whole "mobile" thing, but I don't really have the spare time to play around with kotlin, gradle, etc etc. Its just too much to pick up given the available time. Also, given I am an "old hand" at programming, I profoundly hate doing things without really understanding what I am doing, which makes learning large new stacks impracticable in the little spare time I have. So what would really fit the bill is something that takes advantage of the stuff I am already familiar with (such as ninja, cmake, etc) and adds just a little bit of complexity such that I can still pick it up in my spare time. This is why for me Boden fits perfectly. Anyways, my 2 cents :-) Thanks.

@Maddimax
Copy link
Contributor

We are happy about any and all feedback! Hope you'll enjoy Boden, please don't hesitate to let us know what we can improve.

@mcraveiro
Copy link
Contributor

mcraveiro commented Oct 3, 2019

For anyone reading this ticket, and wanting to setup a "really" native environment, here's a SO question [1] on how to build an APK manually. It also has a C++ project demonstrating it [2]. I am still playing around with it so not entirely sure how good/complete it is, but it may be a useful pointer.

See also the keesj fork, with more work on it using the Guardian project tooling [3].

[1] https://stackoverflow.com/questions/39091845/create-android-apk-manually-via-command-line-makefile
[2] https://github.com/skanti/Android-Manual-Build-Command-Line
[3] https://github.com/keesj/AndroidMakefile/commits/master

@mcraveiro
Copy link
Contributor

@Maddimax are there any documents explaining how boden "binds" to java, by any chance? I mean, I just about got my head around the whole Native Activity and android_native_app_glue.h kind of stuff, but to the untrained eye it appears boden does not use any of that. Basically, I'm trying to figure out how the entry point Java_io_boden_android_NativeInit_nativeLaunch gets called by java. If its too complicated don't worry :-) I'll keep banging my head around the wall until this makes sense...

@mcraveiro
Copy link
Contributor

Ah, I think I get it, its NativeInit.java and NativeRootActivity.java! OK, I think I'm understanding this now. So if I got this right, I should be able to create a jar with all of the boden java code, then bundle the jar plus all of the c++ together into an APK plus the manifest and if I got all of the incantations right, the java code should then call the C++ code. I'll give that a spin... I'll do a full write up when I'm done :-) all interesting stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants