In the Android SDK Manager, I am unable to find the Google API for API Level 25. Because of this I am unable to set the compileSdkVersion to 'Google Inc.:Google APIs:25'. I am using MapActivity in my application and due to incompatible sdk version com.google.android is not supported.Is there any other way to make this work without Google API ?
You need to enable "Show Package Details" from SDK manager to see the available api levels. By default, this option is disabled from Android Studio 2.3.
Try this, it's useful for you:
apply plugin: 'com.android.application'
dependencies {
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.android.gms:play-services-location:11.2.0'
}
Few days ago had same problem and have tried
dependencies {
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.android.gms:play-services-location:11.2.0'
}
but I keep getting error, so therfore I tried
dependencies {
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
}
although it is old version but worked for me so I suggest you to try.
Hopefully, you are looking for this. If you are unable to use API then use this compile for setting up.
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.google.android.gms:play-services:11.2.0'
}
for further read, this Google Play Service may helpful
Edit1 also, use this compile for using map API
com.google.android.gms:play-services-maps:11.2.0
You would then need to compile it direct from the site. So edit the dependencies in the build gradle file:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.5.87'
}
You can try this. Hope it works.
You can make maps in Eclipse then sync maps files with rest of application files in Android Studio or you can directly change your application files in Android Studio according to steps given in following link.
For Eclipse follow these steps
MapActivity is part of Google Maps API v1. And Google Maps API v1 is deprecated long time ago https://developers.google.com/maps/documentation/android-api/v1. It still worked till now but seems to be missing since SDK 25.
So we have to transition to Google Maps API v2 https://developers.google.com/maps/documentation/android-api/start. It's distributed as a part of Google Play Services library so you don't have to build with Google API to use it. You just need to add gradle dependensites as mentioned in previous answers. You also need to stop using deprecated MapActivity and start using new MapFragment.
© 2022 - 2024 — McMap. All rights reserved.