Android Support Library - Failed to Resolve [duplicate] - android

This question already has answers here:
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Closed 5 years ago.
I am trying to add the following support libraries to my buid.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 26
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 11
targetSdkVersion 26
}
signingConfigs {
release {
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
repositories {
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:support-v7:26.0.0'
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.melnykov:floatingactionbutton:1.1.0'
compile 'it.sephiroth.android.library.imagezoom:imagezoom:1.0.5'
//Apptentive
compile 'com.apptentive:apptentive-android:2.1.3#aar'
//compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.0.0'
}
I am receiving errors stating that each library "Failed to Resolve" followed by each line of code from above. I was hoping to remain current with the latest support libraries for regular support, appcompat, and cardview.

To use support libraries starting from version 26.0.0 you need to add Google's Maven repository to your project's build.gradle file as described here.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}

What is your buildToolsVersion and compileSdkVersion?
android {
buildToolsVersion "26.0.1"
}
Maybe try updating that in AndroidManifest.xml? Sometimes they arent compatible and you will have to modify the versions accordingly.
This link might help :Setting up Gradle for api 26 (Android)

Related

Plugin with id 'com.android.application' not found. I have run some modules today and suddenly have got this message [duplicate]

This question already has answers here:
Error:(1, 0) Plugin with id 'com.android.application' not found
(25 answers)
Closed 5 years ago.
I tried File -> Invalidate caches\Restart, that didn't help me.
Log:
16:05 Gradle sync started
16:05 Gradle sync failed: Plugin with id 'com.android.application' not found.
Consult IDE log for more details (Help | Show Log) (34s 987ms)
build.gradle application
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "ru.startandroid.androidlessons"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
First, any project creates by Android Studio has two separated build.gradle files. That shouldn't cause any problems, for Gradle itself, but Android Studio might not be expecting that.
It's probably a sign that you're continuing to use the new SDK and features, but neglecting to upgrade your build tools along with it. E.g com.android.tools.build:gradle:2.1.2
You should upgrade that Gradle plugin to the latest version
https://developer.android.com/studio/releases/gradle-plugin.html
And upgrade Gradle itself, via the Gradle wrapper or install it externally to Android Studio
your build.graddle in project level should look like below
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
jcenter()
}
}
and gradle-wrapper.properties distributionUrl should be like:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

Error:(39, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0 [duplicate]

This question already has answers here:
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Closed 5 years ago.
I am using Android studio 2.3 and Thought for support new android 26 in my app.But I am stuck on error with title message. My gradle file is like below
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.shayari"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
manifestPlaceholders = [onesignal_app_id : "",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-location:10.2.6'
compile 'com.android.support:support-v4:26.0.0'
compile 'com.google.android.gms:play-services-gcm:10.2.6'
compile 'com.google.android.gms:play-services-ads:10.2.6'
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support:preference-v7:26.0.0'
compile 'com.android.support:design:26.0.0'
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:customtabs:26.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
compile 'com.onesignal:OneSignal:[3.5.3,4.0.0)'
compile 'com.codemybrainsout.rating:ratingdialog:1.0.7'
compile 'com.android.support:support-vector-drawable:26.0.0'
compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
But I am not able to install support repository with below error..
Error:(39, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0
Install Repository and sync project<br>Show in File<br>Show in Project Structure dialog
Add this to your project level build.gradle file:
repositories {
maven {
url "https://maven.google.com"
}
}
UPDATE:
In Android studio 3.0 the error is solved.
Or you can add google() to solve it since you will use new the gradle plugin as mentioned here.
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
Before Android studio 3.0:
Check if the support library is installed in your system (check the SDK directory in your system) or check if Android O is installed in the SDK Manager.
Or as this answer stated
Starting from version 26 of support libraries make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}

Android Studio Gradle DSL method not found: 'mavencentral()'

I am trying to use facebook SDK in my android apps, and I am starting to add maven central repository to my build.gardle. Although, I've found 2 build.gardle which belong to project and app. Here they are;
Android Studio: 1.5.1
Gradle Version: 2.8
Android Plugin Version: 1.5.0
Build.gardle (Project)
buildscript {
repositories {
jcenter()
mavencentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
}
allprojects {
repositories {
jcenter()
mavencentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gardle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.test"
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.2.0'
compile 'com.android.support:design:23.2.0'
}
Yet I get this following error during build;
Gradle DSL method not found: mavencentral()
I have tried;
Checking both gardle files
Removing android compile dependencies that's actually should be there
Checking android packagingOptions.exclude
Checking if there's android method in the gardle
And, I haven't tried to update my gardle or android studio, but I am just wondering whether it's really needed or I am doing something wrong with my build.gardle.
Any suggestion is appreciated. Thank you.
The Facebook SDK page is clear. Add into your project/build.gradle
repositories {
mavenCentral() //note the uppercase C
}
and into your project/app/build.gradle
dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.+'
}

Android studio - Failed to resolve (gradle) Uber library

In my Android application, I want to add Uber facility to users so that I looked the following library. So that I added the compile 'com.uber.sdk:rides-android:0.1.0' in my main module's (Main application) build.gradle file. It gives me following error when sync the gradele
Failed to resolve: com.uber.sdk:rides-android:0.1.0
I have some other libraries referenced to the application.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.qapp"
minSdkVersion 14
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':payPalDemo1')
compile project(':uberLibrary')
compile project(':bSLibrary')
compile project(':pullToRefresh')
compile project(':androidmapsutils')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/cardio.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/UserFormValidation.jar')
}
Please help me to resolve this exception.
Try to add this in your gradle file
repositories{
maven { url "https://jitpack.io" }
}
In the portion of your build.gradle file that you have included you only have the mavenCentral() repository specified within the buildScript block. In order to make that repository accessible outside of that context you should include a block such as the following to the root level of your build.gradle:
repositories {
mavenCentral()
}
In addition, you have not actually included the line compile 'com.uber.sdk:rides-android:0.1.0' in the file copied in your question.
Ultimately, your build.gradle should include the following:
repositories {
mavenCentral()
}
dependencies {
compile 'com.uber.sdk:rides-android:0.1.0'
}
this SDK is designed to work with Android SDK 16. so minSdkVersion should be 16 or greater

Failed to import jsoup library in android studio?

I was trying to integrate j soup library in android studio. I am getting error.
StackTrace:
Gradle: A problem occurred configuring root project 'JsoupProject'.
Failed to notify project evaluation listener.
Main Manifest missing from C:\Users\Asthme\Androidstudio\JsoupProject\src\main\AndroidManifest.xml
settings .gradle:
include ':Jsoup'
include ':libraries:jsoup-1.7.2.jar'
Build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: 'jsoup-1.7.2.jar')
}
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
Library build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
}
dependencies {
...
implementation 'org.jsoup:jsoup:1.11.3'
}
(check the latest version number here: https://jsoup.org/download)
Don't include the Jsoup library from your settings.gradle, that's only for module. Just put it in the dependencies statement from any module that needs it. I see you've done it in your build.gradle file in your question, so you should be fine there.
My solution was: Copy for /app/libs the jsoup-1.10.3.jar, after import in the MainActivity.java "import org.jsoup.Jsoup;" and it working. With the code compile fileTree(dir: 'libs', include: ['*.jar']) in the buil.gradle(app) it work. jsoup in the /app/libs build.gradle(app)
Note: I am using Android Studio 2.2.1

Categories

Resources