问题描述:

i have looked through all the other posts here about this subject but none of them helped me.

i am using a third party SDK (oovoo) and it contains a .jar file and .so file (armeabi-v7a)

as stated in allot of places, i put the .jar file in the libs folder and the armeabi-v7a folder (which contains the .so file) in a folder named jniLibs inside src/main

after building, when i unzip the .apk i see a folder named lib and inside it a folder named armeabi-v7a which contains the .so file

yet i still get this exception:

 java.lang.UnsatisfiedLinkError: Native method not found: com.oovoo.core.ClientCore.VideoChannelPtr.nCreate:(Ljava/lang/String;)J

  • why cant it reach the implementation?
  • if it is in the lib folder in

    the .apk does it mean it will for it at runtime?

thanks allot!

android studio version 0.8.6

gradle version 1.12

oovoo version 1.2.4

网友答案:

To answer your questions specifically :

It can't reach the implementation because at runtime, when the java environment tries to load a native method named java_com_oovoo_core_ClientCore_VideoChannelPtr_nCreate with the prototype int (string) it doesn't find such a method loaded. This can be caused by the folloiwng :

  • the .so library isn't loaded by the time you called that method , hence java doesn't know about it (so it's your mistake, you called the functions in wrong order)
  • the .so library doesn't export such function , which means you have no chance of fixing this
  • the .so library loaded at runtime by the phone requires a different architecture besides armv7s. Be sure your device is armv7s
  • the folder in which the Android system is looking for native libs is different then you expect. I know this was an old issue, so create in your apk, in your lib folder both "armeabi-v7a" and "armeabi" , and copy that .so file in both

Regarding your 2nd question, yes , if you have the lib inside the apk you will have it at runtime.

相关阅读:
Top