My Android studio is giving me errors when I try to compile, it has been working since for sometime now but recently it gives me this error:
Could not find any matches for com.android.tools.build:gradle:+ as no versions of com.android.tools.build:gradle are available.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
https://jcenter.bintray.com/com/android/tools/build/gradle/
file:/Users/macbook/.m2/repository/com/android/tools/build/gradle/maven-metadata.xml
file:/Users/macbook/.m2/repository/com/android/tools/build/gradle/
Required by:
unspecified:unspecified:unspecified
Add maven { url "https://dl.bintray.com/android/android-tools/" } to you android/build.gradle:
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
Related
What went wrong:
A problem occurred configuring project ':react-native-vector-icons'.
Could not resolve all files for configuration ':react-native-vector-icons:classpath'.
Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are available.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
https://jcenter.bintray.com/com/android/tools/build/gradle/
Required by:
project :react-native-vector-icons
Try below workaround
subprojects {
if (project.name.contains('react-native-vector-icons')) {
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
you should try again today as the jCenter services were taken down due to some miscommunication. Now all the packages are restored.
I had an issue with gradle thinking I wanted multidex 1.0.2 so I setup the repository in the top level build file and moved it out of the buildscript (as per: Android Studio 3.0 Beta 1: Failed to resolve: com.android.support:multidex:1.0.2):
allprojects {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}
However, Fabric seems to dislike this. In the buildscript sections of my project (and library) I have:
buildscript {
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
And now I get:
Error:Could not find any matches for io.fabric.tools:gradle:1.+ as no versions of io.fabric.tools:gradle are available.
Searched in the following locations:
file:/Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/io/fabric/tools/gradle/maven-metadata.xml
file:/Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/io/fabric/tools/gradle/
https://jcenter.bintray.com/io/fabric/tools/gradle/maven-metadata.xml
https://jcenter.bintray.com/io/fabric/tools/gradle/
Required by:
project :
How can I resolve this conflict? How to I specify to fabric, if not in all projects, where to get its own dependencies?
Error:Could not find any matches for io.fabric.tools:gradle:1.+ as no versions of io.fabric.tools:gradle are available.
It happens since gradle is looking for the plugin only in the jcenter repo.
To setup fabric you have to use it:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
It is required by the gradle plugin.
Then you have to add:
repositories {
maven { url 'https://maven.fabric.io/public' }
}
It is used by the dependencies added in the projects.
A colleague managed to resolve it with the following declaration in the app's build.gradle file:
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
}
a few days ago i have installed android studio 3.0 (preview) and after that in stable version (studio 2.3.3) when i try to import project it give me an error.
In preview everything works fine.
this is an error:
Error:Could not find com.android.tools.build:gradle:3.0.0-alpha4.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar
Required by:
project :
If you're opening an existing project using Android Studio 3.0 Preview
1 or later, follow the prompts to automatically update your project to
the latest version of the Android plugin. To manually update your
project, include the maven repo and change the plugin version in your
project-level build.gradle file as follows:
Open your Project level build.gradle Section .
You should add maven { url 'https://maven.google.com' } .
Example
buildscript {
repositories {
jcenter()
// You need to add the following repository to download the new plugin.
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4' // Same for alpha6
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
A better way may be just to use
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
I have downloaded realm example projects from Github
I Imported that project.
Finally I got this below error.
Realm Gradle 'examples' project refresh failed
Error:Could not find io.realm:realm-gradle-plugin:1.2.0-SNAPSHOT.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/maven-metadata.xml
file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/realm-gradle-plugin-1.2.0-SNAPSHOT.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/realm-gradle-plugin-1.2.0-SNAPSHOT.jar
file:/Users/govindaraj/.m2/repository/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/maven-metadata.xml
file:/Users/govindaraj/.m2/repository/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/realm-gradle-plugin-1.2.0-SNAPSHOT.pom
file:/Users/govindaraj/.m2/repository/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/realm-gradle-plugin-1.2.0-SNAPSHOT.jar
https://jcenter.bintray.com/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/realm-gradle-plugin-1.2.0-SNAPSHOT.pom
https://jcenter.bintray.com/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/realm-gradle-plugin-1.2.0-SNAPSHOT.jar
https://jitpack.io/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/maven-metadata.xml
https://jitpack.io/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/realm-gradle-plugin-1.2.0-SNAPSHOT.pom
https://jitpack.io/io/realm/realm-gradle-plugin/1.2.0-SNAPSHOT/realm-gradle-plugin-1.2.0-SNAPSHOT.jar
Required by:
io.realm:encryptionExample:1.2.0-SNAPSHOT
How can I solve this?
If you cloned our entire repo, you need to run ./gradlew assemble from the top-level directory first. It could probably be stressed more in our README
Make sure you have the snapshot repository in your build.gradle
buildscript {
repositories {
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
classpath "io.realm:realm-gradle-plugin:<version>-SNAPSHOT"
}
}
repositories {
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
I'm setting up a Cordova project with Fabric to enable signing in with Twitter. I just installed Fabric plug-in into Android Studio but when I sync Gradle files I get the following error:
Information:Gradle tasks [:generateDebugSources, :generateDebugTestSources]
Error:A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.squareup.picasso:picasso:2.3.2.
Searched in the following locations:
https://maven.fabric.io/public/com/squareup/picasso/picasso/2.3.2/picasso-2.3.2.pom
https://maven.fabric.io/public/com/squareup/picasso/picasso/2.3.2/picasso-2.3.2.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:tweet-ui:1.0.3
> Could not find com.android.support:support-v4:21.0.0.
Searched in the following locations:
https://maven.fabric.io/public/com/android/support/support-v4/21.0.0/support-v4-21.0.0.pom
https://maven.fabric.io/public/com/android/support/support-v4/21.0.0/support-v4-21.0.0.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:tweet-ui:1.0.3
> Could not find com.squareup.retrofit:retrofit:1.6.1.
Searched in the following locations:
https://maven.fabric.io/public/com/squareup/retrofit/retrofit/1.6.1/retrofit-1.6.1.pom
https://maven.fabric.io/public/com/squareup/retrofit/retrofit/1.6.1/retrofit-1.6.1.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:twitter-core:1.1.1
> Could not find com.google.code.gson:gson:2.2.4.
Searched in the following locations:
https://maven.fabric.io/public/com/google/code/gson/gson/2.2.4/gson-2.2.4.pom
https://maven.fabric.io/public/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:twitter-core:1.1.1
Android SDK updater gives me Support Library 21.0.3 but not 21.0.0, as suggested here by Hemal from Fabric: Android Twitter Fabric SDK conflict with support library
I have no idea about those other libraries, though. Any thoughts?
Please follow this code example to make sure your build.gradle file is similar:
buildscript {
repositories {
jcenter() // <- *add this
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
// The Fabric Gradle plugin uses an open ended version to
// react quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application' // <- *make sure this is the same
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
repositories {
jcenter() // <- *add this
maven { url 'https://maven.fabric.io/repo' }
}
I had the same issue, spent half a day on this until opened twitters official documentation and came across this:
https://dev.twitter.com/twitter-kit/android/integrate
Too many answers by the Fabric team on SO and other forums that did not work. This works.
Change jcenter() to mavenCentral() or you can keep both jcenter and mavenCentral
also change url from https://maven.fabric.io/repo to https://maven.fabric.io/public
buildscript {
repositories {
mavenCentral() // <- *add this
maven { url 'https://maven.fabric.io/public' }
}
}
It's not enough to install the fabric plugin, you have to use it too. Clicking on the fabric button in Android Studio guides you through the process of including twitter fabric in your app, it even modifies the build.gradle properly for you (with your permission of course). When you follow the steps given, your build.gradle would be looking like what #AlexVPerl's answer says.
Other answers were outdated for me. I fixed the problem by updating build.gradle according to the latest on the github:
https://github.com/twitter/twitter-kit-android