I've been trying to write a simple android app using NDK in Eclipse IDE.
Added NDK plug in
Added jni folder in the project and written a Cpp code
Built it properly using ndk-build
so file(s) are also generated
Compilation was successful and error-free. Yet, I'm unable to run it as an Android App as the apk file hasn't been generated.
Kindly help :)
Related
For a new Android Studio Project I have somehow generated the files that are generated whenever we create a new project through Android Studio through a python script. This script also places the java and layout xml files in their respective locations. Now I want to build this project and generate the APK through command line only (without opening Android Studio).
I found the android command but that command is deprecated and no longer supported.
Image of the message when using android command
Now, can anyone please suggest any other way to build and create APK through command line?
I found this ant software but am unable to use it as I don't know how to create the build.xml file.
Please help me out.
When I build pocketsphinx demo project by eclipse, IDE generates md5 files of some assest files. Hovewer If I do the same thing on Android Studio, It does not generate md5 files. In this case, the aplication that I compile with Android Studio gives an error shown below.
Failed to init recognizer java.io.FileNotFoundException: sync/models/grammar/digits.gram.md5
I am currently using Studio 1.0.2 version.
SDK tools :24.0.2
SDK platform-tools:21
SDK Build-tools :21.1.2
What would be the problem?
Thanks
I had the same problem. I solved it by making my own .gram.md5 file manually every time I changed my .gram file. I used this website to automatically generate the full text of the needed .gram.md5 file from the full text of my .gram file.
http://passwordsgenerator.net/md5-hash-generator/
I have gone through this opencv Android samples link. In this link all the projects has a JNI C++ code which builds the ".so" file automatically and build the project. I need to create a sample project like the above examples, in which the C++ code builds automatically.
I have gone through few tutorials like this, which has steps to build JNI using command line but there is no steps to build it automatically/using eclipse project.
Can any one list out the steps to create a project in eclipse that builds JNI C++ files automatically?
I suggest you can read the article Getting Started with JNI on Android, Windows and Mac. You just need to right-click on your project and select Add Native Support. Then the IDE will automatically build the .so when you save all changes.
i used eclipse "run as an android application" option to updating .apk(with new .so file) to phone, but found .so file were still old. What happened when updating apk to android device? Can .so file be updated also?
You need to generate .so file again by build command of ndk .And then run your application again.It will then use new .so file. "run as an android application" makes new .apk of java as well as xml code but when you are dealing with c++ or c code the eclipse can't compile that code.
First you need to compile your native code by running ndk-build command.
Then you need to make a build.xml file using android update project.
Before running android update project, find ID of the target you want to use for your project.
Run android list targets and find the ID for your target.
Now run android update project --target your-target-id --name your-project-name --path /path/to/your/project. It will populate your project with build.xml and local.properties.
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.