How to run Facebook Sample Apps on Android Studio 1.0.1 - java

I've been trying to run the Facebook SDK sample apps (Scrumptious, FriendPickerSample, etc.) but to no avail. I had a folder called 'samples' within the Facebook SDK folder that I imported as a project. I then was able to run any of the sample apps within the Android Studio window. However whenever I ran one of the app I would get 100 errors and 12 warnings:
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()
This seems odd to me because all these errors are coming from the facebook sdk such as Session.java. Here's a screenshot of my project view:
http://i.stack.imgur.com/sxlN4.png
Thanks in advance.

Okay,I am quiet new at this
but I think your Project doesn't have the support-v4 library.
Its the library that is being used by facebook for fragments and Broadcast Managers in your Project.
You can use the facebook Login button without a Fragment but its advised to use it with fragments
just add the following line in your Gradle build dependencies
compile 'com.android.support:support-v4:22.0.+'
i think it should work

Related

cannot find symbol symbol: class Base64 location: package java.util

I followed this tutorial to show web cam with the help of server.
But , It not done.
error
Error:(5, 17) java: cannot find symbol
symbol: class Base64
location: package java.util
Error:(93, 45) java: cannot find symbol
symbol: variable Base64
location: class WebcamWebSocketHandler
Why this error occurs?
Error:(5, 17) java: cannot find symbol
symbol: class Base64
location: package java.util
line 5 import java.util.Base64;
Error:(93, 45) java: cannot find symbol
symbol: variable Base64
location: class WebcamWebSocketHandler
Line 93 base64 = new String(Base64.getEncoder().encode(baos.toByteArray()), "UTF8");
code
error at line 93
I am using java 14.
How can I solve this error?

JOGL errors on compilation

I am working with JOGL and it stopped working completely.
These are the errors i get:
Texture01.java:27: error: cannot access WriteCloneable
canvas = new GLCanvas(glcapabilities);
^
class file for com.jogamp.common.type.WriteCloneable not found
.\Texture01_GLEventListener.java:2: error: package com.jogamp.common.nio does not exist
import com.jogamp.common.nio.*;
^
.\Texture01_GLEventListener.java:136: error: cannot find symbol
FloatBuffer fb = Buffers.newDirectFloatBuffer(vertices);
^
symbol: variable Buffers
location: class Texture01_GLEventListener
.\Texture01_GLEventListener.java:163: error: cannot find symbol
IntBuffer ib = Buffers.newDirectIntBuffer(indices);
^
symbol: variable Buffers
location: class Texture01_GLEventListener
4 errors
The Path and Classpath variables are correct, I reinstalled JDK and JOGL2 but still get an error with WriteClonable and com.jogamp.common.nio.*
Any help is appreciated!

Receiving Java error "cannot find symbol" in MVC package

Sorry, I'm sure this is some rookie istake I'm making but I have a MVC pattern package which keeps returning this errors to me:
======================================
hrms.java:22: error: cannot find symbol
hrmsModel HRMSModel = new hrmsModel();
^
symbol: class hrmsModel
location: class HRMS
hrms.java:22: error: cannot find symbol
hrmsModel HRMSModel = new hrmsModel();
^
symbol: class hrmsModel
location: class HRMS
hrms.java:24: error: cannot find symbol
hrmsView view = new hrmsView(HRMSModel);
^
symbol: class hrmsView
location: class HRMS
hrms.java:24: error: cannot find symbol
hrmsView view = new hrmsView(HRMSModel);
^
symbol: class hrmsView
location: class HRMS
4 errors
=======================================
Would really appreciate if you could tell me what I was doing wrongly here...Thanks in advance! I've added the code for the main package of my class hrms MVC gui below, for your reference.
hrmsModel HRMSModel = new hrmsModel();
seems like its not arrange properly.
I think the right arrarangement is this YourClass yourVariable = new YourClass()
First, check if you have the classes hrmsModel and hrmsView in the same package as HRMS. If you don't have them, you should import them.
On a side note, it's best if you follow the Java naming convention and name your class HRMSModel and your variable hrmsModel. If you are following that convention, then you might be confusing the order of both and that's why the compiler complains.
Syntax for object creation is:
ClassName instanceName = new ClassName();
So change this
hrmsModel HRMSModel = new hrmsModel();
to:
HRMSModel hrmsModel = new HRMSModel();
Under hrms package you have HRMS* java, but you are trying to create object for hrms* classes.
Change name and execute.

Sublime Text and java project on Mac

I am trying to make Sublime work with Java. I know there is a lot of tutorials but all of them for Windows. I was going through this one but it is for processing and it doesn't work wit imports. http://blog.boreal-kiss.net/2012/10/27/processing-with-sublime-text-2/
I am just starting with Java and using ACMStarterProject with acm.jar.
http://www.stanford.edu/class/archive/cs/cs106a/cs106a.1124/assignments.html
What I want:
use sublime to build and run
use imports and package libraries
use java 7
I think I need to write a skript and make some changes to JavaC.sublime-build?
Thanks
Here is what I get in console:
Users/romangorshkov/Documents/Eclipse/workspace/ACMStarterProject/CircleArea.java:8: error: package acm.program does not exist
import acm.program.*;
^
/Users/romangorshkov/Documents/Eclipse/workspace/ACMStarterProject/CircleArea.java:11: error: cannot find symbol
public class CircleArea extends ConsoleProgram {
^
symbol: class ConsoleProgram
/Users/romangorshkov/Documents/Eclipse/workspace/ACMStarterProject/CircleArea.java:16: error: cannot find symbol
println("This program calculates a circle area.");
^
symbol: method println(String)
location: class CircleArea
/Users/romangorshkov/Documents/Eclipse/workspace/ACMStarterProject/CircleArea.java:17: error: cannot find symbol
int r = readInt("Enter circle radius: ");
^
symbol: method readInt(String)
location: class CircleArea
/Users/romangorshkov/Documents/Eclipse/workspace/ACMStarterProject/CircleArea.java:20: error: cannot find symbol
println("Circle area is: " +area);
^
symbol: method println(String)
location: class CircleArea
5 errors
[Finished in 2.2s with exit code 1]
[shell_cmd: javac "/Users/romangorshkov/Documents/Eclipse/workspace/ACMStarterProject/CircleArea.java"]
[dir: /Users/romangorshkov/Documents/Eclipse/workspace/ACMStarterProject]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

"error: package org.apache.commons.math3.random does not exist"?

I'm trying to compile a java code as in the following line :
javac -classpath /Users/tim/kws/code/library:/Users/moab/kws/code/commons-cli-1.2/commons-cli-1.2.jar:/Users/tim/kws/code/commons-math-2.2/commons-math-2.2.jar:/Users/tim/kws/code/common-math3-3.1.1/commons-math3-3.1.1.jar RATSWriteLandmarksFromPfile.java
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:17: error: package org.apache.commons.math3.random does not exist
import org.apache.commons.math3.random.RandomDataImpl;
^
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:50: error: cannot find symbol
private RandomDataImpl randomData_;
^
symbol: class RandomDataImpl
location: class LabelPfile
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:321: error: cannot find symbol
randomData_ = new RandomDataImpl();
^
symbol: class RandomDataImpl
location: class LabelPfile
3 errors
does anybody know why am I getting these errors ?
Seems like you are missing the commons-math3 library.

Categories

Resources