4

buck install --run demo_app_android按照教程和示例演示执行命令后发生运行时异常

然后,控制台中显示如下

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 存储库,但尚未给出解决方案

关于如何解决它的任何想法?

4

1 回答 1

1

重复来自github的答案:

您需要从此处安装 Android NDK (版本 10e)并设置ANDROID_NDK_REPOSITORY为解压后的 NDK 的位置(有关详细信息,请参阅buckconfig部分)。

例如,如果你将 NDK 解压到~/tmp/ndk(这样就有一个目录~/tmp/ndk/android-ndk-r10e),你需要设置ANDROID_NDK_REPOSITORY~/tmp/ndk.

之后删除旧缓存并重建应用程序:

$ buck kill && rm -rf buck-out
$ buck build demo_app_android
于 2017-06-15T22:50:17.597 回答