1. Are you ready for the Galaxy S20? Here is everything we know so far!

beginning with Android Studio and NDK issues

Discussion in 'Android Lounge' started by VooDooChicken, Aug 11, 2020.

  1. VooDooChicken

    VooDooChicken Lurker
    Thread Starter

    This post is more like venting rather than a particular issue, since there are many issues actually.

    Downloaded Android Studio and found out that it is now an integrated IDE; you don't have to download Eclipse and tweak things just to run a hello world, and in theory you could just write your hello world and start programming right away.

    Even though if you are using Android Studio is because you intend to program, and if you know how to program you probably know how to fiddle with things and may know how to set up a development environment, this does not consider people who begin programing, and assumes people who will develop for that platform already have experience, which gives a message for people who want to develop for that platform but have no experience. But as I was saying, they have simplified things by including an IDE and all the stuff in a single package with no previous requisites. It would be a good thing if it worked

    So I install the studio and I don't remember if I downloaded something or it was there as a default example, but when I try to run something like a hello world example, the 'run' option is disabled; there is another 'run' option with ... at the end (alt shift f10 on windows 10). When I click on it, it seems it runs not the loaded project but other projects in history; still not have been able to run anything though.

    I wanted to run things in something like an emulated phone. Watching the available options in the menu I don't see anything for that purpose. Browsing Internet I find there is the AVD manager available either from the tools menu or the toolbar button. In 'my' tools menu there is no AVD manager, but luckily, when I place the pointer over a button in the toolbar it shows a strip telling me that it is the AVD manager. whoopee! I found what I was looking for by being lucky while browsing, since the help in the tool does not actually explain how to use the tool, neither does it explain what AVD means and will not make sense to me unless I am searching for it

    So I download a few profiles; there is pixel 2, a nexus, a tablet, some other stuff, in total I download 5 profiles, each one weighting 2.5 gb except one that weights ~500 mb. That means over 10 gb in my hard drive dedicated to emulation profiles.

    In the AVD manager there is the option to launch a profile, or the emulation of a profile. For each one of the profiles I downloaded there is the message 'AVD manager / could not start AVD'. Ok, why was it not able to start the AVD? if I search for that error, even though being a Google product, all the search results are from third party forums. I download some examples from the download samples in the very same Android Studio option. When I try to run those samples, listed in the same tool, 1- I can not run them directly; 2- I can not launch the emulator, and for a >2 gb file it tells me nothing about why it could not launch it, neither do the people who made the tool give the simplest info about why will it not launch; 3- when trying to run the most basic example it tells me to configure run; am I supposed to know what does that mean upfront? how much do I have to read till I get to the part where they explain that, and where do I have to read if all official documentation is useless? 4- Somewhere I read that when I try to run it will ask me which emulator to use; it has not happened yet; which documentation do I believe since there is no official documentation for this thing it seems, and the documentation I find elsewhere is for something that does not have use today,or even do I know which is the more recent documentation on something as simple as 'what does this button do'? who releases a tool without documentation on how to use it?

    When a company decides to launch a platform and wants people to develop for that platform, you would think they try to make it easier for people to develop for that platform; that means they release easy to use developing tools that actually work, offer support for that tools, they don't keep changing the things and the rules in every release and throw away what developers have already learned. If you do that on the other hand, is because your company is run by incompetent people who should be fired and never let get jobs in the field again.
    That includes also the programing languages, and sadly this is not just a Google problem (Google may be the company that does a better job in this matter actually). M$ made c# with the same syntax as Java so people with knowledge on Java could start writing in c# without a long training, yet they sabotage OpenGL to force people to use directx; they do it so if people want to develop for other platforms they have to rewrite it again. Same with Apple and 'metal', even tough Apple still can run not so old versions of opengl and there is a lot you can do with those. If you force people to re-write the things specifically to their platform just because they are so special and people have to do what you want, what prevents people to stop writing for your platform and simply make it aside, and stop taking it into account, as if they have any obligation to release for your platform at all. Android and more or less standard Java seems to work fine so far; yet, imagine that you have to search documentation on how to use the google search bar (the main product of the company) and even so, the documentation you find, if any, is from third parties, and in the search results you can not tell which is the current one and which one is useless anymore. What makes the search bar different from the developing tools released by the same company, to develop for their own platform

    When downloading emulation profiles I noticed some things: even for device profiles with basic characteristics, such as a 240 x 320 resolution phone (a very old one), the oldest Android you can emulate is 5.1. I can not tell for sure, but my guess is that there are still a lot of Android 4 devices out there (they can not be upgraded to Android 5). One of the reasons to develop for Android is to reach as many devices than can run what you are doing, and one reason why there are old Android devices out there is because not everyone could afford an expensive phone at any time time, and if they still work people just don't throw it away every time a new device is released. If Google does not want me to develop for old devices that's their problem, not mine, I decide for which devices I release what I am developing, and if an Android 4 phone would be able to run my app, then it should be me who decides if I want to release for Android 4 or not

    Anyway, back to NDK. Kinda new on this, so I am just browsing the info about making stuff in c/c++ for android. I just found out that you don't actually make native c++ programs. The first things I find when looking for NDK documentation is that there is no 'official' c++ or even c syntaxis, what the hell? I don't completely understand, but what I have grasped, if correctly, is that even though the NDK description says things about using c because of performance, reusing your existing libraries, making native applications etc, you don't actually make c++ native applications, but instead that you 'compile' into something that will be used by a (maybe from a third party) runtime, and that you can choose from various c++ runtimes, each one with a different users license, and each one supporting different parts of the c++ language, but apparently not all of it. I am not sure if it can even support things like templates. In the case of a dictionary, an array that can index things with both a numerical index or a string, I may implement it with a balanced tree each for numbers and strings, and I would use a template for the tree part. If it does not support templates it means I can not reuse the code I have, and I have to rewrite a class for number trees and another for string trees. The documentation also lists that you have to choose to either use new and delete in your code, or use exceptions. What if my code uses both, as those are a core part of c++ syntax and are everywhere? that, despite Java being able to use both new/delete and exceptions

    This is what happened in my first hours of experience using the Android Studio, which I downloaded with the idea of releasing on Android devices things I already have written in c/c++. Now this is what I would have liked to happen:

    I would have liked to download an installer, run the installer without incidents, and open an example and be able to execute it in a window that looked like a cell phone, without messages telling me that I can't but without explaining why I can't. I would have liked to find step by step examples in an official documentation where I could do what the tutorial says and get the exact same result pointed in the tutorial, instead of looking which books are on sale in amazon, which are either old or have a low buyer score. I would have liked to be able to make native applications (which means they don't depend on runtimes that I don't know if they will have support tomorrow, as it has happened with many platforms in the past) with the code I already have. I would have liked to be able to import module by module to track which changes do I have to make without rewriting everything. I would have liked that if I decide to use the code I already have this does not mean to add license terms to my release which are there for political reasons. I would have liked something that works as I expected and that does what is supposed to do. And another thing? there is a google forum for ndk development, yet when I login it tells me I have no permission to post there. uh?

  2. Davdi

    Davdi Android Expert

    Here's the 'start from scratch' Android development course fron Google: https://developer.android.com/kotlin/androidbasics
    I'm going through it now. You'll notice some differences between the latest Android Studio and what the course says, it's just that they used a slightly older version of Android Studio when the developed the course. Just be prepared to experiment and explore and you'll be fine.

Share This Page