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