Android Studio not recognizing Facebook SDK - android

In build.gradle:
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
In my code:
import com.facebook.AccessToken;
import com.facebook.AccessTokenTracker;
import com.facebook.login.LoginManager;
I don't think this was an issue before, but all of the sudden today it's saying "cannot resolve symbol" for all of the import statements and so lots of things in my code are now wrongly marked as errors, even though when I run my app it works fine. What could be causing this?

tools>android>sync project files with gradle files

Try this:
Ctrl+Shift+Alt+S->selectApp->Dependandies->select"+"->moduledependandies->choose facebooksdk

Related

"Cannot resolve symbol 'design' " error on Android Studio [duplicate]

This question already has answers here:
error can not resolve symbol TabLayout and 'design
(4 answers)
Closed 4 years ago.
Using these three lines:
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.design.widget.Toolbar;
I get the following error:
Cannot resolve symbol 'design'.
How do I solve this problem? Are there any files that I'm missing?
You need to include the library in your Gradle app's file:
compile 'com.android.support:design:26.0.1'
There is a link to help you include librarys in your project
You need to add the com.android.support:design library, following the instructions for adding artifacts from the Support Library to your project.
Had same issue with support-v4 library, when in Android Studio I had this issue, but everything worked fine in command line
For me nothing of below worked:
1. File - Invalidate Caches / Restart...
2. Aligning support versions with compile version
The only thing helped me is:
1. Close project
2. Remove all Andoroid Studio related files: .gradle, *.iml, .idea
3. Import project again
Try to this ..
add below dependecy into app level gradle file ..
implementation 'com.android.support:design:27.1.1'
import android.widget.Toolbar;
import android.support.design.widget.Snackbar;
import android.support.design.widget.FloatingActionButton;

Cannot resolve PlaceAutocompleteFragment with 10.2.0

I'm trying to add a PlaceAutocompleteFragment to my activity, this are all the imports I'm using:
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlaceAutocompleteFragment;
import com.google.android.gms.location.places.ui.PlaceSelectionListener;
I was following this tutorial, so initially my app gradle had compile 'com.google.android.gms:play-services-location:8.4.0' with this version all the imports above work perfect, but I want to use a newer version.
The problem is that with compile 'com.google.android.gms:play-services-location:10.2.0' none of the imports work and it cannot resolve any of those classes. Same for 9.4.0.
I have clean, rebuild and re sync the project but the error persists.
What could be wrong?
I'm using Android Studio with
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
Places has split out into its own library since the tutorial was written
Add
compile 'com.google.android.gms:play-services-places:10.2.4'

Android : Google Cloud Messaging Error

I'm following a tutorial and I've pulled the google gms git repository.
I'm getting an error "cannot resolve symbol android" when I import
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.gcm.GoogleCloudMessaging;
I have updated google play services. Here's my gradle -
...
compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
Where am I going wrong??
Try This code. It's very simple and easy steps.
Link: https://github.com/googlesamples/google-services/tree/master/android/gcm/app/src/main/java/gcm/play/android/samples/com/gcmquickstart
Hope it works for you.
Check the base package and make sure the gradle is updated

Error package `com.google.android.gms...` doesn't exist

I am new to Android development. I am learning to use Parse.com backend service and get stuck early on.
I am following tutorial to create application that uses Google Maps Android API v2. What I've done :
download sample
project from parse
Import AnyWall-android\Anywall folder from downloaded project to Android Studio
Rebuild project
Then I get a bunch of errors here :
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap.CancelableCallback;
import com.google.android.gms.maps.GoogleMap.OnCameraChangeListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.Circle;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
common, location, and maps highlighted red. The question is how to resolve these errors?
I appreciate any kind of help or direction (What should I check? Is it about missing library? If it is, what library should I add and where to get it?)
Can't find the class com.google.android.gms.location.LocationClient (android)
There is some problem with the last GPS lib. You have to use an older version than the latest(6.+). Try with an older version. I didn't see anything inside the doc deprecated or missing about the LocationClient.class...
compile 'com.google.android.gms:play-services:5.+'
I think the best solution is, add compile API on your Gradle. services-location has this method.
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.google.android.gms:play-services-location:9.8.0'
if you wish to include other services, please refer here:
https://developers.google.com/android/guides/setup (scroll down)
Google Play Services is now modular, you can select the packages you want from it.
To get analytics add:
compile 'com.google.android.gms:play-services-analytics:7.3.0'
to you build.gradle's dependencies section
P.S
replace 7.3.0 with new version as they arrive, or replace with "+" to always get the latest
Android Studio is complaining that it can't find the Play Services library.
Follow the steps here to ensure Google Play Services SDK is installed (specifically, make sure 'Google Repository' is installed along with 'Google Play Services'): http://developer.android.com/google/play-services/setup.html#Install
Then, make sure the following is added to the dependencies{} block in your build.gradle:
compile 'com.google.android.gms:play-services:+'
Clean and rebuild.
Add this line you build.gradle in Gradle Scripts folder
dependencies {
compile 'com.google.android.gms:play-services:11.2.0'
}
with this i solved this issue.
Previous answers were correct.
But in gradle:3.0 the compile configuration is now deprecated and should be replaced by implementation or api.
Check out more information in the documentation - API and implementation separation.
Its just a common mistake in my case, I just remove default ""flutter:"" keyword in pubspec file while managing package

Errors in Android Studio, works on device

I've got a weird issue with Android Studio. A number of import statements like
import com.google.android.gms.gcm.GoogleCloudMessaging;
import com.loopj.android.http.AsyncHttpClient;
They fail on the gcm and loopj parts. Yet if I build and run the project it works fine.
I've including them into my build.gradle.
dependencies {
compile ('com.android.support:support-v4:13.0.0', 'com.google.android.gms:play-services:3.1.36')
compile files('/libs/android-async-http-1.4.3.jar', '/libs/CWAC-SackOfViewsAdapter.jar')
}
Anyone have any idea why I'm getting the errors in the IDE?
I made a new project, and pasted in my files, and it worked fine. I guess this is a the problem with using software in beta :P.

Categories

Resources