Get the Tools
First problem is the Android development tool. The Gstreamer-Android library is a NDK pre-built library. However as of today the official development tool for Android is Android Studio, which have no support on NDK. I know some Android developers had done great job to make NDK works on Android Studio, but I found that is out of my hand. So I choose the old tool "ADT for Eclipse". I just grabbed the latest version of Eclipse for Java Development (Luna release 2). And installed ADT plugin as instructed on here. This is just the beginning.
Second tool you'll need is the NDK. The latest version today is NDK-r10d. You just need to download it and extract it somewhere in you hard drive. And, once you started a new work space with Eclipse, remember you need to set the path of NDK in the Eclipse preference (Perference > Android > NDK).
Also you'll need the Gstreamer-Android library. You should get it from here. Note that the library is a pre-built native library so you need to choose the CPU architecture. The site do provide ARM, ARMv7 and x86 for you to choose from. To start with, get the ARM debug version first.
Get the Tutorial Source
There are two main stream versions of Gstreamer: 0.10 and 1.0. Actually the latest version as of today is 1.4.5. The old version was better documented, but you can't make 1.0 version works for you by just reading those old document. The development team had published 5 Gstreamer-Android tutorial programs. With detail document that provide section-by-section explanation. However, in the website for 1.0 you cannot find any tutorial code. Finally I found this, which is great work done by slomo who ported the 0.10 tutorial code to work under 1.0 API. Just use git clone to copy the tutorial code to your own hard disk.
Build the Tutorial Projects
You can easily find the 5 Android Tutorial projects in the tutorial source. Use "New > Project" command. Then choose "New Android Project from existing code". Browse to one of the 5 folders for the tutorials. And I recommend to have Eclipse copy the files into your work space.
Here come all the tricky parts. There are still many small changes you need to make before you can make it work.
1. Define Environment String
Actually you only need to define GSTREAMER_ROOT_ANDROID. Define it in the project's preference. Under "C / C++ Build > Environment". It should points to the root of your Gstreamer-Android API library.
2. Add Some Magic in Android.mk
At this point if you try to build the project. Eclipse will hang at certain point. And you don't get any error or hint. Google bought me the solution. Do two things:
- Add the line "ifdef BUILD_PROJECT" at the beginning of Android.mk under the jni folder in your project. And add the line "endif" at the bottom.
- Open the project's preference. Under "C / C++ Build", un-check "Use default build command". And add "BUILD_PROJECT=1" to the build command
3. Define Path and Symbol
In the project's preference, go to "C/C++ General > Paths and Symbols". Here you need to add all directories that contain all the header files that your C code need. They would be come from the NDK (<ndk root>/platforms/android-xx/arch-arm/usr/include) and GStreamer (<gstreamer-android api root>/include/<library name>). Without this even you can build your project successfully, the project will not run in the simulator as Eclipse still find "error" in the C editor.
4. Define NULL Symbol
Even with all above, you will still find one type of fault in the C editor. The editor cannot resolve the symbol "NULL". I don't know why it is not in any included header files. I think maybe the reason is I'm doing this on Windows. So I added it by putting these 3 lines under the include statements of the C code:
#ifndef NULL
#define NULL ((void *) 0)
#endif
After all these. Try to run your project as an Android Application. If everything is fine, you'll get a working tutorial app.
It is really a pain to do so many Google and troubleshoot all the problems one by one. I'm still wondering why I can't find a single instruction page or forum thread that give me all solution. Hope this can help you.
14 comments:
Thanks for finding out some of those quirks. Was definitely banging my head against the wall with studio. Just wanted to add the following for Tutorial 2. Add the following line in tuutorial-2.c: #include and be sure to include the library path.
I'm still looking forward some other Android guru who will share a version of those tutorials that will work under Android studio.
Thank u so very much for posting such a wonderful Info.
ea sports cricket games | Schedule for IPL 2016 App
Thank you so much for this great post on working with Java. Your tips have helped me make some progress. I often find that when I'm working on a sticky issue it is very difficult to find good tutorials. Thank you for walking through some of the steps here. I'm pretty new at using Android Studio in my work and free time.
Nathan @ Emyoli
Thanks. It's been a while since I wrote this. What version of NDK and gstreamer are you using? Does he new version fix some of the issues, or bring more new issues?
Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.
Java Online Training
Great Article… I love to read your articles because your writing style is too good,
its is very very helpful for all of us and I never get bored while reading your article because,
they are becomes a more and more interesting from the starting lines until the end.
Java training in Annanagar
Java training in Chennai
Java training in Chennai
Java training in Electronic city
Java training in Marathahalli
Great Article
Android Final Year Project Ideas for Computer Science
Project Centers in Chennai
Your topic is very nice and helpful to us … Thank you for the information you wrote.
Learn Hadoop Training from the Industry Experts we bridge the gap between the need of the industry. Bangalore Training Academy provide the Best Hadoop Training in Bangalore with 100% Placement Assistance. Book a Free Demo Today.
Big Data Analytics Training in Bangalore
Tableau Training in Bangalore
Data Science Training in Bangalore
Workday Training in Bangalore
Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts.
sap abap training in bangalore
sap abap courses in bangalore
sap abap classes in bangalore
sap abap course syllabus
best sap abap training
sap abap training center
sap abap training institute in bangalore
Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
sap hana courses in bangalore
sap hana classes in bangalore
sap hana training institute in bangalore
sap hana course syllabus
best sap hana training
sap hana training centers
best sap hana training
Awesome,Thank you so much for sharing such an awesome blog.
sap hr courses in bangalore
sap hr classes in bangalore
sap hr training institute in bangalore
sap hr course syllabus
best sap hr training
sap hr training centers
sap hr training in bangalore
Thanks for sharing this blog. This very important and informative blog
sap mm training in bangalore
sap mm courses in bangalore
sap mm classes in bangalore
sap mm training institute in bangalore
sap mm course syllabus
best sap mm training
sap mm training centers
Learned a lot of new things from your post! Good creation and HATS OFF to the creativity of your mind.
sap fico training in bangalore
sap fico courses in bangalore
sap fico classes in bangalore
sap fico training institute in bangalore
sap fico course syllabus
best sap fico training
sap fico training centers
Post a Comment