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.
Related
I am developing an Android project. In my project, I need to do OCR. So found this tutorial http://www.codeproject.com/Tips/840623/Android-Character-Recognition. I am trying to follow that tutorial. But I am having problems with set up, especially with updating project from terminal (tess-two folder). See what I have done below.
I downloaded tess-two from this link
https://github.com/rmtheis/tess-two/
Then I installed android NDK to build that project
I set environment variable under PATH
Then I run below command in tess two folder from terminal
ndk-build //this took around 30 minutes. I closed command windows after successful built
Then I run this command
android update project --path C:\tess-two-master\tess-two
The problem starts when I run that command because I cannot run android command from terminal. So I found solution from Stack Overflow. I needed to set ANDROID_HOME and environments variable under PATH. Then I tested "android" command and it is working.
Then I run this command again
android update project --path C:\tess-two-master\tess-two
This time, it is giving me this error
How can I solve this error? Why my update command is not working? What is wrong with my code? I am using Windows 64 OS.
This is another way. Installing using Grandle
I tried another way to install tess-two. I installed using Gradle like this according to documentation. But I cannot access to TessDataManager because it cannot be found in project.
Gradle
dependencies {
compile 'com.rmtheis:tess-two:6.0.2'
}
This is error
As you can see, I cannot access to TessDataManager class. How can I import that class?
The tess-two project has been updated to include a pre-compliled AAR that can be incorporated into your app by editing your app's build.gradle file.
This means that you can skip the steps of importing/compiling the library yourself, and follow the usage instructions on the tess-two project. After following the usage instructions, you'll be able to refer to the tess-two classes -- including the TessBaseAPI class -- directly from your project.
So I've tried posting some of these issues on the Phonegap forum but have not heard from anyone regarding my issues...
I recently upgraded from PG 2.9 to 3.3 and am having trouble adjusting my project to the change... it should be as easy as installing phonegap 3.3 and creating a new project and dragging my /www to the root of the project and calling the cordova CLI commands to build and update my project-- both of which say that they complete successfully.
But it's not that easy! Instead, building and updating my project deletes the cordova2.9.jar and does not create a 3.3.0 jar... so I build it myself which goes fine. I stick it in my /libs folder and my app loads on my phone finally... The problem now is that running in PG 3 requires a change in how API calls are handled-- they are all plugins which you have to install before using them... so I installed all of the needed plugins...
The problem now is this message in logcat within Eclipse:
Unable to open asset URL: file:///android_asset/www/cordova/lib/cordova_plugins.js
so I find this cordova_plugins.js file in the root of my assets/www/ directory (Why is it here?! Shouldn't this be automated by cordova build & update to the correct location?!) So I try to copy the file to /www/cordova/lib/ where the error reports it is trying to find it.
When I do this, I get all of these errors:
Unable to open asset URL:file:///android_asset/www/cordova/lib/plugins/org.apache.cordova.file/www/DirectoryEntry.js
Unable to open asset URL:file:///android_asset/www/cordova/lib/plugins/org.apache.cordova.file/www/DirectoryReader.js
Unable to open asset URL:file:///android_asset/www/cordova/lib/plugins/org.apache.cordova.file/www/File.js
Unable to open asset URL:file:///android_asset/www/cordova/lib/plugins/org.apache.cordova.file/www/Entry.js
...etc (basically every plug-in that I had installed in the project.)
I am clearly missing something here... relocating these javascript files to the correct directory manually should not be what I need to do...
I should mention that this original error occurred when I was running the application in PG2.9 but the only plugins that I needed to use were included by default so I could still use the needed API functionalities.
Any ideas here?
You must need to create and deploy any phonegap project/application using Phonegap Command Line Interface
To Create any project write following command on command line:
$ phonegap create <path> <package_name> <project_name>
i.e.
$ phonegap create hello com.example.hello HelloWorld
To add any platform to your project:
cd <path_to_project>
$ phonegap build <platform>
i.e.
cd hello
$ phonegap build ios
$ phonegap build android
To add any plugin feature to your project:
cd <path_to_project>
$ phonegap local plugin add <path_to_plugin>
i.e.
cd hello
$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
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 :)
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'm trying to build and run the 'Tutorial 2 Advanced - 1. Add Native OpenCV' tutorial built into the opencv package for android. I wasn't able to use the ndk-build from eclipse following the tutorial from http://opencv.itseez.com/trunk/doc/tutorials/introduction/android_binary_package/android_binary_package.html
But, I built the project from cygwin successfully. But then when trying to run as an android application in Eclipse, it has the error
'Description Resource Path Location Type
The project was not built due to "'NUL' is an invalid name on this platform.". Fix the problem, then try refreshing this project and building it since it may be inconsistent Tutorial 2 Advanced - 1. Add Native OpenCV Unknown Java Problem'
Any help would be much appreciated, thanks
What exactly did you build with Cygwin? I've had an error which prevented me from building from the command prompt but with Cygwin everything works fine.
In Cygwin I first navigate to my project folder:
cd /cygdrive/c/"path to your project folder>"/
then while I'm in the project folder type:
/cygdrive/c/"path to android-ndk-r7b folder"/ndk-build
After using these commands I was able to run the Tutorial 2 Advanced - 1. Add Native OpenCV project. Let me know if this helps you?