- Home /
Libmain.so - "Unable to find native library: main"
We are developing an Android "launcher" (home screen) using Unity for a custom branded device. This software is "pre-installed". Applications that are pre-installed do not go through the normal installation process where libraries get copied from the APK to the appropriate /data/data directory. Their native libraries are PRE installed as well, but nothing can be pre-installed to /data as that partition is created on 1st system boot, so they are pre-installed to /system/lib.
How to we specify linking parameters under Unity, or manually by tweaking the .APK, to allow us to point to /system/lib ?
We are under time constraint on this issue and would greatly appreciate help resolving it!
Here's the stack trace that we get when pre-installing the Unity application:
The output from the exception: E/AndroidRuntime( 1646): FATAL EXCEPTION: main E/AndroidRuntime( 1646): Process: com.developername.project.componentname, PID: 1646 E/AndroidRuntime( 1646): java.lang.RuntimeException: Unable to start activity ComponentInfo {com.developername.project.componentname/com.developername.project.KidActivity} : java.lang.IllegalArgumentException: Unable to find native library: main E/AndroidRuntime( 1646): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377) E/AndroidRuntime( 1646): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2429) E/AndroidRuntime( 1646): at android.app.ActivityThread.access$800(ActivityThread.java:151) E/AndroidRuntime( 1646): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342) E/AndroidRuntime( 1646): at android.os.Handler.dispatchMessage(Handler.java:110) E/AndroidRuntime( 1646): at android.os.Looper.loop(Looper.java:193) E/AndroidRuntime( 1646): at android.app.ActivityThread.main(ActivityThread.java:5341) E/AndroidRuntime( 1646): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 1646): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime( 1646): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825) E/AndroidRuntime( 1646): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641) E/AndroidRuntime( 1646): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 1646): Caused by: java.lang.IllegalArgumentException: Unable to find native library: main E/AndroidRuntime( 1646): at android.app.NativeActivity.onCreate(NativeActivity.java:171) E/AndroidRuntime( 1646): at com.unity3d.player.UnityPlayerNativeActivity.onCreate(Unknown Source) E/AndroidRuntime( 1646): at com.developername.project.KidActivity.onCreate(KidActivity.java:23) E/AndroidRuntime( 1646): at android.app.Activity.performCreate(Activity.java:5343) E/AndroidRuntime( 1646): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) E/AndroidRuntime( 1646): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2331) E/AndroidRuntime( 1646): ... 11 more
Thank you!
We are having a very similar issue. Did you ever find a work-around?
Answer by dsgermainatlvlstudio-com · May 12, 2015 at 09:35 AM
By replacing the class NativeActivity with Activity, we are able to specify the load location of the libraries from code. This works flawlessly.
Thank you! That is the answer recently given to me by a Unity developer as well and the solution I went with. Apparently Unity 5 is going back to using Activity by default.
http://forum.unity3d.com/threads/specify-libs-location.104482/
http://forum.unity3d.com/threads/pre-installed-apk-unable-to-find-native-library-main.321210/
Your answer
Follow this Question
Related Questions
Is it possible to make a custom launcher? 1 Answer
Mac OS X Build Execute File? 1 Answer
TypeLoadException with libraries in C# 1 Answer
Managing .dll files 0 Answers
Game Launcher Image. 1 Answer