gpt4 book ai didi

android - Cordova 3.4 Facebook 连接,添加库

转载 作者:太空狗 更新时间:2023-10-29 14:15:07 26 4
gpt4 key购买 nike

我更新到 Cordova 3.4 并想使用最新版本的 facebook connect ( https://github.com/phonegap/phonegap-facebook-plugin ) 插件。我按照那里的步骤操作。

但是我没有用eclipse开发。所以我需要通过命令行添加 Facebook 库。

我按照步骤 of Abdullah in this post .

我的文件夹结构:

+ platforms
+ android
...
+ plugins
+ ...
+ facebook-android-sdk-3.8.0
+ facebook
...

我在 platforms/android/ 中运行了这个命令:

android update project --target 3 --path . --library ../../facebook-android-sdk-3.8.0/facebook/

但现在我遇到了以下错误:

facebook-android-sdk-3.8.0/facebook/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var

在使用 cordova build android 构建期间,您知道我该如何解决这个问题吗?

我的 platforms/android/project.properties 看起来像这样:

...
# Project target.
target=android-18
android.library.reference.1=CordovaLib
android.library.reference.2=../../facebook-android-sdk-3.8.0/facebook/

我的 platforms/android/local.properties 看起来像这样:

...
# header note.
sdk.dir=/Users/<username>/Development/adt-bundle-mac-x86_64/sdk

这也是正确的。

cordova build android的完整输出:

cordova build android
[ReferenceError: a is not defined]
Running command: /Users/<username>/App_Entwicklung/20/<application>/platforms/android/cordova/build args=[]
Buildfile:/Users/<username>/App_Entwicklung/20/<application>/platforms/android/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK Tools Revision 22.6.2
[checkenv] Installed at /Users/<username>/Development/adt-bundle-mac-x86_64/sdk

-setup:
[echo] Project Name: <application>20
[gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 19.0.3
[echo] Resolving Build Target for <application>20...
[gettarget] Project Target: Android 4.3
[gettarget] API level: 18
[echo] ----------
[echo] Creating output directories if needed...
[echo] ----------
[echo] Resolving Dependencies for <application>20...
[dependency] Library dependencies:
[dependency]
[dependency] ------------------
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...

BUILD FAILED
/Users/<username>/Development/adt-bundle-mac-x86_64/sdk/tools/ant/build.xml:601: The following error occurred while executing this line:
/Users/<username>/App_Entwicklung/20/<application>/facebook-android-sdk-3.8.0/facebook/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var

Total time: 0 seconds
Error code 1 for command: ant with args: debug,-f,/Users/<username>/App_Entwicklung/20/<application>/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/<username>/App_Entwicklung/20/<application>/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)

最佳答案

问题不在您的实际项目中,而是在 android Facebook SDK 中,并且发生是因为 FacebookSDK android 项目无法找到 Android SDK。

修复它:

  1. 导航到您的 FacebookSDK 文件夹(对我来说是 facebook-android-sdk-3.8.0/facebook)并查找 project.properties 文件。

  2. 编辑此文件并指定 sdk 的路径(就像您为核心项目所做的那样)。sdk.dir=/Users//Development/adt-bundle-mac-x86_64/sdk

  3. 保存并重建。

关于android - Cordova 3.4 Facebook 连接,添加库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22913089/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com