I have been working with standard android for some time. Recently I have been building android sdk for windows and find some interesting things in Android build env. There is a command called lunch which can be used to list all available targets to build. However, it does not list sdk and its variants,even though they are valid options.
Does anyone know why is that the case?
Also can I build any specific module in Android sdk without building the whole sdk. (It could be a great help as I dont wanna build the whole sdk, if I gonna do a small change in one component.)
Thanks
Under the hood, lunch uses make, so if some pieces of SDK do not change, they won't be rebuilt.
My speculation about your first question: rebuilding SDK was never considered a major task of lunch. It is most often used to port or mod the system and produce an installable system image, and receive the ADK as by-product. Later, people realized that often (with root access to the device) you can iterate over one component without need to reinstall the whole system image.
Related
Would you recommend the overhead of installing & configuring an Android build server for a 1 programmer project?
The alternative is to upload all sources from development computer to git, download to another computer with Android Studio & Android SDK, and build from Android Studio.
If the answer is yes, would you recommend Jenkins, or another solution?
IMHO, yes, if you have significant time to set it up and maintain it on a separate machine. (I personally would not use a shared machine: too many reasons to restart and disrupt it.)
I feel an extra level of confidence each time I check in if Jenkins builds the whole project successfully from a fresh dir (one less thing I have to do.)
If I forget to check in an important file, Jenkins complains. Or, if I code something that generates a new Lint warning, Jenkins puts a spike in the graph. In other words, on solo projects, Jenkins is like an assistant (or mentor) that helps check my work.
Jenkins can warehouse app installers for future reference. So, it also helps me stay organized.
Jenkins offers some nice communications capabilities too. You can have it automatically notify others via Slack, or put an installer on Dropbox, or, through a service like Zapier, create a custom card in Trello. So Jenkins gives me an outward-facing messenger and delivery service.
These are some plugins I have found useful with Android builds:
Android Lint
Credentials Binding
Environment Injector
Gradle
Slack Notification
ThinBackup
Version Number
Zentimestamp
Of course, this only scratches the surface.
It requires some ongoing maintenance work though. And sometimes it's confusing/challenging to configure. (e.g. some plugins are poorly documented or no longer actively maintained. The linter in Android Studio is not exactly the same as the default one run through gradle by Jenkins, etc)
When I first set my build server up, I had a couple weeks of downtime when I was able to experiment with different plugins and troubleshoot the server. I probably wouldn't have done it without that empty window of time at the start.
As you may know there are three ways to deploy a Qt application on Android :
Use Ministro service to install Qt
Deploy local Qt libraries to temporary directory
Bundle Qt libraries in APK
The first method takes about 30 seconds and it also needs to install an extra apk . Ministro.
The second takes about 1 minute for me ! And anytime I try to run the program Qt creator pushes Qt libraries to the device.
The third one makes the .apk file really big and again takes about 1 minute for me.
I think with this situation that's not reasonable to develop Android application using Qt. Is there a way to make the deploying process faster?
Almost a full year since the OP and things have not changed at all. Deployment of a 7 MB APK takes over minute and a half for a project that compiles in 5 seconds. The reason I am answering is not that the problem got resolved, but to offer an alternative solution.
I've implemented a "workaround" consisting of two applications that work in tandem - one on the PC and one on the device - I created this mostly to compile files remotely, but it turned out to be a much faster alternative for deployment as well. On the host create an application that launches compilation in a separate process, when done copy the product file over network to the device to deploy. Besides remote compilation this reduced the time to deploy to like 10 seconds, I can live with that.
(Not a complete and fully tested answer yet, but I'll update if I find out more …)
Option 1: Copy the changed libraries to a rooted device
A new build will most often result only in one changed file: your libAppName.so, the native library containing your application's code. At least in 2015, it was possible to simply copy over this library to the Android device, without having to re-build the APK package. This only works with rooted Android devices (note that all emulators are rooted by default).
Step by step, according to this blog article and updated with the paths as I found them on my device:
Run the cross-compilation step on your build host system. So just make or the equivalent in Qt Creator.
Copy the resulting libAppName.so to the rooted Android device:
adb push build/path/libAppName.so /data/app/com.example.appname/lib/arm
Restart the application on the Android device.
If that works, you might even be able to integrate it as a custom deployment step in Qt Creator.
I did not test this technique yet due to lack of a rooted device. But it should still work given that (1) rooted Android devices still allow to overwrite all files and (2) debug builds of APKs can still be installed without code signing, so overwriting a library in an APK without code signing should be possible.
Option 2: Desktop targets as a workaround
I found out by chance that Qt's multi-platform character can be used to avoid the slow Android deployment 80% of the time. You just set up another compilation target; under Qt Creator you'd add a target under "Projects → Build & Run", using a kit for "Device Type: Desktop".
Now when you want to test anything that is not Android-specific, test instead in the Desktop version. Building and starting that will only take a few seconds.
This approach is further supported by using a framework for convergent application development so that the same user interface is usable both in the desktop and mobile versions. KDE Kirigami and MauiKit are two libraries for this purpose that build on Qt. Documentation for getting started is a bit scarce, but for Kirigami I wrote an extensive README for the setup of an example application.
I need to edit the original Android Apps from packages
in terms make my own distro/mod..
I want to make changes to the In Call screen, lock screen, contacts, calendar etc..
I understand that for doing this I will have to build everything from
source,
however I need to edit the source and to do so I need to open the OS provided apps as
eclipse projects,
When I did I saw that there are
missing imports which are hidden in the SDK (or missing)
hidden parameters within the classes..
I don't want to use reflection since the whole code is here and
available, but how do you build a platform development kit..
or PDK ?:)
Can any one help?
You start by reading the documentation.
EDIT:
If you are trying to download some single project from AOSP and compile it using the SDK, odds are very strong that it will not work, and that you will encounter problems like the ones you cite. You do not build Android by building individual apps; you build Android ("my own distro/mod") by building the entire firmware. Most AOSP applications are not designed to be compiled by the SDK, but need the whole firmware.
Please check Using eclipse to browse and edit AOSP. You can atleast edit your code using eclipse, but you will have to use AOSP build system to build your distro.
You might also check Debugging Android Java Framework services as that would help debug your changes.
Just open Eclipse,
then go to "window" +"preferences" +"android"
there you will get sdk location,then give the appropriate path of the android sdk for proper run...
I've used Eclipse and vim variously as development environments for Android applications and found both the Eclipse plugin and the command-line SDK tools to be of similar capability.
Since I haven't explored either in its entirety, however, I'd like to ask:
What advantages are there to using Eclipse over the command-line tools and vice-versa?
I could see:
(Eclipse) nice GUI for debugging
(ant/adb/android) more amenable to automation
(hybrid) you can have it all, can't you!?
I'm especially interested in specific features that may be a deal-breaker for one and move a developer in the direction of the other.
Using Eclipse as a development environment for Android doesn't preclude you from also building with Ant to hook into nightly builds or CI tools. You could even configure Eclipse to build using your Ant buildfile if you wanted. If you want some kind of CLI build tool, you might also consider Maven, as it also has plugins to enable building Android apps.
It has been some time (like six months) since I have used eclipse, so maybe it is better now, but I gave up on it because I found it to be very slow and buggy. Maybe it is the integration with ADT, but several times I spent hours hunting down problems that turned out to be fixed if I killed and restarted eclipse (and these problems were not fixed if I did a "clean" within eclipse). After doing that a few times, I felt like throwing the computer against the wall.
"ant clean" is much easier and faster than stopping and restarting eclipse.
Across my personal projects and multiple professional instances of building Android apps, I've always used both types of builds. You'll want to use Ant (or Maven, if you prefer) to set up continuous integration and automated testing. Trying to get that working with Eclipse (which I did a long time ago when the Android SDKs were first coming out) is a nightmare, while Ant/Maven is easily used from any of your favorite CI tools (I've usually used Hudson for this). If there's nothing unusual about your project, it'll be a snap to put together continuous integration, and off you go.
Meanwhile, for just day to day development work, using Eclipse to build your app locally works just fine. But that can easily be left up to the individual developer. I'd make the build that your CI system is running the canonical build, but I do use Eclipse for my normal development.
I'd use Eclipse until such time as you are happy with the debug build. Then you can set up Ant to produce the signed release build.
You can set it up to use the same source files as Eclipse but put the output binaries outside your workspace. You can also set it to use your release.keystore, sign it automatically and obfuscate the code all in one go.
I've set it up to do this. I open a command line (DOS box) move to the projects home directory (\dev\projects\Eclipse\Project1 say), I type "Ant release" and the apk ends up in \dev\projects\AntBuilds\Project1\bin as Project1-release.apk.
If you want the best of both worlds, you might want to look at the m2eclipse-android-integration Eclipse plug-in which allows you to use your command-line Maven build in the ADT/Eclipse environment as well:
https://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/
Well for me im just a beginner, but I find eclipse much easier to work with. Android is a pretty complicated to get used to (for me) so having everything layed out in a GUI is preferable to command line. Plus SDK updates and such are easier to get.
I'm currently working on a large Android app using a massive amount of C++ code.
It compiles and runs, so far so good.
Unfortunately, every time I modify something in the structure of my native source (add/delete/rename/move a file), which happens pretty often, ndk-build rebuilds the whole source, even the untouched files.
Does anyone know how I can set up the Android NDK to build incrementally somehow?
Thanks in advance
I got fed up with the NDK build system, studied it for a bit, and wrote my own makefiles. This was not hard.
However, it was then pointed out to me that by doing this, I would have to take responsibility for tracking future changes to the platform, for example if it becomes necessary to ship binaries for additional processor types, I'd have to modify my homegrown build solution to do that too.
In other contexts, I've sometimes had projects with two build systems - one for quick experiments, another for deployable builds. The time spent updating both now and then was saved many times in the speed gain for daily work. Provided I had to do a real build at least every week or two, things never got very far out of consistency (and both build scripts were in the revision control system, so there was history to examine). Something like this could be done with a custom makefile for debug builds and still using the NDK build system for deployable packages.
(In one case of doing a lot of experiments at the edge of what the platform permits, I actually had my makefile pushing the updated .so onto the device and gave my application one of the discouraged hard-quit buttons, so I could restart it using an updated native library without even having to rebuild and reinstall the apk)