0

Once the APK launches, I get this error:

E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.engine001.test/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app/com.myapp.test-2/lib/arm/libLauncher.so

Even the most basic NDK app seems to have this issue, even without linking to other .so. Using latest Tegra/NDK/etc... tools.

Entire system worked fine until I upgraded systems and updated tools.

EDIT: I have tried to install the previous version of the tools I had working (ndk r12b). I have also tried literally copying my old NVPACK and setting things back up to no avail.

I am not sure what to include. This is a very large project currently in use.

I cannot include actual Java code as I modify the APK after and this cannot be done if a DEX file is produced, which is what Java entails. So to be clear, using a pure NativeActivity.

Mike Weir
  • 3,094
  • 1
  • 30
  • 46
  • did you make sure apk actually contains that library? – Alexey Andronov Dec 20 '18 at 02:41
  • Yep! The files in the apk seem good. But I am unfamiliar with a way to ensure the .so files are proper. – Mike Weir Dec 20 '18 at 02:51
  • What is your current tools version? – shizhen Dec 20 '18 at 02:53
  • I guess the problem with NDK then. You can try to downgrade to older version and see if it will resolve the issue – Alexey Andronov Dec 20 '18 at 02:59
  • I modified question to include ndk r12b and to mention I've tried going back to that version as well. – Mike Weir Dec 20 '18 at 04:09
  • First of all, look inside your APK: does it have **libLauncher.so** packed into it? At what path: armeabi, x86? Second, which ABIs are expected by your device? To answer the last question, run **getprop** command in **adb shell**. – Alex Cohn Dec 20 '18 at 09:52
  • @AlexCohn Good point, but sadly, the device I'm using is fine: `[ro.product.cpu.abilist]: [armeabi-v7a,armeabi]`. And yep, however, it exists at: `/lib/armeabi-v7a/libLauncher.so` - as noted in another answer, it appears the log is referencing `arm`. I figured that was simply a symlink to whatever was appropriate, but if that is not the case, where could it possibly be getting this path from? To be clear, within my build folder, it's located: `\build\libs\armeabi-v7a\libLauncher.so` just fine. – Mike Weir Dec 20 '18 at 15:51
  • *sadly, the device I'm using is fine* — I'd say, that's good! I'll give you some more advice later today. – Alex Cohn Dec 20 '18 at 18:49
  • See https://stackoverflow.com/a/30539868/192373. – Alex Cohn Dec 20 '18 at 21:19
  • @AlexCohn I can't use Java unfortunately. It produces a DEX file that I can't manipulate. – Mike Weir Dec 20 '18 at 21:29
  • Here Java is only to diagnose your problems. Use a dummy Activity which does literally nothing, only loads libLauncher.so in onCreate(). – Alex Cohn Dec 20 '18 at 21:33
  • Alright fair. I'm really unfamiliar with adding Java so I'll figure that out. – Mike Weir Dec 20 '18 at 21:35

1 Answers1

0

Unable to load native library: /data/app/com.myapp.test-2/lib/arm/libLauncher.so

Newer NDK does not support this path anymore. You need to ensure that your ABIs are x86, x86_64, armeabi-v7a, arm64-v8a. i.e. paths should be something like below:

/data/app/com.myapp.test-2/lib/arm64-v8a/libLauncher.so
shizhen
  • 12,251
  • 9
  • 52
  • 88
  • Yea, I noticed that as well but wondered if the system was mapping it or something. If that is the case and it can't find it, and considering I'm using Tegra's tools, do you have any idea where it could be getting that path? (just thinking I could do a file search for it, but it would surprise me to find it hah.) – Mike Weir Dec 20 '18 at 04:12