I am working on a code that was made in the Eclipse and i am migrating to Android Studio, however i am having a problem to the to import
com.google.android.maps.GeoPoint;
but i can import
com.google.android.gms.maps.GoogleMap;
I've tried to add in my Gradle file
compile 'com.google.android.gms:play-services:6.5.87'
and also i've tried also to use .jar, however i didn't have good results.
compile files('libs/google-play-services.jar')
I searched about this in many places, but i found nothing to help me, case somebody have resolved this problem and want help me i thank you.
To work, i had that to replace the below line in the my Gradle file.
android {
...
compileSdkVersion 16
...
}
To
android {
...
compileSdkVersion "Google Inc.:Google APIs:16"
...
}
Please following all the steps to Add Google Play Services to Your Project
in Android Studio
:
1.Open the build.gradle
file inside your application module directory.
Note: Android Studio projects contain a top-level build.gradle file and a build.gradle file for each module. Be sure to edit the file for your application module. See Building Your Project with Gradle for more information about Gradle.
2.Add a new build rule under dependencies for the latest version of play-services. For example:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
}
Be sure you update this version number each time Google Play services is updated.
Note: If the number of method references in your app exceeds the 65K limit
, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them. For information on how to do this, see Selectively compiling APIs into your executable.
3.Save the changes and click Sync Project with Gradle Files
in the toolbar.
4.Open your app's manifest file and add the following tag as a child of the element:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
You can now begin developing features with the Google Play services APIs
.
Please refer to here for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With