I have following dependencies in build.gradel file.
I am not using any kind of v4 library but ,
still it's giving "Failed to resolve: support-v4" error while i build the gradle.
I have already gone through these 2 links
"Failed to resolve: com.android.support:support-v4:26.0.0" and other similar errors on Gradle sync
Failed to resolve: com.android.support:support-v4:23.0.0
But can't find solution.
Here i have attached project structure image.
android {
compileSdkVersion 26
dataBinding.enabled = true
defaultConfig {
applicationId "XXX.XXXXXXX.XXXXXXXXXX"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
repositories {
maven { url "https://maven.google.com" }
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation "com.android.support:customtabs:26.1.0"
implementation 'com.android.support.constraint:constraint-
layout:1.0.2'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:cardview-v7:26.+'
implementation 'com.google.android.gms:play-services:10.2.1'
implementation 'com.android.support:multidex:1.0.0'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Please help me to get solved this issue.
Thanks in advance.
I have same problem and i'm change order of repositories in biuld.gradle (app) and problem solved.
Change :
jcenter()
google()
To :
google()
jcenter()
Hope it's help
Move repositories in the module build.gradle not in app build.gradle. It will solve your problem.
Related
I have Error comment
ERROR: Failed to resolve: androidx.recycleview:recyclerview:1.1.0" and
"ERROR: Failed to resolve: com.google.firebase:firebase-core:19.3.0"
as below;
ERROR: Failed to resolve: androidx.recycleview:recyclerview:1.0.0
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: com.google.firebase:firebase-core:19.3.0
Show in Project Structure dialog
Affected Modules: app
How can I solve these errors? Please advise.
build.gradle code is as below;
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "io.github.stack07142.firebase_photos"
minSdkVersion 19
targetSdkVersion 29
versionCode 5
versionName "1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.42.0'
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'com.google.firebase:firebase-database:19.2.1'
implementation 'androidx.recycleview:recyclerview:1.1.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.google.firebase:firebase-analytics:17.2.3'
testImplementation 'junit:junit:4.13'
}
allprojects {
repositories {
maven{
url 'https://maven.google.com'
}
jcenter()
maven{url'http://maven.fabric.io/public'}
}
}
apply plugin: 'com.google.gms.google-services'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recycleview:recyclerview:1.1.0'
You need to add google() in your project Top-level build file like that
buildscript {
repositories {
...
google()
}
...
allprojects {
repositories {
...
google()
}
Why not help me?
In my application I want use ButterKnife library and I add this library dependencies. But when add this library and when click on Sync button.
Not sync project and show me error.
gradle.Build (project) :
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle.build (app) :
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.mohammad.ncistutorial"
minSdkVersion 14
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
Error message :
Failed to resolve: support-compat
How can I fix it?
Please try to add depedency line with exclude group of support of app compact.
implementation 'com.jakewharton:butterknife:8.8.1',{
exclude group: 'com.android.support'
})
use this code
implementation 'com.jakewharton:butterknife:9.0.0-rc2',{
exclude group: 'com.android.support'
}
check your .gradle file version. Update or change latest gradle version.
firebaseUI dependency not matching with the firebase version 15.0.0 Actually what is happening is that, when I include the firebaseUI dependency , android studio shows some kind of error related to values.xml file. I have linked the picture of error below and when I remove that line everything works fine , then there is no error.
The code for the entire gradle file is given below:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
maven { url "https://maven.google.com" }
}
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
resConfigs "en"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:15.0.0'
compile 'com.google.firebase:firebase-auth:15.0.0'
compile 'com.google.firebase:firebase-core:15.0.0'
compile 'com.firebaseui:firebase-ui-database:3.3.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
}apply plugin: 'com.google.gms.google-services'
ERROR:
The README at FirebaseUI's github repo is quite clear. You need to explicitly override all the transitive dependencies for each UI library e.g if you are using firebase-ui-auth version 3.3.0 but want to use firebase version 15.0.0 and support libaries version 27.1.1, it will be be something like below.
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation "com.android.support:cardview-v7:27.1.1"
implementation 'com.android.support:design:27.1.1'
Try updating your setup, also firebase UI is still depedning in version 12.0.1 not 15.0.0. See the docs to see which versions match with which firebase ui versions:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
maven { url "https://maven.google.com" }
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
resConfigs "en"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:12.0.1'
compile 'com.google.firebase:firebase-auth:12.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.firebaseui:firebase-ui-database:3.3.0'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
apply plugin: 'com.google.gms.google-services'
whatever the Firebase UI dependency you want to use, try adding below two dependencies.
It worked for me, this might work for you as well
implementation "android.arch.core:runtime:1.1.1"
implementation "android.arch.core:common:1.1.1"
I am trying run my app at emulator but I got his error:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
This is my gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
multiDexEnabled true
applicationId "com.example.sayres.presencesystem"
minSdkVersion 16
targetSdkVersion 26
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(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.1'
}
and this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.0.0' // google-services plugin
}
}
allprojects {
repositories {
jcenter()
maven { url 'http://maven.fabric.io/public' }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
according some siggestion on some post I have added multiDexEnabled true to my gradle but I still got error. some developers at this site had suggested, rebuild project.I did this suggestion but I did work and I still got this error!!
what is your suggestion?
I still did this suggestion
but did not work again.
I do not have too many methods.I have just 2 activity and a few methods.my project is for learning.
I change my build.gradle to :
implementation 'com.google.firebase:firebase-database:10.2.0'
implementation 'com.google.firebase:firebase-auth:10.2.0'
implementation 'com.firebaseui:firebase-ui-auth:1.2.0'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
and
classpath 'com.google.gms:google-services:3.0.0' // google-services plugin
my problem fixed.now I can compile my project.
I have written an Android App that uses the Firebase database feature. Everything is working fine and now I would like to integrate the Authentication feature. So I modified my build.gradle for the app to include the two dependencies for the authentication:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.gmeunier.gestiondepoints"
minSdkVersion 23
targetSdkVersion 25
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:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-plus:10.2.6'
compile 'com.google.firebase:firebase-database:10.2.6'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
compile 'com.google.firebase:firebase-auth:10.2.6'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Despite all my efforts and research on this topic, I still have the following error when I try to sync this gradle :
Failed to resolve: com.twitter.sdk.android:twitter:2.3.0
I can't find which lib/component versions I must use and I would appreciate help and support.
Your project's gradle file should look like this.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
// Required for 'com.firebaseui:firebase-ui:1.1.1'
maven {
url 'https://maven.fabric.io/public'
}
}
}
Original answer: https://stackoverflow.com/a/41664069/7339411
Add the following line inside "repositories", inside "allprojects" and "buildscript" to your Project Level build.gradle file:
maven {
url 'https://maven.fabric.io/public'
}