I'm trying to develop a video chat app on java. I found libjitsi, it uses native libraries. There are two example codes which called AVTransmit2 and AVReceive2 (if you want to look: https://jitsi.org/Projects/LibJitsi). But i can't run any of them. I think I don't know how to add native libraries. When i link the native libraries with that:
System.load("the path of the native library")
all of them seems added except one. The one which stops the running with linking error, the one which called AWTrenderer needs links for more libraries. But libjitsi gives me enough libraries for run the code i think. But i still getting linking problem at output. So where is the problem? Can anybody help me please?
Solved. I didn't use system.load for linking the native libraries. My IDE's (eclipse) got a configuration for it. You just selecting the folder which includes native libraries.
Related
Problem: 20% of users are receiving:
Fatal Exception: java.lang.UnsatisfiedLinkError
No implementation found for java.lang.String com.example.utils.API.getHashString(android.content.Context) (tried Java_com_example_utils_API_getHashString and Java_com_example_utils_API_getHashString__Landroid_content_Context_2)
For other 80% app working perfectly, no exception on my test devices as well.
Can't figure out what's the problem.
EDIT1:
Library loads perfectly on splash screen. No exception on that point.
static { System.loadLibrary("my-lib"); }
EDIT2:
Just reproduced the error. It is absolutely random. App function call works fine, and at some time it starts failing. The only fix is re-installing the app.
Following my comment and later comments from #stanislav-parkhomenko, I'm reposting it as an answer. Thanks!
My comment:
Where is the static {...} block located? A possible reason for this could be that the code is not executed before some calls.
And later confirmed by himself that this was the cause:
The problem was in library initialization. Splash screen run not always, because of sharing functionality, thats why some times library did not load.
Thanks to Xavier Rubio Jansana for advice, which cured my blindness.
Glad it helped!
This error is caused by method signature mismatch between Java and native library you are loading. It is likely that 20% of users have different version of library file with same name. If it is your own library try giving it relatively unique name and load it from absolute path to reduce chance of name conflict.
It looks like it's trying to load a native library, and there isn't support in Android Gradle for native code yet. You should double-check the docs for your library to confirm; I tried to look it up but it looks like it's a commercial library without publicly accessible docs.
You could just put the .so files into jniLibs folder in src/main. This was introduced in AS 0.7.2
As a sample, see this from #CommonsWare, or see this page for official samples (scroll to the bottom of page)
Yes Still no support for native library in Android gradle.Just I followed simple hack.It works great.Check this
I'm looking to write a Linux/Windows/Mac Java HID controller for a simple wireless HID interface device. I've tinkered around with the USB4Java LibUsb library to no avail, and I've been steered in the direction of the JavaHIDAPI.
Unfortunately for me, I really have no idea what I'm doing beyond a pretty decent higher level programming skill set (C#/VB.Net), and switching over to this is killing me.
The directions that I found said that I would first need to compile the HIDAPI library found here. It said it would build something called hidapi-jni.dll (which it didn't).
Anyway, I think this is where I need to go since the HID does nothing but simply sends and receives signals to and from a wireless control (and responds to signals received).
Is there any step-by-step tutorial for using the JavaHIDAPI for this? Or is there a better library? (I noticed that this is a bit... dated).
I tried myself with the following:
static{ System.loadLibrary("hidapi"); }
.
.
.
public static void main(string[] Args) throws . . . {
ClassPathLibraryLoader.loadNativeHIDLibrary();
HIDDevice dev = HIDManager.getInstance().openById(VEND_ID, PROD_ID, null);
.
.
.
}
The issue into which I am running is that (besides the fact that the HIDAPI doesnt seem to be building into HIDAPI-jni.dll) is that the HIDManager.openById(. . .) always returns null. Also, I moved the hidapi.dll that was built into the C:...\Java...\bin directory... or something, I'm sure it's right because there wasn't any unsatisfied link error. It's really frustrating because there doesn't seem to be any newbies guide to Java and HID anywhere.
What am I doing wrong here?
I'm a bit late to answer this question, but I've written a library called hid4java that might solve your problem.
It's based on Java Native Access (JNA) which is a lot simpler than faffing about with complex JNI incantations.
I had to write it because javahidapi is out of date and the underlying signal11/hidapi code has moved on considerably. The older versions of the hidapi library had problems on OS X with attach/detach events which have now been fixed so an upgrade is necessary.
Also I found it impossible to claim a USB HID device through usb4java on OS X so I ended up writing this library to solve that problem.
Hope it helps.
So the issue, I discovered, was with native libraries.
I was able to get the application to work by copying the .dll from the .jar file and referencing it, but more important, I'm going to rebuild the .java class file responsible for loading the library and add the
System.loadLibrary();
call. When the JavaHidApi ClassPathLibraryLoader.loadNativeHIDLibrary(); method is called it doesn't load the library upon successfully writing it out to the temp file which is mildly annoying. Doing this will eliminate the necessity for manually loading the library from a static location...
Thank you for pointing me in the correct direction.
I've made a cool processing project that I would like to embed on the web; however, it uses 3rd party Java libraries to access an sqlite database. For this reason, the normal export-to-javascript which has worked well for me in the past is just not capable enough here. How can I make my Processing project into a Java applet that will allow it to be run remotely?
This depends upon what version of Processing you are using...
It was only in the final move to 2.0 that they got rid of the 'Export to Applet' option, so if you can make do with a 2.x-beta version, you're golden.
Of course, that's just through the PDE - so failing the ability to move to an earlier version, the library itself should be able to handle it still, from a different IDE, say Eclipse or NetBeans...
I guess the other option would be to see if you can port your library to a JavaScript library ?
I have installed SIPDROID. I made three account at sip2sip.
After that I have configured application using one of that account. Application works fine.
Question is: If I make multiple call to the same phone using SIP is there anyway to handle all calls at a same time?
Another incoming call is not displaying on mobile screen while first call is continue.
The first call getting picked up but what about the second call which is coming during first call.
Even second call is not displaying on the screen. Confused !!
Sipdroid that I what started with but after researching on it and from developers reviews I found that application has some missing functionality like multiple call and transferring calls etc...
I don't know but may who is expert in sip stack or have time to do can implement missing functionality but I am neither one of them so my desire to get an application that have all this functionality and by modifying it I can integrate into my application and csipsimple is the answer.
However its not easy job to build csipsimple into windows environment but there is hack how to do it. so carefully read its wiki about building project into window environment.
According to wiki you can build native library or you can go ahead without building the native library. I suggest for windows user to go with without building the native library.
If you have read wiki then in "without building the native library" section last line is like
"To get the .so files, download latest nightly build from nightly
build website and unpack the apk file (apk files are just zip files).
Then get lib/ARCH/.so files and copy it into CSipSimple
libs/ARCH/.so"
I have to clarify one important thing about that:
First get .apk file of csipsimple. The version of .apk file must same to download version of your csipsimple source code..
Here, you can see the source code version. Download the same version .apk and do further as described in wiki.
SipDroid supports only one line at all times. This means you cannot have conference calls. So to the question:
If I make multiple call to the same phone using SIP is there anyway to
handle all calls at a same time?
Nope, you cannot handle simultaneous calls at the same time. Fortunately there's another open source SIP Client that supports multiple lines - IMSDroid.
Though you can extend SipDroid to support multiple lines, that's a lot of effort. The main objects you have to pay attention to in order to support multiple lines are:
UserAgent, SipProvider (note that it's designed to support multiplexing/demultiplexing of SIP messages), JAudioLauncher and the Call object.
The bug you're describing with the second call not showing is not something I have witnessed. This could be due to your device setup, or due to customizations performed on the original code...
you can build the csipsimple easily in linux OS... All you have to do is just paste the download source link in linux commanpropmt and for windows you must have latest cygwin software to download or to build native library... Better option is to go for linux OS only...
I have a rather large shared library file (= 12megabytes) which does not contain any JNI code whatsoever.
When calling System.loadLibrary("some_file") the method never returns and no relevant output is generated. Also, Windows Taskmanager reports that the emulator instance is not hogging all the CPU power.
I have a class with the following code:
static
{
System.out.println("Trying");
System.loadLibrary("some_file");
System.out.println("Works");
}
Here is the output given from LogCat:
I/System.out(534): Trying
D/dalvikvm(534): Trying to load lib /data/data/app/lib/libsome_file.so 0x40643c20
If I upload a native test application that uses the library libsome_file.so and run this from the emulator shell, then the application works.
Is there any method to debug what System.loadLibrary is doing or does anyone have some hints why System.loadLibrary might never return?
I found the solution to the problem myself. I did not use any additional debug tools, but left out some code that was run when the library loaded. The particular code hanged, making System.loadLibrary hang as well.
Adding my solution in case someone else run into the problem. The problem was with some external dependencies (OpenSceneGraph) that were loaded statically in our library. They were only hanging on Android 4.0 and it was running fine 4.2 and up.
So if you have the problem, put a __android_log_print in the JNI_onLoad of your library (if you have one). If it is not called, check all the functions that can be called statically (beware, some might be hidden behind macros) and try to remove them to see if your able to load the library then.