What is an Android.mk file - android

A project that I am trying to build has one of these, and I want to know exactly which tools are needed to build the project. I see some reference to NDK when I search but is that the only tool? It appears that this file is making a jar file, I see no reference to native code ( c++ )

The Android.mk files in the SDK samples are required to properly include the samples in the SDK build (if you are actually venturing into that territory). These have no bearing on what you are doing when you use the sample. To the OP, I'm not sure if you are using a sample project, but if you are, you can ignore this file.

the best answer to your question is reading this article:
Android.mk file syntax specification
https://android.googlesource.com/platform/ndk/+/4e159d95ebf23b5f72bb707b0cb1518ef96b3d03/docs/ANDROID-MK.TXT
after reading it you can figure out the idea behind the android.mk file.
cheers

I've seen some of the Android sample code come with an Android.mk file for no apparent reason -- maybe this gets auto-generated upon project creation if you happen to have the NDK installed or something. Android.mk does seem to be an NDK-specific thing.
So if there's really no native code involved, then if you're looking to build from the command line, make sure you have the JDK, Ant, and Android SDK installed.
Then take a look at
http://developer.android.com/guide/developing/projects/projects-cmdline.html#UpdatingAProject
After you run the "android update project ..." step, you should hopefully be able to do an "ant debug" to build the application.

Related

Android Studio + Liquid Fun

I'm trying to setup Android Studio + LiquidFun. I follow a lot of tutorials like these:
http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-studio/
http://tools.android.com/tech-docs/android-ndk-preview
But either isn't comprehensive or isn't work. I tried all, copy directly the files (C++) to my project, tried to import using NDK, tried to fix NDK with gradle, etc. But nothing works. I appreciate it too much if anyone could help me to solve my problem or to install Liquidfun properly.
Thanks.
Did you try following the instructions from here:
https://google.github.io/liquidfun/Building/html/md__building_android.html
They seem clear enough. You need the NDK on your PATH for ndk-build to actually do anything.
If you are going to use Java, you may want to try JLiquidFun, a derivative of LiquidFun with enriched Java bindings and pre-compiled native libraries.
try this instead
build .so, copy to AndroidStudio Project's lib dir
last year,i was compiled successfully, use Old version NDK and Android SDK.(This is very painful)
i think need It needs to be adapted to the new Android SDK
In particular, build statements in.mk files or.py files ,
Because you're using the old version of the command line command

How can zlib.cpp in boost ever compile?

I compile my Android project in QtCreator with BOOST_ALL_NO_LIB. This means I include all boost .cpp files right into my project. When I converted this project to Visual Studio project to try to build it for windows, one boost file started to cause problems: zlib.cpp
It contains these lines:
#include "zlib.h" // Jean-loup Gailly's and Mark Adler's "zlib.h" header.
// To configure Boost to work with zlib, see the
// installation instructions here:
// http://boost.org/libs/iostreams/doc/index.html?path=7
I don't understand how is this ever meant to compile, since the directory looks like this:
That means the zlib.h is not there and cannot be included. Visual Studio experiences exactly that problem:
boost159\libs\iostreams\src\zlib.cpp(20): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory
At the same time, it compiles all right in QtCreator with qmake. So what's going on, how can it ever work? And how to make it work in Visual Studio 2010
You're supposed to have the library dependencies installed.
This means that zlib.h is in your system's include directories.
Your IDE might silently add some convenient libraries your include paths.

How to Build CMake based project for Android/iOS using QtCreator

I have created a Non-Qt C++ (CMake) project using Qt, and I am able to build it using MinGW, MSVC compiler.
So in short, when I am opening my test project I can select the generators under Run CMake Window. I have issue with other platforms.
When I am trying to Add a kit for Android, there are no generators available in the list. I tried the same thing on Macbook, there also the same problem.
I need help on this issue, I couldn't get the proper steps to build the CMake based project for Android/iOS using QtCreator.
P.S. Installed CMake version is 3.2.1 and Qt Version is 5.5, I have installed Android SDK, NDK , and and Java
I would love to tell you "just check this box in the options dialog and it will work", but, unfortunately, there is no generator that you can use to build an Android/iOS project from a CMakeLists.txt file.
I found alternatives, in all cases, I don't think your have a chance to port a whole huge CMake-based project that used to work on Windows (with lots of libraries and 3rd party libraries) work on Android in less than a few days of work....;-)
Personnaly, I wrote a small CMake function generating the .pro file manually from my CMake scripts. It started small but is now huge and it's difficult to share it with you. But, basically, I started from this post on a Qt forum. It creates a simple .pro file that does not work that bad and then you can extend it for your own needs. I like this solution because I have full control on generated .pro file (mine can now build on PC, Android and iOS...but I had a hard time to have this fully work).
Apparently, there's also a way to add a Qt-android CMake support using this open source stuff: https://github.com/LaurentGomila/qt-android-cmake. But I never tried it. You may want to have a look to it. If it works, it may be more convenient that writting your own script generating .pro files. Apparently, it builds an Android apk using androidqtdeploy but without using QtCreator. There's also an iOS support.
Finally, the best may be to have CMake propose a QtCreator "generator" (it would generate .pro files, like CMake generates sln/vcproj files when using Visual Studio generator or makefiles for g++ generator....), but there is no such generator supported. I reported this to CMake team some time ago hoping they could fix that. I understood that there was and would be no plan to do that because CMake targets only "compilers" as "generators" and "QtCreator" is not really a "compiler", it's a "IDE" using external "compilers" to build (MinGW, MSVC, CLang, Android's NDK g++...). It's a shame because CMake known all your project information and could easily generate a .pro file....so, as, CMake is opensource, one may extend CMake with a custom QtCreator file generator...and share it with the whole world,it would be wonderful!
Hope this will help you!

Running FFMPEG in Android [duplicate]

I am trying to compile ffmpeg for a android. I have found several posts on this theme but non of these seems to work. If tried to build ffmpeg like it is posted on [1]. Did anybody successfully compile ffmpeg using theses tutorial?
I am not sure how to realize step 4 to 5.
STEP4: Configuring ...
STEP5: cd to your NDK root dir, type make TARGET_ARCH=arm APP=ffmpeg-org
It seems to me that building an application like it is explained in the tutorial in step 5 need some previous steps. Unfortunately I have no app in the folder to make. I am using the current android ndk release 3 and checked out the actual ffmpeg releases from [3] and [4]. I am thankful for every advice.
[1] http://slworkthings.wordpress.com/
[2] http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android
[3] http://ffmpeg.org/download.html
After looking around the net. The only working solution I found is supplied by Bambuser which ported ffmpeg to use in their android application.
Code is here: http://bambuser.com/opensource
Basically you copy the .so files to your jni/lib directory, along with any .h files you might need, create a JNI wrapper through javah, and it works.
EDIT:
Since this post was written a few packaged ffmpeg projects for android surfaced, one of the easiest ones to compile and use is here: https://github.com/guardianproject/android-ffmpeg .
It takes the approach of statically compiling a binary (not a library) that is ran through shell command in run time. Search github for 'android ffmpeg' for forks and related projects.
Did not find a well packaged method based JNI implementation, though.
I found a guide on ffmpeg on android here:
http://rxwen.blogspot.com/2010/05/use-ffmpeg-to-setup-streaming-server-on.html
He explains in another post how he got to do native programming on android to install ffmpeg. Hope it helps.
I will provide a more updated list of sources which will explain how to build and, in some cases, even use FFMPEG on Android.
This is the guide I liked the most: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
If you need more options, you can take a look at these, which are equally good:
https://github.com/guardianproject/android-ffmpeg
https://github.com/halfninja/android-ffmpeg-x264
https://vec.io/posts/how-to-build-ffmpeg-with-android-ndk
In NDK r3, when you use the make command, the NDK will simply use the name of the folder in the "apps" folder for the name of your project. This assumes that you have your FFmpeg source files and android.mk somewhere within NDK/apps/ffmpeg-org/jni/
In otherwords, ensure that your foldername is set to ffmpeg-org.
EDIT: You might find it worthwile to use NDK r4 which changes make to ndk-build. In this new NDK, you don't need to have your project set up in any particular way, as ndk-build simply searches your project for Android.mk files to tell it what to compile.

Compiler errors with sequoyah, but build well from command line

This is really frustrating
- I can build my native code from command line, but when I build from eclipse(Sequoyah plug-in enabled) its simply through simple compilation errors like headers not found...
EVen when i build the library from command line everytime I try to run from eclipse it rebuuilds and there goes errors again
- I'm frustrated as I ran out of option to locate the issue
Can some one shed some light on this.
The error you are seeing is Unresolved inclusion with error markers at each header that Eclipse's editor cannot find. This is confounding when you see it, because it is expected that after installing Sequoyah and the ADT, pointing the Sequoyah configuration to your NDK, that you'd have everything you need to start coding.
Two things to observe. The process of building in the ADT "Android Perspective" will work until you click on one of your C/C++ files in your jni directory. Once you open one of these, you'll see the error marker and the project will be tagged as containing errors.
Second observation, when you convert the project to C/C++ perspective or to Sequoyah's Android Native perspective (apparently there's two ways to skin this cat), you will have the ability to configure the project settings around NDK toolchain, include paths, and builder settings. This is where you can set the ndk-build to automatically fire off on each change. And funny thing too is that the ndk-build will work fine until you click on one of your C/C++ sources.
So solution, click [here] http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/tasks/cdt_t_proj_paths.htm and you'll get instructions for configuring the CDT's include paths. You want to set your include paths for C/C++ (either, or both) so that you get to the platform folder includes.
Example, I've got my project hello-jni-to-the-world project set to android-9. So configure the include path: android-ndk-r6b/platforms/android-9/arch-arm/usr/include . Now the magic won't show up until you click apply/save and you'll be prompted to rebuild the indexes.
There are two to three other threads on Stackoverflow asking the same question, and I'll have to find them and add them to the comments. Basically, there were no definitive answers and there's a lot of the usual answering a question with a question: which version of NDK do you have, can you post your code, did you install java, is your computer on ?

Categories

Resources