Cannot resolve method: CameraSource.Builder.setAutoFocusEnabled - android

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.

Related

android plugin issue, asks to update, but already updated all

I know this has been asked before as well, but I have done all I can.
I have updated all I can from SDK manager, but still I am getting this issue with my project that I just created.
There is no functionality I have given yet, but the issue says the plugin is too old, please update or change the ANDROID_DAILY_ENVIRONMENT variable.
This is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.manav.loginapp"
minSdkVersion 21
targetSdkVersion 24
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:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
}

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

Cannot resolve symbols in Android Studio and the code is okay

I know that this question was asked here a few times, but everything i have tried from answers they gave there didn't work for me.
Also i need to mention that i have tried File - Invilidate Cache and Restart and it didn't work..
Here is my build gradle(Maybe something there is wrong):
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.dusandimitrijevic.geomondo"
minSdkVersion 19
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'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2'
}
I see three issues.
Your targetSdkVersion is higher than your compileSdkVersion.
You are using a version of the support library that requires a minimum of API 22 to compile with.
You are not specifying the version of recyclerview, so it will import the latest one, which requires API 23 to compile with.
The fix is to set compileSdkVersion to 23. That SHOULD fix your missing symbols issue.

Using Google Maps API in Android Studio

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'.

Categories

Resources