In my project, I'm trying to use the design support library. I have in my Gradle file:
dependencies {
....
compile 'com.android.support:design'
....
}
And when I try to build this, I get the error:
Normally I would just click Install Repository and sync project, however, this seems to not work anymore. Clicking this does absolutely nothing, even though clicking Open File works fine.
How can I manually install it?
I have the latest Android Support Repository (30.0.0), and Android Support Library (23.2.1) installed.
For me the solution was to add maven in the allprojects section. From the setup document: https://developer.android.com/topic/libraries/support-library/setup.html
in the project level settings.gradle file.
allprojects {
repositories {
jcenter()
maven{
url "https://maven.google.com"
}
}
}
Then double check the document for the latest version.
In the app level of the settings.gradle file add:
dependencies{
compile 'com.android.support:design:26.0.1'
}
And use Gradle to sync the project.
I think it is because you've not specified the version.
compile 'com.android.support:design:23.1.1'
change version to what you have downloaded.
You can go File->Settings->Gradle Look at the "Offline work" inbox,
If it's checked you can uncheck and try to sync again.
Related
I am using facebook sdk in my project. Facebook SDK works fine till yesterday. but today when I open my project , the build failed and shows error as follows
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not resolve com.facebook.android:facebook-android-sdk:[4,5).
Required by:
project :app
> Could not resolve com.facebook.android:facebook-android-sdk:[4,5).
> Failed to list versions for com.facebook.android:facebook-android-sdk.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
> Could not GET 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
> jcenter.bintray.com
> Could not resolve com.facebook.android:facebook-android-sdk:[4,5).
> Failed to list versions for com.facebook.android:facebook-android-sdk.
> Unable to load Maven meta-data from https://jitpack.io/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
> Could not GET 'https://jitpack.io/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
> jitpack.io
I tries clean & build and also inavalidate caches .but nothing worked. Also tries some stackoverflow solutions. none of them worked for me
this my repository in build.gradle
repositories {
jcenter()
mavenCentral()
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
Follow the below procedure to resolve the issue:-
Click on Project Structure from the icon available in the tool bar above.
Open Dependencies tab.
select
com.facebook.android:facebook-android-sdk:[4,5)
Remove the facebook dependency by clicking the minus(-) button on the extreme right side.
Now, Click on Plus(+) button on the right side above Minus button. Select Library dependency
Type Facebook on the search input box and click on the search button.
Choose com.facebook.android:facebook-login. click on Ok.
Sync your Gradle.
This will resolve your issue. As it has worked for me.
Use this dependency for Facebook SDK. It will work. (Tested on Android Studio version 3.0 and above)
implementation 'com.facebook.android:facebook-login:4.30.0'
remove compile 'com.facebook.android:facebook-android-sdk:[4,5)'
And add below dependency it resolve my problem
compile 'com.facebook.android:facebook-android-sdk:4.26.0'
If your react-native version is >= 9.3.0+ you can solve this issue by just removing and adding some lines:
1)Remove this line from app/build.gradle ===>
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
2)Add this line in app/build.gradle ===>
implementation 'com.facebook.android:facebook-android-
sdk:latest.release'
3)Add this in android/build.gradlew
allprojects {
repositories {
google()
mavenLocal()
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral(). <====== Add this
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
4)At the end run gradlew clean command
In the file android/build.gradle try to replace each jcenter() with gradlePluginPortal()
If you are using android studio below 3.0 version then
Try this:
Replace the dependency compile 'com.facebook.android:facebook-android-sdk:4.26.0'
Try below, works perfect for me
implementation 'com.facebook.android:facebook-android-sdk:[4,5]'
try to add
implementation 'com.facebook.android:facebook-core:[8,9)'
implementation 'com.facebook.android:facebook-login:[8,9)'
Remove the dependencies and then just re-add the dependencies one by one. Finally Clean Build the Project and it should work.
A Studio or a library update may sometimes cause this type of issue.
Add this to Module-level /app/build.gradle before dependencies:
repositories {
// You can also use jcenter if you prefer
mavenCentral()
}
Add the compile dependency you need with the latest version of the Facebook SDK in the build.gradle file:
dependencies {
// Facebook SDK Core only (Analytics)
compile 'com.facebook.android:facebook-core:[5,6)'
// Facebook Login only
compile 'com.facebook.android:facebook-login:[5,6)'
// Facebook Share only
compile 'com.facebook.android:facebook-share:[5,6)'
// Facebook Places only
compile 'com.facebook.android:facebook-places:[5,6)'
// Facbeook Messenger only
compile 'com.facebook.android:facebook-messenger:[5,6)'
// Facebook App Links only
compile 'com.facebook.android:facebook-applinks:[5,6)'
// Facebook Android SDK (everything)
compile 'com.facebook.android:facebook-android-sdk:[5,6)'
// Audience Network SDK.
compile 'com.facebook.android:audience-network-sdk:[5,6)'
// Account Kit
compile 'com.facebook.android:account-kit-sdk:[5,6)'
}
Worked for me:
implementation 'com.facebook.android:audience-network-sdk:5.5.0'
Release implementation 'com.facebook.android:facebook-login:[5,6)' with implementation 'com.facebook.android:facebook-login:5.15.1'
Try the below dependency. It worked for me
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
Earlier I had different versions of facebook-android-sdk:[5,6) & facebook-applinks:[4,5). I made it the same version and it seems to build (facebook-applinks:[5,6)).
Just go to file -> re-import gradle project if you use Intelij or Android studio. I think it's a pretty simple solution. it worked for me.
1- Make a search in google like this : facebook audience network sdk download
2- Go to the first result : https://developers.facebook.com/docs/audience-network/guides/adding-sdk/android
3- See the section of Manual download
4- You will find the latest version number (for example here : 6.0.0 or 5.11.0)
5- Add the dependency like this in your build.gradle(:app) :
implementation 'com.facebook.android:audience-network-sdk:6.2.1'
Had same issue, fixed it by changing
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
to
implementation 'com.facebook.android:facebook-android-sdk:4.30.0'
in app/build.gradle
I imported a project from my work-space. After this some errors were shown which I can't solve.
The message
Install Repository and sync project
was shown as a link, but clicking on it didn't solve my problem.
Add ConstraintLayout to your project.
To use ConstraintLayout in your project, proceed as follows:
Ensure you have the "maven.google.com" repository declared in your
module-level build.gradle file:
repositories {
maven {
url 'https://maven.google.com'
}
}
Add the library as a dependency in the same build.gradle file:
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
In the toolbar or sync notification, click Sync Project with Gradle Files.
The constraintLayout is not available yet on any stable relase of Android Studio. You have to download the latest Android Studio Preview to use it.
I'm trying to add the support libraries to my app by putting this in the dependencies section of build.gradle:
compile 'com.android.support:appcompat-v7:20.0.+'
This works fine in all my libgdx apps except for one of them. It simply cannot find the library. It says:
Error:Could not find any version that matches com.android.support:appcompat-v7:20.0.+.
Searched in the following locations:
file:/C:/Users/MyName/.m2/repository/com/android/support/appcompat-v7/maven-metadata.xml
file:/C:/Users/MyName/.m2/repository/com/android/support/appcompat-v7/
https://repo1.maven.org/maven2/com/android/support/appcompat-v7/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/appcompat-v7/
https://oss.sonatype.org/content/repositories/snapshots/com/android/support/appcompat-v7/maven-metadata.xml
https://oss.sonatype.org/content/repositories/snapshots/com/android/support/appcompat-v7/
https://oss.sonatype.org/content/repositories/releases/com/android/support/appcompat-v7/maven-metadata.xml
https://oss.sonatype.org/content/repositories/releases/com/android/support/appcompat-v7/
I tried this with the Android support libraries as well, and they have the same issue.
local.properties is pointing to the android sdk just as it is in my other projects.
I see that its searching the Android SDK's local Maven repository for it. But the directory as listed above in the error does not exist. The .m2/repository directory exists with some of my other local stuff, but not the android one. And since this is working fine in my other projects, I'm not sure what could be going on. Perhaps they are checking a different local Maven repository?
I recently installed Maven so I could create my own local repository for use when working on a library project. Maybe I somehow overwrote the original android directory? Doesn't explain why the other old libgdx projects are not failing to find the library though. How can I check where they are searching for it?
Here's the build script (generated by libgdx project generator):
buildscript {
repositories {
jcenter()
maven { url 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/' }
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.4'
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'org.robovm:robovm-gradle-plugin:1.0.0-beta-01'
}
}
Here are relevant parts of build.gradle in top level of project and from the android module:
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
repositories {
mavenLocal()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
dependencies {
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services:6.5.87'
}
Check you Android sdk folder.
You should find this folder under this:
androidSdk/extras/android/m2repository/com/android/support/appcompat-v7/20.0.0
If this folder doesn't exist:
update the SDK Manager and update the Android Repository (the last block).
Also I suggest you using the last releases:
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
Please compile with this
compile 'com.android.support:appcompat-v7:20.0.0'
Instead
compile 'com.android.support:appcompat-v7:20.0.+'
Try adding the mavenCentral repo:
mavenCentral()
to your allprojects
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
dependencies {
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services:6.5.87'
}
Sidenote: the support libraries have been updated (not sure if you need the most recent ones):
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
First check whether you have updated 'Android Support Repository' and 'Android Support Library' in your Android SDK Manager. Once updated, you should be able to build with latest appcompat-v7, at this time 21.0.3.
It would be more tricky for older appcompat-v7 versions. We had the same problem before, we were using appcompat-v7:19.0.+ at the time. It appears that once you update Android Support Repository & Library from Android SDK Manager, which contains the source for your support libraries, there is no going back. Once updated, it will only contain the latest source for support libraries, which means your build will always fail unless you update your build.gradle to point appcompat-v7 to latest version.
I find it surprising that we cannot have multiple versions of appcompat available, like how the SDK manager handles the multiple version of Android SDK build tools.
Sounds support library not installed or not in the right path as Android Studio supposed, so double check:
Check your Android SDK location from: File->project Structure->SDK Location
Then go to SDK Location path to check if \extras\android\support\v7\appcompat available
If not available then start SDK Manager under SDK Location, install both Android Support Library and Android Support Repository under Extras
I eventually fixed this after uninstalling Android Studio and the previous beta version I had, as well as all copies of the Android SDK on my computer. Then I reinstalled a fresh copy of Android Studio with the SDK.
Since none of the project configuration changes I made helped, I think there was possibly some kind of internal configuration in Android Studio that made it point at the wrong Maven repository, possibly the Maven repository in an Android SDK somewhere that was no longer maintained.
I'm glad I didn't reconstruct the project from scratch (to find step-by-step what differed between the problematic project and others that did work). Much faster to reinstall Android Studio.
I try to repair the dependency to google play services in my android project. It already worked but now it is broken. I think this happened in between the Android Studio beta- and release-version.
This is the dependency in the build.gradle file:
dependencies {
compile 'com.google.android.gms:play-services:6.5.87'
}
Android Studio was able to autocomplete the version string: '6.5.87' So I thought it knows how to solve the dependency. But it does not.. This is what I treid:
reinstaled Android Studio (1.0.1) and the Android SDK
used several play-service versions (incl. tried to use '+')
tried to 'gradlew clean' the project
installed almost everything from the Android SDK Manager. (incl. Google Repository and Android Support Repository)
set all environment variables to the correct path
But I still get this error if I try to do a gradle project sync:
Error:Could not find com.google.android.gms:play-services:6.5.87.
Searched in the following locations:
file:/C:/Users/MyName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
file:/C:/Users/MaName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
Required by:
code:android:1.0
UPDATE:
Gradle is searching in "file:/C:/Users/MyName/.m2/repository/" but it should use
"file:/C:/Users/MyName/AppData\Local\Android\sdk\extras\google\m2repository" .. I dont know why this is wrong and how to fix it..
UPDATE 2
I fixed it using this workaround:
repositories {
def androidHome = System.getenv("ANDROID_HOME")
maven { url "$androidHome/extras/android/m2repository/" }
maven { url "$androidHome/extras/google/m2repository/"}
}
But I am not happy with it. Does anybody know whats wrong with my gradle?
In Android SDK Manager download the "Google Repository"
Try download the sdk and use this library
compile 'com.google.android.gms:play-services:7.0.0'
After adding jcenter() to reposetories or top level gradle file I fixed the issue
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}
I am trying to use this library [1] in an Android project either with Android Studio or with ADT. But it doesn't work at all. In ADT I don't know how to handle gradle stuff and in Android Studio, when I try to "Import Project", I get the error "Could not find com.google.android.gms:play-services:3.1.36.
(don't have enough reputation to post picture, it's on imgur with xswZ3.jpg)
I am not familiar with gradle and I only have a vague idea of what it does but all I want is to use something like BubbleIconFactory f = new BubbleIconFactory(this) in my own project.
Any help is appreciated!
[1] https://github.com/googlemaps/android-maps-utils
Perhaps your problem is needing the repositories outside of the buildscript block.
The repositories internal to the buildscript is for managing the gradle dependency itself, I believe. Here's how I resolved my problem with google-maps-utils as a library dependency. Hopefully this helps. I included my maps and support-v4 libs too.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.10+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// Support Libraries
compile 'com.google.android.gms:play-services:4.1.32'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.google.maps.android:android-maps-utils:0.3+'
}
com.google.android.gms:play-services:3.1.36 can be downloaded by going to your SDK Manager and installing the Extras->Google Repository package (you may want to install the Extras->Android Support Repository as well while you are there). These allow Gradle to automatically use these resources without the need for library projects or jars manually added to your project.
Add the following dependency to your Gradle build file:
dependencies {
compile 'com.google.maps.android:android-maps-utils:0.2+'
}
You'll need to install the "Google Repository" from the Android SDK manager.
See demo/build.gradle for an example.
You can, of course, copy the library directory and use it like any other Android library project.
Let me know if this helps!
Chris
Steps:
First File>Project Structure>Click Plus Button >Import Graddle Project>Select the file(library folder) from the location where downloaded>CLick Ok.
Add this code to dependencies to that app module build.gradle file(remember there are two build.gradle files) :
dependencies {
compile 'com.google.maps.android:android-maps-utils:0.4+'
}
Copy gradle.properties file contents of that Android-maps-util Library project app(found inside that project library folder) TO
gradle.properties file of your project(Simple copy and paste of content to the editor).
Click Sync Project with gradle files button. And you must be fine!