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'
Related
In my gradle.properties I have this:
android.useAndroidX=true
When I Make Project, I get BUILD SUCCESSFUL. From Android Studio, I go to Refactor > Migrate to AndroidX... I am getting 15 references in 9 files to be changed:
Reading https://medium.com/androiddevelopers/migrating-to-androidx-tip-tricks-and-guidance-88d5de238876, I see that the step 1 of the recommended approach to migrate is to Update to Support Library version 28. In order to do that, I want to know what Support Library version the code of my app is at. Where can I see that? In some of my .java files I have found the following:
import android.support.annotation.NonNull;
import android.support.v4.app.NotificationCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v4.content.ContextCompat;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.support.multidex.MultiDex;
In my app\build.gradle I have this: implementation 'com.android.support:multidex:1.0.3'.
Do any of the lines above reveals or helps to reveal the Support Library version that the code of my app is at? Thank you.
What it means is that they suggest upgrading all of the possible support libraries to 28.0.
Those are basically anything that starts with com.android.support:
e.g.:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
The recommendation there is so the migration in the AS will have to do minimal guessing on how to migrate it.
So to stricly answer your question, the version you use is the version you have in gradle.files.
I am building an Android app and am using Material3 Theme Builder. I am able to export my custom theme as a zip with Theme.kt. I add it to my folder and made sure to update my package name because Theme.kt defaults to com.example.ui.Theme . I am running into some import issues with material3. Here is the imports in my header.
import androidx.compose.material.MaterialTheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.material3.darkColorScheme
I also tried to add the latest version of com.google.android.material.material 1.8.0-alpha01
into my gradle file but it breaks some other imports in some of my other files like
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
Before I changed anything in my gradle file my implementation line looked like this.
implementation "androidx.compose.material:material:$compose_version"
I am compiling on SDK 32 and the newest version of Gradle and Android Studio Dolphin. Any suggestions on what I could do to properly import material3?
To use Compose M3 you should add this dependency in your build.gradle:
implementation "androidx.compose.material3:material3:$material3_version"
Currently the latest version is 1.0.0-beta03.
Then you have to import the classes in the material3 package, for example:
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
Finally:
com.google.android.material.material 1.8.0-alpha01
This dependency is the Material Components for Android and it is not related to Compose.
This is what ended up working for me.
dependencies {
implementation 'com.google.android.material:material:1.8.0-alpha01'
implementation "androidx.compose.material3:material3:1.0.0-beta03"
I added these to my build.gradle file.
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
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 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