我一直试图运行Facebook SDK示例应用程序(Scrumptious,FriendPickerSample等),但无济于事。我有一个名为' samples'在我作为项目导入的Facebook SDK文件夹中。然后,我就可以在Android Studio窗口中运行任何示例应用程序。但是每当我运行其中一个应用程序时,我会得到100个错误和12个警告:
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\Session.java
Error:(24, 30) java: package android.support.v4.app does not exist
Error:(25, 34) java: package android.support.v4.content does not exist
Error:(1065, 62) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.Session
Error:(1090, 62) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.Session
Error:(1916, 36) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.Session.AuthorizationRequest
Error:(2129, 28) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.Session.OpenRequest
Error:(2233, 38) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.Session.NewPermissionsRequest
Error:(2255, 38) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.Session.NewPermissionsRequest
Warning:(28, 22) java: android.webkit.CookieSyncManager in android.webkit has been deprecated
Error:(1017, 58) java: reference to OpenRequest is ambiguous, both constructor OpenRequest(android.app.Activity) in com.facebook.Session.OpenRequest and constructor OpenRequest(Fragment) in com.facebook.Session.OpenRequest match
Error:(1044, 17) java: reference to OpenRequest is ambiguous, both constructor OpenRequest(android.app.Activity) in com.facebook.Session.OpenRequest and constructor OpenRequest(Fragment) in com.facebook.Session.OpenRequest match
Error:(1570, 9) java: cannot find symbol
symbol: variable LocalBroadcastManager
location: class com.facebook.Session
Error:(2121, 13) java: reference to AuthorizationRequest is ambiguous, both constructor AuthorizationRequest(android.app.Activity) in com.facebook.Session.AuthorizationRequest and constructor AuthorizationRequest(Fragment) in com.facebook.Session.AuthorizationRequest match
Error:(2223, 13) java: reference to AuthorizationRequest is ambiguous, both constructor AuthorizationRequest(android.app.Activity) in com.facebook.Session.AuthorizationRequest and constructor AuthorizationRequest(Fragment) in com.facebook.Session.AuthorizationRequest match
Error:(2245, 13) java: reference to AuthorizationRequest is ambiguous, both constructor AuthorizationRequest(android.app.Activity) in com.facebook.Session.AuthorizationRequest and constructor AuthorizationRequest(Fragment) in com.facebook.Session.AuthorizationRequest match
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\AppEventsLogger.java
Error:(24, 34) java: package android.support.v4.content does not exist
Error:(26, 13) java: package bolts does not exist
Error:(809, 13) java: cannot find symbol
symbol: variable LocalBroadcastManager
location: class com.facebook.AppEventsLogger
Error:(1000, 30) java: cannot find symbol
symbol: variable AppLinks
location: class com.facebook.AppEventsLogger
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\widget\FacebookDialog.java
Error:(27, 30) java: package android.support.v4.app does not exist
Error:(320, 13) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.widget.FacebookDialog
Error:(324, 47) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.widget.FacebookDialog
Error:(513, 62) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.widget.FacebookDialog
Error:(575, 19) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.widget.FacebookDialog.Builder<CONCRETE>
Error:(629, 37) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.widget.FacebookDialog.Builder<CONCRETE>
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\widget\FacebookFragment.java
Error:(21, 30) java: package android.support.v4.app does not exist
Error:(42, 32) java: cannot find symbol
symbol: class Fragment
Error:(48, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.FacebookFragment
Error:(49, 45) java: cannot find symbol
symbol: method getActivity()
location: class com.facebook.widget.FacebookFragment
Error:(46, 5) java: method does not override or implement a method from a supertype
Error:(59, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.FacebookFragment
Error:(60, 58) java: cannot find symbol
symbol: method getActivity()
Error:(57, 5) java: method does not override or implement a method from a supertype
Error:(65, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.FacebookFragment
Error:(63, 5) java: method does not override or implement a method from a supertype
Error:(266, 55) java: cannot find symbol
symbol: method getActivity()
location: class com.facebook.widget.FacebookFragment
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\internal\SessionTracker.java
Error:(23, 34) java: package android.support.v4.content does not exist
Error:(37, 19) java: cannot find symbol
symbol: class LocalBroadcastManager
location: class com.facebook.internal.SessionTracker
Error:(76, 33) java: cannot find symbol
symbol: variable LocalBroadcastManager
location: class com.facebook.internal.SessionTracker
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\widget\PickerFragment.java
Error:(24, 30) java: package android.support.v4.app does not exist
Error:(25, 30) java: package android.support.v4.app does not exist
Error:(26, 34) java: package android.support.v4.content does not exist
Error:(55, 69) java: cannot find symbol
symbol: class Fragment
Error:(120, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.PickerFragment<T>
Error:(118, 5) java: method does not override or implement a method from a supertype
Error:(133, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.PickerFragment<T>
Error:(131, 5) java: method does not override or implement a method from a supertype
Error:(152, 5) java: method does not override or implement a method from a supertype
Error:(185, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.PickerFragment<T>
Error:(187, 45) java: cannot find symbol
symbol: method getActivity()
location: class com.facebook.widget.PickerFragment<T>
Error:(207, 41) java: cannot find symbol
symbol: method getView()
location: class com.facebook.widget.PickerFragment<T>
Error:(183, 5) java: method does not override or implement a method from a supertype
Error:(223, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.PickerFragment<T>
Error:(221, 5) java: method does not override or implement a method from a supertype
Error:(234, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.PickerFragment<T>
Error:(232, 5) java: method does not override or implement a method from a supertype
Error:(248, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.PickerFragment<T>
Error:(243, 5) java: method does not override or implement a method from a supertype
Error:(253, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.PickerFragment<T>
Error:(251, 5) java: method does not override or implement a method from a supertype
Error:(568, 16) java: cannot find symbol
symbol: method getString(int)
location: class com.facebook.widget.PickerFragment<T>
Warning:(654, 25) java: setBackgroundDrawable(android.graphics.drawable.Drawable) in android.view.View has been deprecated
Warning:(676, 31) java: setBackgroundDrawable(android.graphics.drawable.Drawable) in android.view.View has been deprecated
Error:(884, 38) java: package LoaderManager does not exist
Error:(883, 51) java: cannot find symbol
symbol: method getLoaderManager()
location: class com.facebook.widget.PickerFragment<T>.LoadingStrategy
Error:(941, 24) java: bad operand types for binary operator '!='
first type: com.facebook.widget.GraphObjectPagingLoader<T>
second type: <nulltype>
Error:(947, 24) java: bad operand types for binary operator '!='
first type: com.facebook.widget.GraphObjectPagingLoader<T>
second type: <nulltype>
Error:(958, 51) java: cannot find symbol
symbol: method getActivity()
location: class com.facebook.widget.PickerFragment<T>.LoadingStrategy
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\widget\GraphObjectPagingLoader.java
Error:(21, 34) java: package android.support.v4.content does not exist
Error:(27, 62) java: cannot find symbol
symbol: class Loader
Error:(108, 13) java: cannot find symbol
symbol: method isStarted()
location: class com.facebook.widget.GraphObjectPagingLoader<T>
Error:(109, 13) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.GraphObjectPagingLoader<T>
Error:(103, 5) java: method does not override or implement a method from a supertype
Error:(119, 9) java: cannot find symbol
symbol: variable super
location: class com.facebook.widget.GraphObjectPagingLoader<T>
Error:(117, 5) java: method does not override or implement a method from a supertype
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\widget\LikeView.java
Error:(27, 34) java: package android.support.v4.content does not exist
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\internal\LikeActionController.java
Error:(24, 34) java: package android.support.v4.content does not exist
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\internal\Utility.java
Warning:(31, 22) java: android.webkit.CookieSyncManager in android.webkit has been deprecated
Warning:(563, 9) java: android.webkit.CookieSyncManager in android.webkit has been deprecated
Warning:(563, 41) java: android.webkit.CookieSyncManager in android.webkit has been deprecated
Warning:(564, 20) java: sync() in android.webkit.CookieSyncManager has been deprecated
Warning:(581, 22) java: removeExpiredCookie() in android.webkit.CookieManager has been deprecated
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\FacebookAppLinkResolver.java
Error:(21, 13) java: package bolts does not exist
Error:(22, 13) java: package bolts does not exist
Error:(23, 13) java: package bolts does not exist
Error:(24, 13) java: package bolts does not exist
Error:(37, 49) java: cannot find symbol
symbol: class AppLinkResolver
Error:(48, 32) java: cannot find symbol
symbol: class AppLink
location: class com.facebook.FacebookAppLinkResolver
Error:(58, 12) java: cannot find symbol
symbol: class Task
location: class com.facebook.FacebookAppLinkResolver
Error:(58, 17) java: cannot find symbol
symbol: class AppLink
location: class com.facebook.FacebookAppLinkResolver
Error:(80, 12) java: cannot find symbol
symbol: class Task
location: class com.facebook.FacebookAppLinkResolver
Error:(80, 26) java: cannot find symbol
symbol: class AppLink
location: class com.facebook.FacebookAppLinkResolver
Error:(182, 27) java: package AppLink does not exist
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\UiLifecycleHelper.java
Error:(25, 34) java: package android.support.v4.content does not exist
Error:(56, 19) java: cannot find symbol
symbol: class LocalBroadcastManager
location: class com.facebook.UiLifecycleHelper
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\BoltsMeasurementEventListener.java
Error:(8, 34) java: package android.support.v4.content does not exist
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\widget\LoginButton.java
Error:(30, 30) java: package android.support.v4.app does not exist
Error:(91, 13) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.widget.LoginButton
Error:(630, 29) java: cannot find symbol
symbol: class Fragment
location: class com.facebook.widget.LoginButton
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\AuthorizationClient.java
Warning:(654, 17) java: android.webkit.CookieSyncManager in android.webkit has been deprecated
Warning:(654, 49) java: android.webkit.CookieSyncManager in android.webkit has been deprecated
Warning:(655, 28) java: sync() in android.webkit.CookieSyncManager has been deprecated
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\widget\WebDialog.java
Warning:(391, 30) java: setSavePassword(boolean) in android.webkit.WebSettings has been deprecated
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\android\Facebook.java
Error:(308, 43) java: reference to OpenRequest is ambiguous, both constructor OpenRequest(android.app.Activity) in com.facebook.Session.OpenRequest and constructor OpenRequest(Fragment) in com.facebook.Session.OpenRequest match
Error:(959, 21) java: reference to OpenRequest is ambiguous, both constructor OpenRequest(android.app.Activity) in com.facebook.Session.OpenRequest and constructor OpenRequest(Fragment) in com.facebook.Session.OpenRequest match
C:\Users\Randall\Documents\AppDevelopment\SDKs\facebook-android-sdk-3.21.1\facebook\src\com\facebook\widget\PlacePickerFragment.java
Error:(264, 37) java: cannot find symbol
symbol: method getActivity()
location: class com.facebook.widget.PlacePickerFragment
Error:(280, 14) java: cannot find symbol
symbol: method onAttach(android.app.Activity)
Error:(283, 58) java: cannot find symbol
symbol: method getActivity()
location: class com.facebook.widget.PlacePickerFragment
Error:(278, 5) java: method does not override or implement a method from a supertype
Error:(293, 58) java: cannot find symbol
symbol: method getActivity()
location: class com.facebook.widget.PlacePickerFragment
Error:(320, 16) java: cannot find symbol
symbol: method getString(int)
location: class com.facebook.widget.PlacePickerFragment
Error:(325, 64) java: cannot find symbol
symbol: method getActivity()
&#13;
这对我来说似乎很奇怪,因为所有这些错误都来自facebook sdk,例如Session.java。这是我的项目视图的屏幕截图:
http://i.stack.imgur.com/sxlN4.png
提前致谢。
答案 0 :(得分:1)
好的,我很安静 但我认为您的项目没有support-v4库。 它是Facebook用于项目中的片段和广播管理器的库。 您可以使用没有片段的Facebook登录按钮,但建议将其与片段一起使用
只需在Gradle构建依赖项
中添加以下行compile&#39; com.android.support:support-v4:22.0。+&#39;
我认为它应该有用