Android Studio could not find any version that matches come.google.maps - android

My gradle seems to be complaining that it Could not find any version that matches com.google.maps.android:android-maps-utils:+.
Gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
}
signingConfigs {
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
productFlavors {
}
}
dependencies {
compile 'com.google.android.gms:play-services:4.+'
compile 'com.android.support:support-v4:19.1.+'
compile 'com.google.maps.android:android-maps-utils:+'
compile project(':libraries:facebook')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/svg-android.jar')
}

you havn't declared a repository for your project, just for the buildscript stuff.
try adding a first level repository block
repositories {
jcenter()
}

Related

Error:Failed to resolve: com.google.android.gms

Error:Failed to resolve: com.google.android.gms:play-services-basement:[11.0.4]
Error:Failed to resolve: com.google.android.gms:play-services-tasks:[11.0.4]
When i used android studio 2.3.2 version my project build successfully but after updated to android studio version to 2.3.3 and updated google play services i am getting this error please help.
There is no play-services-basement and play-services-tasks folder in my folder
when i comment this "compile 'com.google.android.gms:play-services-location:11.0.4'" line my project compiling fine if i uncomment then my project not compiling
Project Gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
repositories {
jcenter()
}
}
ext {
compileSdkVersion = 25
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
minSdkVersion = 14
targetSdkVersion = 25
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "package"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
debuggable true
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.github.beyka:androidtiffbitmapfactory:0.9.6.2'
debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
}
project gradle file:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}

Android Build Gradle giving complie() error

I am facing this error for a long time now..
Error:(24, 0) Could not find method compile() for arguments
[com.google.code.gson:gson:2.3] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
My root build.gradle is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
//apply plugin: 'com.android.application'
//
//android {
// compileSdkVersion 23
// buildToolsVersion '23.0.0'
//}
And my module/build.gradle is
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.zumoappname"
minSdkVersion 7
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'aars'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.microsoft.azure:azure-mobile-android:3.1.0'
compile (group: 'com.microsoft.azure', name: 'azure-notifications-handler', version: '1.0.1', ext: 'jar')
}
Could somebody please direct me in the correct direction..
And before this I received a similar error for "android method"..
I googled a lot but was not of much use.
Thanks in advance:)
It seems that your file has some issue.
The structure should be:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig { ... }
buildTypes {
release {...}
}
}
repositories { .. }
dependencies {
//..
}
Move the repositories block outside the android block.

Android Studio and protobuf Error:(7, 0) Plugin with id 'com.google.protobuf' not found

I want to use grpc in Android Studio, but failed in gradle setting.
my gradle plugin version is 2.1.2. I have installed gradle 2.14.
In my app\build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
apply plugin: "com.google.protobuf"
defaultConfig {
applicationId "com.example.test.test_20"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
jniDebuggable true
}
}
buildscript {
repositories {
maven {
mavenCentral()
}
}
dependencies {
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.0"
}
}
protobuf {
protoc {
// The version of protoc must match protobuf-java. If you don't depend on
// protobuf-java directly, you will be transitively depending on the
// protobuf-java version that grpc depends on.
artifact = "com.google.protobuf:protoc:3.0.0"
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.0.0'
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'io.grpc:grpc-okhttp:1.0.0'
compile 'io.grpc:grpc-protobuf-lite:1.0.0'
compile 'io.grpc:grpc-stub:1.0.0'
}
Gradle sync message output is
Error:(7, 0) Plugin with id 'com.google.protobuf' not found.
What is wrong in my setting?
I create a new empty project, and app/build.gradle file:
apply plugin: 'com.android.application'
apply plugin: "com.google.protobuf"
buildscript {
repositories {
maven {
//mavenCentral()
url 'https://repo1.maven.org/maven2'
}
}
dependencies {
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.0"
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.test.testprotobuf"
minSdkVersion 15
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:design:23.4.0'
}
And gradle-wrapper.properties file:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip
I excute "gradlew build" command successfully.
And sync gradle, it prompt that “Error:(2, 0) Cause: org/gradle/api/internal/file/collections/DefaultDirectoryFileTreeFactory
” 。
Something wrong in your build.gradle. You have to move some parts:
apply plugin: 'com.android.application'
apply plugin: "com.google.protobuf"
buildscript {
repositories {
maven {
mavenCentral()
}
}
dependencies {
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.0"
}
}
android {
}
you must add the following code in the build.gradle(the project's build.gradle, not the app's):
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// for gRPC
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.0"
}}

Robospock and gradle build variants?

I'm using Robospock to perform unit testing and mocking with gradle. This worked great until I added gradle build variants to the mix.
My android build.gradle file:
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
uat {
packageName "com.acme.dev"
}
stage {
packageName "com.acme.staging"
}
prod {
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.mcxiaoke.volley:library:1.0.4'
}
My robospock build.gradle file:
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
classpath 'org.robospock:robospock-plugin:0.4.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'groovy'
dependencies {
compile "org.codehaus.groovy:groovy-all:1.8.6"
compile 'org.robospock:robospock:0.4.4'
compile 'cglib:cglib-nodep:2.2'
compile 'org.objenesis:objenesis:1.3'
}
project.ext {
robospock = ":Mothership" // project to test
}
apply plugin: 'robospock'
The Android gradle plug-in offers me build variant tasks such as assembleProd, assembleProdDebug, assembleStageDebugTest. Can I pass something to Robospocl in my build.gradle so that it can participate in the build variants?
Currently when I execute ./gradlew robospok, it cannot find the classes defined in com.acme.dev or com.acme.staging

Import remote library from Maven

I'm trying to add both Showcaseview by amlcurran and Android-DirectoryChooser by passy to my android app from MavenCentral, but I keep getting this error for both libraries:
Error:net.rdrei.android.dirchooser:library:2.0
This is my Project Gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
This is the inner one:
apply plugin: 'android'
android {
lintOptions {
checkReleaseBuilds false
}
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 6
versionName "1.2.2"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'org.jaudiotagger:jaudiotagger:2.0.1#jar'
compile 'com.android.support:support-v4:19.1.0'
compile 'net.rdrei.android.dirchooser:library:2.0#aar'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
How can I fix it?
The problem is that you are not specifying the repository URL. Check my answer here:
https://stackoverflow.com/a/23879736/570612

Categories

Resources