How to run Ndk sample app in android - android

Hi. I want to work on an Augmented Reality application. So I followed this link https://developer.vuforia.com/resources/dev-guide/step-2-installing-vuforia-sdk and I installed sdk, ndk, cygwin, vuforia-sdk-android-2-0-31 and I set path for all of them but when I run ImageTargets sample app, I'm getting unsatisfied link exception. Can anyone suggest me where I did wrong and how to solve that issue.
in my case
sdk path: C:\Development\Android\android-sdk-windows
eclips path: C:\Development\Android\android-sdk-windows\eclipse
cygwin path: C:\cygwin
ndk path: C:\Development\Android\vuforia-sdk-android-2-0-31
vuforia-sdk-android path: C:\Development\Android\vuforia-sdk-android-2-0-31
In environment variables I set path to sdk, ndk and cygwin like below:
C:\Development\Android\android-sdk-windows\tools\;
C:\cygwin\bin;
C:\Development\Android\android-ndk-r8\

You should build the native code (C++) by running ndk-build command from cygwin command-line. Open up the Cygwin.bat in your installation directory to access the command-line and change the directory to the root folder of ImageTarget project and run this:
ndk-build
If it successfully builds the native codes, you should see a lib folder added to your project in Eclipse. Now, you may build your APK and run it on your device. You should repeat this step every time you make a change to native codes.

Related

Do i need to install android NDK manually even after installing android NDK using SDK

When i try to use "ndk-build" i get following error
C:\Users\mack\AndroidStudioProjects\MyApplication>ndk-build 'ndk-build' is not recognized as an internal or external command, operable program or batch file.
Well after some research i found that ndk is not included in path folder of environment variables. Now when i check via SDK i can clearly see that i have checked and installed android NDK using the SDK of android studio, the path of which is
C:\Users\mack\AppData\Local\Android\sdk\ndk-bundle
and i even added this path to environment variables but no use. I am new to android so please pardon me if i am asking a dumb question. But its got me totally confused from like past couple of days.
Do i need to download and install android NDK manually from the link below and install it and then add it to environment variables-path?
I have also included the snapshotot folder contents from NDK installed using android SDK
What i can see from your error is that the PATH to the ndk-build may not be correct or that you do not have a runnable ndk-build file.
Are you sure that ndk-build.cmd is located inside of C:\Users\mack\AppData\Local\Android\sdk\ndk-bundle?
A solution to this can be to download the Windows 32-bit NDK package from Android NDK Download where the ndk-build file is runnable. And add the path to this folder to the

Installing Tesseract for android

Can someone guide me through the process of installing Tesseract OCR engine to use with Eclipse for android development. I have tried a few tutorials but they always lose me at some point. the last thing I tried was trying to download the repository for Tesseract available on github but when following the instructions (after having downloaded the NDK) and following this commands in the command line
`git clone git://github.com/rmtheis/tess-two tess
cd tess
cd tess-two
ndk-build***
android update project --path .
ant release`
when I get to ndk-build it doesnt recognize it as a command. also I have no idea what ant release is or does or if I need to install some software to use it.
Add the ndk folder to your PATH variable. If you are on windows, add the ndk-build path(../android-ndk-r10) to your environment variable PATH. If you are using MAC or linux set/export your PATH variable to include the path to your ndk folder.
Also set ANDROID_NDK_ROOT to point to the ndk folder. This will resolve the ndk-build command not recognized issue.
ant release - is to build your android project for release. This will building your final apk file that goes into play store.
ant debug - is to build the debug build of your application.
Set the JAVA_HOME variable to point to the JDK installation folder for ant to work properly.
set JAVA_HOME=c:\Progra~1\Java\<jdkdir>

Cannot run program "sh": Launching failed

I downloaded cygwin and install. Then copy the ndk file to android folder. The path is C:\Program Files\Android\android-ndk-r9b then add this path to systemVaraible. Then choosen ndk location in Eclipse preference. Then right click the project, select AndroidToold->Add Native supportI'm getting this error: Build of configuration Default for project ImageTargets
(Cannot run program "sh": Launching failed)
Then open the cygwin terminal type $ cd /cygdrive/c/Program Files/Android/androi-ndk-r9b/samples/san-angles ndk-build
Below error i'm getting. Where i made mistake?
-bash: cd: /cygdrive/c/Program: No such file or directory
I had the same error on Windows and it was resolved by setting the correct path for Android NDK in the Eclipse workpace (Preferences->Android->NDK).
You don't need cygwin to work with NDK r9b on Windows. But whether you have cygwin installed or not, you should avoid spaces in the file names for your Android NDK or SDK installations. The easy fix would be to specify the path using short name, e.g. C:\Progra~1\Android\android-ndk-r9b.
See more at The Android emulator is not starting, showing "invalid command-line parameter", or Using Proguard for Android in Eclipse got Error.
the "Cannot run program "sh": Launching failed" may come from a bad eclipse configuration.
You can try to reset C/C++ Build configuration, inside your project settings:
Also on Windows, like Alex Cohn said, you don't need cygwin and can directly launch "ndk-build.cmd" script that is inside your NDK installation folder.

While running augmented reality app showing UnsatisfiedLinkError

I am doing an Augmented Reality application. Here I have Java Eclipse SDK . So I didn't change anything in the Eclipse SDK and Java. I didn't set any path for SDK also and I just downloaded and installed cygwin then I set path for that. I again installed vuforia.exe file and I set path in Eclipse preferences to vuforia and again download NDK. I just extact those ndk and copy in sdk root folder and I set path to ndk. Now I have downloaded vuforia sample apps and I copied all apps in samples folder. In Eclipse I just imported ImageTarget application and it's not showing any error but after running that while clicking start button I'm getting this error:
java.lang.UnsatisfiedLinkError: getOpenGlEsVersionNative
I checked QCAR jar in order and export and I cleaned my app but I am getting same exception can any one suggest me where I went wrong?
ImageTargets.class:
public class ImageTargets extends Activity
{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
You should build the native code (C++) by running ndk-build command from cygwin command-line. Open up the Cygwin.bat in your installation directory to access the command-line and change the directory to the root folder of ImageTarget project and run this:
ndk-build
If it successfully builds the native codes, you should see a lib folder added to your project in Eclipse. Now, you may build your APK and run it on your device.
Alternatively, you can set an automatic NDK build in Eclipse that runs before every time you build your project. So you you don't need to do it manually. See Setting up Automatic NDK Builds in Eclipse.

Plugin Development for Android 2.3

I am new to Android and using Android 2.3 .
There is sample Browser plugin in the source code I am trying to build
it but unable to do so.
To compile plugin [ In README.txt ]
run "make SampleBrowserPlugin" (compiles libsampleplugin.so and
builds the apk)
the previous command produces an apk file so record its location.
Using the above steps I am unable to build it.
I have tried the following things :-
I thought to build the code in JNI folder first so as to get the
plugin ".so" so that after getting the ".so" would build the project
apk using the eclipse .
I tried building the code in the JNI folder using NDK build.The code
was not geting build it was giving "undefined reference to
JNIRegisterNativeMethod in JNIHelp.h "
Can anyone tell me how to build the Sample plugin and install it
on Emulator.
You need to "make SampleBrowserPlugin" from the root of your source installation (on a Linux machine). That is, the same directory that contains "bionic", "build", "dalvik", etc. as child directories.

Categories

Resources