Reputation: 11096
I have upgraded to API 27 and build tools. Previously I was using API 22.
after upgrading to SDK 27 I got error that I have to use support library similar to level 27. I have downloaded Support repository version 47.0.0 through SDK manager and finally this is my gradle setting. What should I do to resolve the following error:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.sample.app"
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.android.support:support-v4:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
Error:(23, 13) Failed to resolve: com.android.support:support-v4:27.1.1
Upvotes: 2
Views: 22477
Reputation: 737
To all Ionic / Cordova users having this issue, the solution that worked for me was to edit the file: platforms/android/project.properties
:
Then remove this line: com.android.support:support-v4:26.+
and edit target=
to android-27
Upvotes: 2
Reputation: 7467
In my case I fixed that error by just adding maven { url 'https://maven.google.com' }
to section buildscript => repositories
and also to section allprojects => repositories
in root project file build.gradle. Simple conservative solution... no dependencies version changing or upgrading android studio. It is for older gradle versions (<4) where google()
and implementation
is not available.
Upvotes: 0
Reputation: 79
In your project build.gradle, change the sequence of repositories, make google() the first.
allprojects {
repositories {
google()
jcenter()
}
}
Upvotes: 7
Reputation: 44
I don't know if this will fix it but
'compile' is obsolete and has been replaced with 'implementation'
Try:implementation 'com.android.support:support-v4:27.1.1'
Instad of:compile 'com.android.support:support-v4:27.1.1'
Upvotes: -1
Reputation: 754
Just change your dependencies version name same as below
dependencies {
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:support-v4:27.0.2'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.google.android.gms:play-services-ads:11.8.0'
}
and also add
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Upvotes: 5
Reputation: 340
try to change:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.sample.app"
minSdkVersion 14
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.android.support:support-v4:27.1.0'
}
apply plugin: 'com.google.gms.google-services'
Upvotes: 0