Using Google Maps API in Android Studio - android

Hey guys I've installed the SDK for google play services and have added the dependancies however I still get the error:
Failed to find: com.google.android.gms:play-services-maps:6.5+
Is there something I'm missing?
Heres my dependencies file:
apply plugin: 'com.android.application'
apply plugin: 'android'
android {
compileSdkVersion 21
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "team08.httpapp"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.google.android.gms:play-services-maps:6.5.+'
}

Make sure the "Google Repository" is installed in your SDK manager.

Based on this Google blog post:
http://android-developers.blogspot.co.at/2014/12/google-play-services-and-dex-method.html
I would remove compile 'com.google.android.gms:play-services:6.5.+' and change the other line to compile 'com.google.android.gms:play-services-maps:6.5.87'.

Related

Cannot resolve method: CameraSource.Builder.setAutoFocusEnabled

I use Vision API to scan barcode. It's almost done, except auto-focus. I follow the guide in this link: https://developers.google.com/android/reference/com/google/android/gms/vision/CameraSource.Builder, use setAutoFocusEnabled method and get an error: "Cannot resolve method 'setAutoFocusEnabled(boolean)'"
My Android studio version: 2.1.1
JRE: 1.8.0
file build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "***"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:7.8+'
}
You are reading newer documentation than the library you are using.
If you want the newer features, then upgrade.
Replace com.google.android.gms:play-services:7.8+
With com.google.android.gms:play-services-vision:10.0.0, or some other, later version than 7.8.
See about selective compilation. It will make your app smaller, and build faster.

Android Studio prevent build API23, I want only API22

How can I stop building for API23? I have many libraries, reduced probably all to API22 from API23. Still I have problems, when want to sync my gradle, it is showing errors in V23 styles.
Is there a way to disable building V23? I don't want to use API23. Don't tell me to update my project to API23 because in my app, permission checking is not necessary. It's inside company app (not for Google Play) and permission dialogs are not necessary.
This is error
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Here is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.pongodev.layartancepapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 2
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:22.1.0'
compile('com.mikepenz:materialdrawer:4.4.6#aar') {
transitive = true
}
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
testCompile 'junit:junit:4.12'
compile 'com.mcxiaoke.volley:library:1.0.0'
compile 'com.github.mrengineer13:snackbar:1.0.0'
compile 'com.marshalchen.ultimaterecyclerview:library:0.3.18'
compile 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
compile 'com.mikepenz:google-material-typeface:2.2.0.3.original#aar'
compile 'com.github.AndroidDeveloperLB:MaterialPreferenceLibrary:1'
}
You can define compileSdkVersion and buildToolsVersion to 22 in build.gradle
compileSdkVersion = 'Google Inc.:Google APIs:22'
buildToolsVersion = "22.0.0"
These steps works for you:
1.Click build.gradle
2.Change compileSdkVersion 23 to 22
3.Change targetSdkVersion 23 to 22
follow pics
See Picture for clear understanding

Android gradle sync error-Could not create an instance of Tooling API implementation

I recently installed android studio 2.1.2 and I am getting this error:
Error:Could not create an instance of Tooling API implementation using the specified Gradle distribution 'https://services.gradle.org/distributions/gradle-2.10-all.zip'.
I used to have 1.3.1 previously but I opened it recently after a while and it was showing the same error so I decided to do a fresh installation but the error persists.
Here is what the build.gradle file looks like for the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.example.sanchitverma.myapplication"
minSdkVersion 23
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}

Unable to sync gradle

I get error messages when I try to add recyclerview and cardview dependencies to my build.gradle. Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.truewebdev.applytheme"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support.recyclerview-v7:23.2.0'
compile 'com.android.support.cardview-v7:23.2.0'
}
Here are the error messages:
If I try to install repository, I get the following:
What is wrong here?
Did you download the Android Support Repository from the SDK Manager?
From android docs:
Make sure you have downloaded the Android Support Repository using the SDK Manager.
http://developer.android.com/tools/support-library/setup.html#libs-with-res

App won't run unless you update google play services - Android Studio

Im currently using android studio 1.5. My problem is when I try to run my google maps activity in my emulator, it kept showing the prompt "App wont run unless you update google play services". What now?
Here is my Build.gradle
apply plugin: 'com.android.application'
android
{
compileSdkVersion 21
buildToolsVersion "23.0.2"
defaultConfig
{
applicationId "com.farmmanagementsystem.farmmanagementapp"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes
{
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:8.3.0'
}

Categories

Resources