Live data from Hacker News

Rawdrawandroid – Build Android apps without any Java, in C and Make

github.com

111–120 of 157 posts

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#111
post #87
post #71

to be clear, this is only really useful for applications that present their ui through opengl and do not interact with the rest of the android system very much. the ndk is meant for writing little bits of c to speed things up in a classic java android application. this is a pretty cool hack that allows for opengl apps to be written in straight c that run full screen and have limited access to things like keyboards, a…

To be fair this is the way to not be platform dependent and more people should pursue it. I'm doing a desktop app meant to be as cross compatible as possible and the only reasonable way to do it (without sending yourself into build config hell) is with opengl.

How do you make it accessible?

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#112
post #92

Earlier quoted context omitted.

Maven (and pretty much every other build tool with the exception of bazel) is not capable enough for such a complex build as is required for android, though. E.g. maven can often “lose” that something requires a rebuild, and only clean build will produce the correct artifacts. Gradle can always keeps track of tasks correctly.

Maven (and pretty much every other build tool with the exception of bazel) is not capable enough for such a complex build as is required for android, though. Maven is virtually infinite extensibility via plugins. The difference is that gradle is easier to "hack" and put the build logic in your configuration... > E.g. maven can often “lose” that something requires a rebuild, and only clean build will produce the corre…

> Maven is virtually infinite extensibility via plugins

Losing the only task of a build tool, caching and parallelization.

No, the problem is that maven doesn’t rebuild everything. It is actually quite common in code bases that I had to run clean build instead of build to actually recompile everything that changed. I guess maven just doesn’t have an accurate build graph?

> LOL, from my experience that is not true

In what way is it not true?

Also, gradle is demonstrably faster, especially on projects that can be parallelized. Obviously a hello world will be dominated by javac and build tool startup speed so it’s not relevant.

And multiple daemons — you can disable them, and they will go away if unused.

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#113

Earlier quoted context omitted.

>I'd love to see a way to build a Flutter app without Gradle. You generally don't need to touch gradle at all with flutter. Is your issue about having to install gradle onto your machine, even if you don't use it directly?

Yes, it’s mostly hidden, but it runs Gradle behind the scenes and that’s okay as long as nothing goes wrong. (I used to work on it, or at least tried to before giving up in frustration.)

>I used to work on it, or at least tried to before giving up in frustration.

Out of interest, what blockers did you encounter using Flutter? For me it was much better than native android in terms of development, but it could depend on the usecase.

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#114
post #112

Earlier quoted context omitted.

Maven (and pretty much every other build tool with the exception of bazel) is not capable enough for such a complex build as is required for android, though. Maven is virtually infinite extensibility via plugins. The difference is that gradle is easier to "hack" and put the build logic in your configuration... > E.g. maven can often “lose” that something requires a rebuild, and only clean build will produce the corre…

> Maven is virtually infinite extensibility via plugins Losing the only task of a build tool, caching and parallelization. No, the problem is that maven doesn’t rebuild everything. It is actually quite common in code bases that I had to run clean build instead of build to actually recompile everything that changed. I guess maven just doesn’t have an accurate build graph? > LOL, from my experience that is not true In…

> Losing the only task of a build tool, caching and parallelization.

You are aware that Maven does offer paralle build, right?

> I guess maven just doesn’t have an accurate build graph?

You guess wrong? then

>> LOL, from my experience that is not true

> In what way is it not true?

Consistency of gradle build. You yourself stated just a paragraph above that sometimes you have to run "clean" xD

> Also, gradle is demonstrably faster, especially on projects that can be parallelized. Obviously a hello world will be dominated by javac and build tool startup speed so it’s not relevant.

Again, learn the tool. Maven does offer parallel builds and is comparably fast…

> And multiple daemons — you can disable them, and they will go away if unused.

"but you are turning off the only feature of a build!!!"

Also - I had a setup open with gradle/kotlin-multiplatform project (shell with "gradlew" and Android Studio) and magically it fails to build with "Unresolved reference: kotlinx" even though I haven't done anything to the project and no ammount of running "gradlew clean" solves it... what a lovely tool....

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#115
post #50

Earlier quoted context omitted.

> It would be silly to write low-level software in Java Depends on what kind of low-level stuff.

No, it doesn't. Java is a piece of crap with JVMs imposing an 8-24 byte overhead per object, which destroys caching, memory footprint, and any chance of low-level optimization. Not only is the overhead bad, it's implementation-dependent, i.e. unpredictable. That, along with lacking SIMD, imposing stupid decisions like bounds checks on all array accesses, making arrays boxed (int[] is not an array of ints, sorry), or…

> JVMs imposing an 8-24 byte overhead per object

You want project Valhalla, or more specifically Value Objects, which are in preview [0]. If you really want the highest performance related to cache accesses, you want to arrange things as SoA (struct of arrays) anyway, which has approx 0 object overhead and doesn't require Value Objects.

> Not only is the overhead bad, it's implementation-dependent, i.e. unpredictable.

This is silly. This happens with all other languages, and Java will give you better results on average. Use a different compiler or runtime for your C code, or run it on a different processor architecture, and have fun tuning your code.

> That, along with lacking SIMD

The Vector API [1] is available in preview.

> imposing stupid decisions like bounds checks on all array accesses

It's widely understood that doing the opposite has been perhaps one of the largest mistakes in the history of the industry. JITs elide access checks when safe, and it's easier for them to do with high performance code that doesn't bounce around in memory and thrash cache.

> making arrays boxed (int[] is not an array of ints, sorry)

What does this even mean? An int[] is a linear array of 32-bit int values in memory.

> or using exceptions for control flow, which is the wrong way to use exceptions

Are we now just talking about a small slice of people who write bad code?

> is a just part of the big laundry list of why Java is a piece of obsolete crap

Ah, ok. Have a fine day.

0) https://openjdk.org/jeps/401

1) https://openjdk.org/jeps/460

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#116
C is neat but something like python may be simpler to work with for most programmers. I wonder if anyone here has experience with Kivy and KivyMD libraries for python.

The code is simple and self explanatory.

class RectangleFlatButton(TouchRippleBehavior, Button): primary_color = get_color_from_hex("#EB8933")

    def on_touch_down(self, touch):
        collide_point = self.collide_point(touch.x, touch.y)
        if collide_point:
            touch.grab(self)
            self.ripple_show(touch)
            return True
        return False

    def on_touch_up(self, touch):
        if touch.grab_current is self:
            touch.ungrab(self)
            self.ripple_fade()
            return True
        return False

class MainApp(App): def build(self): screen = Builder.load_string(KV) screen.add_widget( RectangleFlatButton( text="Hello, World", pos_hint={"center_x": 0.5, "center_y": 0.5}, size_hint=(None, None), size=(dp(110), dp(35)), ripple_color=(0.8, 0.8, 0.8, 0.5), ) ) return screen

MainApp().run()

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#117

"I can do anything I want. It's just bits. You don't own me." Fair enough! x-D

"This is computer science. There aren't restrictions." - It's literally what many people forget when they let themselves constraint by frameworks and claim this and that isn't possible. Very refreshing to see how liberating it is if you go one level deeper.

"We can cause any problem by introducing an extra level of indirection." ;)

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#118

C is neat but something like python may be simpler to work with for most programmers. I wonder if anyone here has experience with Kivy and KivyMD libraries for python. The code is simple and self explanatory. class RectangleFlatButton(TouchRippleBehavior, Button): primary_color = get_color_from_hex("#EB8933") def on_touch_down(self, touch): collide_point = self.collide_point(touch.x, touch.y) if collide_point: touch.…

I built a simple kivy app a few years. Working with kivy and testing on my (linux) dev machine was great. Even side loading to test on my phone using the kivy launcher wasn't too bad. The pain point was that building APKs that the play store would accept was an ordeal and then when they change requirements you have to hope the kivy folks update their build tools in time to recompile with a new version of the NDK before google delists your app.

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#119
post #45
post #5

Earlier quoted context omitted.

I can tolerate Java and Kotlin, but the tooling is just awful *. I've stopped counting how many times I came back to an Android project after only a few months, only to have Android Studio force me to update Gradle and dependencies and whatnot, and break everything. * Of course one could blame me for not learning the ins and outs of the build system!

> I've stopped counting how many times I came back to an Android project after only a few months, only to have Android Studio force me to update Gradle and dependencies and whatnot, and break everything. This used to be 5-6 years back. These days it is very stable.

No, it's not. This year I still had to upgrade all my projects (I do this yearly) and they still broke in a myriad of different ways. Most of them fortunately and perhaps ironically the solution was one Google search away.

I actually _like_ Java, so it's not that I hate Android, but frankly, I have no idea what it is even doing downloading and generating gigabytes of crap with inscrutable huge log files. Most of my applications' Java/GUI parts are no more complex than a hello world -- many times I find it easier to just rewrite them from scratch than even try "upgrading" them using Android Studio.

The Android tooling is basically a textbook definition of oversized enterprisey software. I really wish there was just a frigging (resource) compiler, linker and maybe packer that I could invoke from the command line in simple steps.

Re: Rawdrawandroid – Build Android apps without any Java, in C and Make

#120

Looks like you still have to start by installing Android Studio, which seems excessive. Is there a way to just download an Android SDK? Looking briefly at the makefile, I think they might have avoided Gradle, though it calls other tools written in Java. I'd love to see a way to build a Flutter app without Gradle.

> Is there a way to just download an Android SDK?

Yes, you can just grab the zip files. For example like this: https://www.hanshq.net/command-line-android.html#sdk

Post reply on HN