[SOLVED] [plugin/Facebook/android] build.xml: Cannot find: build_common.xml

I’m trying to integrate the Facebook plugin into fresh new cocos-js 3.7 project.
Following steps from: http://cocos2d-x.org/docs/manual/framework/html5/facebook-sdk/facebook-sdk-on-android/en
and also from my existing 3.5 project where this plugin works well.

When compiling I get this error:

BUILD FAILED
/Applications/adt-bundle-mac-x86_64-20130729/sdk/tools/ant/build.xml:470: The following error occurred while executing this line:
/pp/src/shared_js/cocos/3.7/frameworks/cocos2d-x/plugin/protocols/proj.android/build.xml:90: Cannot find /pp/src/shared_js/cocos/3.7/frameworks/cocos2d-x/plugin/protocols/proj.android/${plugin.dir}/tools/android/build_common.xml imported from /pp/src/shared_js/cocos/3.7/frameworks/cocos2d-x/plugin/protocols/proj.android/build.xml

The last line in cocos2d-x/plugin/protocols/proj.android/build.xml has:

<!-- version-tag: 1 -->
<import file="${plugin.dir}/tools/android/build_common.xml" />

which causes the problem.

Where do I define the search path for the ant imports?

My Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2djs_shared

LOCAL_MODULE_FILENAME := libcocos2djs

LOCAL_SRC_FILES := hellojavascript/main.cpp \
                   ../../Classes/AppDelegate.cpp 

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes

##############################################################################################################
# Library lists
##############################################################################################################

# <Pp> this prevents bugs with += and :=
#
LOCAL_STATIC_LIBRARIES :=
LOCAL_WHOLE_STATIC_LIBRARIES :=

# cocos 3.7
#
LOCAL_STATIC_LIBRARIES += cocos2d_js_static

# plugin: ALL (JS & C++)
# plugin: FB
#
# <REF> /pp/dev-cpp/libs/cocos2d-js-v3.5/samples/js-tests/project/proj.android/jni/Android.mk
#
LOCAL_STATIC_LIBRARIES += jsb_pluginx_static


# plugin: ALL (JS & C++)
# plugin: FB
#
LOCAL_WHOLE_STATIC_LIBRARIES += PluginProtocolStatic

##############################################################################################################
# Flags, etc.
##############################################################################################################


# cocos 3.7
#
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT

# cocos 3.7
#
include $(BUILD_SHARED_LIBRARY)


##############################################################################################################
# Module search paths
##############################################################################################################


# Pp: believed to be required by plugins and also some other staff...
#
$(call import-add-path,$(LOCAL_PATH)/../../../../frameworks/cocos2d-x/plugin/publish)
$(call import-add-path,$(LOCAL_PATH)/../../../../frameworks/cocos2d-x/external)
$(call import-add-path,$(LOCAL_PATH)/../../../../frameworks/cocos2d-x/cocos)

# Pp (after upgrade to cocos 3.7)
#
$(call import-add-path,$(LOCAL_PATH)/../../../../frameworks)

# Soomla (also generic)
#
$(call import-add-path,$(LOCAL_PATH)/../../../../frameworks/cocos2d-x)

##############################################################################################################
# Import Modules
##############################################################################################################

# cocos 3.7
#
$(call import-module, scripting/js-bindings/proj.android)


# plugin: ALL (JS)
# plugin: FB
#
# <REF> /pp/dev-cpp/libs/cocos2d-js-v3.5/samples/js-tests/project/proj.android/jni/Android.mk
#
#
$(call import-module,cocos2d-x/plugin/jsbindings)


# plugin: ALL (C++)
# plugin: FB
#
# <REF> /pp/src/shared_js/cocos/3.5/frameworks/js-bindings/cocos2d-x/plugin/samples/HelloPlugins/proj.android/jni/Android.mk
#
$(call import-module,plugin/protocols/proj.android/jni)

Solved with the following steps. Likely it is not a correct way because it involves manual modification of local.properties but it works.

1. bug

/Applications/adt-bundle-mac-x86_64-20130729/sdk/tools/ant/build.xml:470: The following error occurred while executing this line:
/pp/src/shared_js/cocos/3.8/frameworks/cocos2d-x/plugin/protocols/proj.android/build.xml:90: Cannot find /pp/src/shared_js/cocos/3.8/frameworks/cocos2d-x/plugin/protocols/proj.android/${plugin.dir}/tools/android/build_common.xml imported from /pp/src/shared_js/cocos/3.8/frameworks/cocos2d-x/plugin/protocols/proj.android/build.xml

fix:

	$ vi /pp/src/shared_js/cocos/3.8/frameworks/cocos2d-x/plugin/protocols/proj.android/local.properties

	# add this line
	plugin.dir=../..

2. bug

/Applications/adt-bundle-mac-x86_64-20130729/sdk/tools/ant/build.xml:470: The following error occurred while executing this line:
/pp/src/shared_js/cocos/3.8/frameworks/cocos2d-x/plugin/plugins/facebook/proj.android/build.xml:90: Cannot find /pp/src/shared_js/cocos/3.8/frameworks/cocos2d-x/plugin/plugins/facebook/proj.android/${plugin.dir}/tools/android/build_common.xml imported from /pp/src/shared_js/cocos/3.8/frameworks/cocos2d-x/plugin/plugins/facebook/proj.android/build.xml

fix

	$ vi /pp/src/shared_js/cocos/3.8/frameworks/cocos2d-x/plugin/plugins/facebook/proj.android/local.properties

	# add this line
	plugin.dir=../../..

thanks buddy :slight_smile: