0

I'm trying to load a pre-built library on my phone but I get this error

 dlopen failed: "/data/app/com.test.myapplication/lib/arm64/libtest.so" 
 is 32-bit instead of 64-bit

How do I make it work on my 64bit device?

This is my code

MainActivity mthis = MainActivity.this;

Button load;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    load = (Button) findViewById(R.id.btnLoad);

    load.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                System.loadLibrary("test");
                Toast.makeText(mthis, "Success load", Toast.LENGTH_SHORT).show();
            }catch (UnsatisfiedLinkError e) {
                String error = e.getMessage();
                Log.e("Library",error);
                Toast.makeText(mthis, "No lib", Toast.LENGTH_SHORT).show();
            }
        }
    });
}

I have tried putting this on my apps gradle but still won't work

    ndk {
        abiFilters "armeabi", "armeabi-v7a", "arm64_v8a", 
                "arm64", "x86", "x86_64", "mips", "mips64"
    }

My device is Elephone P8000 v1

This question might've been answered already but their method does not work for me

EDIT 2 I haven't changed anything but for some unknown reason I get this error instead, the previous error is gone

dlopen failed: "/data/app/com.test.myapplication/lib/arm/libtest.so"
has unexpected e_machine: 3
Fay Zan
  • 165
  • 2
  • 17
  • How about this one: http://stackoverflow.com/a/28919031/1050927 – Prisoner Oct 19 '16 at 08:36
  • @Alex Thanks for the reply Alex, but as you can see from my code, I'm already using `System.loadLibrary("test");`, and I don't have Android.mk – Fay Zan Oct 19 '16 at 08:43
  • I mean to build the app in 32bit (Android.mk one), according to this post (http://stackoverflow.com/questions/38056720/dlopen-failed-to-load-32-bit-instead-of-64-bit-library), seems you build your app in 64bit, and system try to find library in 64bit – Prisoner Oct 19 '16 at 08:49
  • @Alex Again, thank you for your time, I have editted my question – Fay Zan Oct 19 '16 at 09:10

0 Answers0