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
Related
I am trying to connect Android Studio with Firebase and I have some red lines and I don't know why. I am following instruction from this tutorial : https://www.youtube.com/watch?v=tOn5HsQPhUY
Could someone please tell me if I am doing something wrong and what?
Here is a picture of this
the Problem is that these commands are from an older firebase Version.
I recommend to take a look at the docs here:https://firebase.google.com/docs/database/android/start/
Try this code :
private DatabaseReference mRef;
mRef = FirebaseDatabase.getInstance().getReference();
You forgot to add dependencies for Firebase and maybe you forgot to take the latest Google Repository.
Place your specific dependency:
compile 'com.google.firebase:firebase-messaging:9.6.0'
Add import com.firebase.client.Firebase; in class and add compile 'com.firebase:firebase-client-android:2.5.0' in app (build.gradle)
Import the following:
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
guys i also had the same problem were i could not use Firebase class when trying to define a variable
try this
go to your App level build.gradle in the dependencies add
compile 'com.firebase:firebase-client-android:2.5.0
for some having newer versions of android you can replace compile with implementation
I am getting error in Android Studio. My import:
imports com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
are not working.
Use
import com.google.android.gms.common.api.GoogleApiClient;
instead of imports to import a class.
Download new version of google-play-services library.
Always update/download newest version of google-play-services library.
you must add
compile 'com.google.android.gms:play-services-location:7.8.0'
in dependencies block, in app/build.gradle.
also update google play in sdk manager
I am creating android application 'GoogleCloudMessaging'. I Have found many that 'GcmListenerService' is being used and the old method 'GCMIntentService' is now deprecated.
I have already install the Google Play service and add it into the dependency.
But when i try to import
import com.google.android.gms.gcm.GcmListenerService;
it gives error "cannot resolve symbol."
How can I import the Class?
I refer https://developers.google.com/android/reference/com/google/android/gms/gcm/GoogleCloudMessaging and
https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmListenerService.html#GcmListenerService()
and follow the things but still unable to solve the problem.
If you have already added Google Play Services to your dependencies, the issue might be its version.
Try to update the line(in your build.gradle) to:
compile 'com.google.android.gms:play-services:7.5.0'
Then sync your project.
You must include
compile 'com.google.android.gms:play-services-gcm:11.0.4'
in your build.gradle file.
I have been migrating my project from Eclipse to Android Studio. For my GCM, my server code is not compiling and the import cannot be found for
import com.google.android.gcm.server.Message;
import com.google.android.gcm.server.Result;
import com.google.android.gcm.server.Sender;
Does anyone know the gradle compile line to include? The docs have no suggestion. They have a suggestion for the client side as
compile "com.google.android.gms:play-services:3.1.+"
I need one for my app-engine server.
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