"Unable to find native library" error in Native Activity app

3,608 views
Skip to first unread message

NightRadio

unread,
Dec 14, 2013, 2:07:58 AM12/14/13
to andro...@googlegroups.com
Hello!

I have some problems with my Native Activity application. It works fine on 99% of devices. But sometimes users get the following error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{nightradio.sunvox/nightradio.sunvox.MyNativeActivity}: java.lang.IllegalArgumentException: Unable to find native library: sundog
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2070)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2095)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4830)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Unable to find native library: sundog
at android.app.NativeActivity.onCreate(NativeActivity.java:200)
at android.app.Activity.performCreate(Activity.java:5021)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2034)

I can't understand why. The app have all necessary libraries in the armeabi, armeabi-v7a and x86 folders. And it has been tested on many devices with different architectures.
"android:hasCode="true"" option exists.
Also i noticed, that the most of these problematic devices has Rockchip CPU (RK3066, RK2928, RK2926). But not all. The latest one has Huawei K3V2.
Another Native Activity apps (not mine) don't work on the latest device too.

Alex Cohn

unread,
Dec 26, 2013, 10:50:37 AM12/26/13
to andro...@googlegroups.com
Is libsundog.so the name of your library? The problem with System.load("name") function is that it looks for libname.so first in the /system/lib folder. That's why if there is a name clash, your app may crash or fail to start. Therefore it's safer to use System.loadLibrary(abs_path_to_libname) even though it's a pain.

BR,
Alex Cohn

Alexander Zolotov

unread,
Dec 26, 2013, 10:57:58 AM12/26/13
to andro...@googlegroups.com
It is interesting, thank you. Yes, libsundog.so is the name of my lib. I will try to change its name.

--
Alexander Zolotov (NightRadio)
warmplace.ru

emymrin

unread,
Dec 27, 2013, 10:33:31 AM12/27/13
to andro...@googlegroups.com
It's also useful to make the .so name unique, for example in a form of libappname.sundog.so.
If your app is ever delivered as a system app, it's native libraries will have to be in /system/lib, and there may be a name conflict with standard system libs or libs that device manufacturer wants to put there.

Alexander Zolotov

unread,
Dec 27, 2013, 10:54:30 PM12/27/13
to andro...@googlegroups.com
Unfortunately it is not the case. I changed the name to some unique, but the user gets the same error.

Iain Merrick

unread,
Mar 13, 2014, 4:52:06 AM3/13/14
to andro...@googlegroups.com
Hi Alexander,

Did you ever track down this issue? I'm seeing exactly the same problem on the HP Slate 7, which is another Rockchip RK3066.

I'm going to try renaming the library as suggested above, but it sounded like that didn't work for you.

Iain

Alexander Zolotov

unread,
Mar 13, 2014, 6:29:35 AM3/13/14
to andro...@googlegroups.com
Hi!
 
Did you ever track down this issue? I'm seeing exactly the same problem on the HP Slate 7, which is another Rockchip RK3066.
I'm going to try renaming the library as suggested above, but it sounded like that didn't work for you.

Yes, i solved this problem. It works fine now. But honestly i don't understand why :)
I just added the following code to my activity class (based on NativeActivity):

@Override protected void onCreate( Bundle savedInstanceState ) 
  super.onCreate( savedInstanceState ); 
}
Reply all
Reply to author
Forward
0 new messages