1

我正在尝试使用facebook 的 buck 构建系统构建 Android 应用程序,但Build Failed出现错误。

我在MACWINDOWS上都遇到了同样的错误

降压配置文件

[cache]
  mode = dir

[cxx]
  default_platform = iphonesimulator-x86_64
  cflags = -g -std=c11
  cxxflags = -g -std=c++14
  # Many ARC APIs don't compile with separate preprocess and compile.
  combined_preprocess_and_compile = true

[alias]
  demo_app_android = //android:demo-app
  demo_app_ios = //ios:BuckDemoApp

[apple]
  xctool_zip_target = //third-party/ios/xctool:xctool-minimal-zip

[ndk]
  ndk_version = 16.1.4479499
  app_platform = android-26

[android]
  build_tools_version = 26.0.2
  target = Google Inc.:Google APIs:26

[java]
  src_roots = /android/java/
  source_level = 7
  target_level = 7

[project]
    default_android_manifest = //android/AndroidManifest.xml
    ignore = .buckd, \
             .hg, \
             .git, \
             .idea, \
             buck-cache, \
             buck-out, \

环境变量:

$ env | grep ANDROID_
ANDROID_HOME=<path>/Android/sdk
ANDROID_NDK_REPOSITORY=<path>/Android/sdk/ndk-bundle
ANDROID_SDK=<path>/Library/Android/sdk

错误堆栈跟踪:

Building: finished in 0.0 sec
  Total time: 0.0 sec
BUILD FAILED: No native platforms detected. Probably Android NDK is not configured properly.

我没有得到我所缺少的。感谢你的帮助。

谢谢

4

2 回答 2

2

Try older version of NDK (15 or older) and make sure /Android/sdk/ndk-bundle contains a directory with that version so it looks like /Android/sdk/ndk-bundle/android-ndk-r15.

于 2017-12-20T17:58:51.850 回答
1

我在尝试构建示例 Android APP 时遇到了同样的错误。我尝试了几件事来清楚地了解 .buckconfig 设置和环境变量的行为。

设置 ndk_path

你可以直接设置ndk路径。我已经设置了这个变量而不是设置 ndk_version(例如 'r10e') 请记住

The environment variables ANDROID_NDK and NDK_HOME both supercede the buckconfig setting.

Create a repo folder (recommended)

Download ndk bundle and unzip it into a folder that serves as a repository folder and set it to ANDROID_NDK_REPOSITORY env var. So the path can be used to get the correct ndk version. In this case only thing you have to do is setting the version of NDK bundle and buck will automatically get the right version for you.

Currently there is error with Buck with the Java9.

Just to add more. If you are using java9 then downgrade to java8 as buck uses the sun/misc/BASE64Encoder which is removed in java9.

To keep versions of java8 and java9 in mac. I have implemented below command lines in .bash_profile.

export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_9_HOME=$(/usr/libexec/java_home -v9)

alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java9='export JAVA_HOME=$JAVA_9_HOME'

#default java8
export JAVA_HOME=$JAVA_8_HOME
于 2017-12-17T04:33:57.333 回答