java.lang.UnsatisfiedLinkError: Couldn’t load jni-input: findLibrary returned null


First,I use NDK in the MainActivity,it works fine.:

public class MainActivity extends AppCompatActivity {
TextView textView;
protected void onCreate(Bundle savedInstanceState) {
    EventInput eventInputnew EventInput();
    textView.setText(eventInput.eventInject());// NDK
} like this:

public class EventInput {
static {
public native String eventInject();

Then,I remove the MainActivity and in the boot broadcast receiver I start a service ,and used ndk in service`s onCreate method,like this:

public void onCreate() {
    try {
        EventInput mockEventnew EventInput();
    }catch (Exception e){

And I push it to /system/app to make it be a system app which will listen the boot broadcast and start the service.But it runs with:

java.lang.UnsatisfiedLinkError: Couldn't load jni-input: findLibrary returned null


I resolved it myself. In compared with regular app,the nativelibrarydirectories of apk in /system/app are /vender/lib and / system/lib by default which are the search-path for loading .so file.So, It works well when I push my .so file in /system/lib.

Answered By – helloliu

Leave a Comment