我試圖將Facebook Android SDK(4.25.0)集成到我的應用程序中。如果我在Android Studio中使用Gradle構建,一切正常。
如果我與我的AOSP(Android開放源代碼項目)源代碼集成,它不起作用。沒有編譯錯誤。但是當我打電話
FacebookSdk.sdkInitialize(this.getApplicationContext());
//if I didn't call this method, it gave me another exception said
'The SDK has not been initialized, make sure to call
FacebookSdk.sdkInitialize() first.'
我有以下異常:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/R$style;
at com.facebook.FacebookSdk.<clinit>(FacebookSdk.java:84)
我的MK文件看起來像:
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/v7/appcompat/res
LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/v7/gridlayout/res
LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/design/res
LOCAL_RESOURCE_DIR += prebuilts/sdk/current/support/v7/cardview/res
LOCAL_STATIC_JAVA_AAR_LIBRARIES := facebook-android-sdk
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
facebook-android-sdk:libs/facebook-android-sdk-4.25.1.aar \
bolts-android:libs/bolts-android-1.4.0.jar
什麼建議嗎?提前致謝。
它表明異常來自何處。 – user3034559