0

I'm trying to run an application, and i get a strange thing: the app uses a library project, and i've loaded it in the MainActivity in this way:

static{    
 System.loadLibrary("freerdp-android");
 }

Now, if i launch the app with my smartphone, there are no problems, while if I launch it using an emulator i get this:

08-27 20:10:51.637: E/AndroidRuntime(388): FATAL EXCEPTION: main
08-27 20:10:51.637: E/AndroidRuntime(388): java.lang.ExceptionInInitializerError
08-27 20:10:51.637: E/AndroidRuntime(388):  at java.lang.Class.newInstanceImpl(Native Method)
08-27 20:10:51.637: E/AndroidRuntime(388):  at java.lang.Class.newInstance(Class.java:1424)
08-27 20:10:51.637: E/AndroidRuntime(388):  at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
...
08-27 20:10:51.637: E/AndroidRuntime(388): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load freerdp-android: findLibrary returned null
08-27 20:10:51.637: E/AndroidRuntime(388):  at java.lang.Runtime.loadLibrary(Runtime.java:425)
08-27 20:10:51.637: E/AndroidRuntime(388):  at java.lang.System.loadLibrary(System.java:554)
08-27 20:10:51.637: E/AndroidRuntime(388):  ... 15 more

why?

SegFault
  • 2,020
  • 4
  • 26
  • 41
  • Why are you trying to add in the library project in the code, and not through the build system? Are you building with ant, or with gradle? – yiati Aug 27 '13 at 20:30
  • i've already compiled the library and added it to the project..if i go to properties->Android it appears in the section Library – SegFault Aug 27 '13 at 20:37
  • So ant. I don't understand why you are including this piece of code in your source. The ant build system handles including library projects in the build path. – yiati Aug 27 '13 at 20:40
  • if i erase that piece of code, on launching i get an UnsatisfiedLinkError for a native method which is recalled in the app.. – SegFault Aug 27 '13 at 20:45

3 Answers3

0

first of all it is

System.loadLibrary("freerdp_android");

And, as Esparver wrote, answering a similar question:

In the Java side, it looks like you should load the other libraries as well, in the appropriate order:

static {
    System.loadLibrary("freerdp-utils");
    System.loadLibrary("freerdp-codec");
    System.loadLibrary("freerdp-gdi");
    System.loadLibrary("freerdp-core");
    System.loadLibrary("freerdp-rail");
    System.loadLibrary("freerdp-chche");
    System.loadLibrary("freerdp-crypto");
    System.loadLibrary("freerdp-sspi");
    System.loadLibrary("freerdp-channels");
    System.loadLibrary("rdpsnd_alsa");
    System.loadLibrary("cliprdr");
    System.loadLibrary("rdpsnd");
    System.loadLibrary("freerdp_android");
    System.loadLibrary("freerdp");
}
Community
  • 1
  • 1
Tushar Gupta
  • 15,504
  • 1
  • 29
  • 47
0

There are cases where some apps (which uses play store libraries) only run on devices not on google's default android emulator due to dependencies on other apps i.e play store app and few other reasons.

So try using new genymotion android emulator , it has few more features than default emulator.

Balaji
  • 1,619
  • 15
  • 19
  • genymotion also gives this error. Is there another way to solve this? – SaintTail Oct 21 '13 at 09:52
  • I am not sure about issue, but I think i have used `Galaxy Nexus - 4.1.1 - with Google Apps - API 16 - 720x1280` genymotion emulator and updated google play services in it while updating google hangout app. – Balaji Oct 22 '13 at 10:38
0

You have to add the emulated device ABI to your APP_ABI variable in your Application.mk file or abiFilters block in Gradle if you use Gradle's externalNativeBuild.

Usually you need to have x86 or x86_64 in your list.

See the NDK Guide

Tjaart
  • 496
  • 8
  • 20