Buck - java.lang.UnsatisfiedLinkError: couldn't find "libjni.so". How to solve it?
Buck - java.lang.UnsatisfiedLinkError: couldn't find "libjni.so". How to solve it?
执行命令后出现运行时异常
buck install --run demo_app_android
关注 this tutorial and this 示例演示
然后控制台显示如下
Installing apk on emulator-5554 (null).
[-] PROCESSING BUCK FILES...FINISHED 0.0s [100%] File removed
[-] DOWNLOADING... (0.00 B/S AVG, TOTAL: 0.00 B, 0 Artifacts)
[-] BUILDING...FINISHED 0.8s [100%] (1/1 JOBS, 1 UPDATED, 0 [0.0%] CACHE MISS)
[+] INSTALLING...2.1s
Successfully ran install apk //android:demo-app on 1 device(s)
Starting activity com.facebook.buck.demo/.App...
Successfully ran start activity on 1 device(s)
最后,设备 显示一条消息说 Buck Demo App has stopped
该应用程序已成功安装,正如我在应用程序列表中看到的那样,但它无法运行
堆栈跟踪:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.facebook.buck.demo, PID: 7265
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.facebook.buck.demo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.facebook.buck.demo-1/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libjni.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:972)
at java.lang.System.loadLibrary(System.java:1530)
at com.facebook.buck.demo.Hello.<init>(Hello.java:13)
at com.facebook.buck.demo.App.onCreate(App.java:24)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
设备规格:
- 本机 Android 模拟器(另外,运行 将其放入真实设备中,结果相同)
- 连结 5 API 24
我的电脑:
- MacBook pro 2012 年中期
注意:此外,此问题已直接报告给 buck repository,但尚未给出解决方案
知道如何解决吗?
重复github的答案:
您需要从 here (version 10e) and set ANDROID_NDK_REPOSITORY
to the location of the unpacked NDK (see buckconfig 部分安装 Android NDK 以获得更多信息。
比如你解压NDK到~/tmp/ndk
(这样就有一个目录~/tmp/ndk/android-ndk-r10e
),你需要把ANDROID_NDK_REPOSITORY
设置成~/tmp/ndk
。
之后删除旧缓存并重建应用程序:
$ buck kill && rm -rf buck-out
$ buck build demo_app_android
执行命令后出现运行时异常
buck install --run demo_app_android
关注 this tutorial and this 示例演示
然后控制台显示如下
Installing apk on emulator-5554 (null).
[-] PROCESSING BUCK FILES...FINISHED 0.0s [100%] File removed
[-] DOWNLOADING... (0.00 B/S AVG, TOTAL: 0.00 B, 0 Artifacts)
[-] BUILDING...FINISHED 0.8s [100%] (1/1 JOBS, 1 UPDATED, 0 [0.0%] CACHE MISS)
[+] INSTALLING...2.1s
Successfully ran install apk //android:demo-app on 1 device(s)
Starting activity com.facebook.buck.demo/.App...
Successfully ran start activity on 1 device(s)
最后,设备 显示一条消息说 Buck Demo App has stopped
该应用程序已成功安装,正如我在应用程序列表中看到的那样,但它无法运行
堆栈跟踪:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.facebook.buck.demo, PID: 7265
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.facebook.buck.demo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.facebook.buck.demo-1/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libjni.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:972)
at java.lang.System.loadLibrary(System.java:1530)
at com.facebook.buck.demo.Hello.<init>(Hello.java:13)
at com.facebook.buck.demo.App.onCreate(App.java:24)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
设备规格:
- 本机 Android 模拟器(另外,运行 将其放入真实设备中,结果相同)
- 连结 5 API 24
我的电脑:
- MacBook pro 2012 年中期
注意:此外,此问题已直接报告给 buck repository,但尚未给出解决方案
知道如何解决吗?
重复github的答案:
您需要从 here (version 10e) and set ANDROID_NDK_REPOSITORY
to the location of the unpacked NDK (see buckconfig 部分安装 Android NDK 以获得更多信息。
比如你解压NDK到~/tmp/ndk
(这样就有一个目录~/tmp/ndk/android-ndk-r10e
),你需要把ANDROID_NDK_REPOSITORY
设置成~/tmp/ndk
。
之后删除旧缓存并重建应用程序:
$ buck kill && rm -rf buck-out
$ buck build demo_app_android