Failed to resolve: com.android.support:appcompat-v7:28.0 - android

When I use com.android.support:appcompat-v7:28.+ in my project's build.gradle(module) it works without any error. But when I just use com.android.support:appcompat-v7:28, just without .+, it gives me an error:
Failed to resolve: com.android.support:appcompat-v7:28.0
Just without the .+ end of it. I added maven before but the result was the same. Any idea to solve it?

28.0.0 is the final version of support libraries. Android has migrated to AndroidX. To use the latest android libraries, Migrating to AndroidX
Edit: Versions 28.0.0-rc02 and 28.0.0 are now available.
I don't see any 28.0 version on Google Maven. Only 28.0.0-alpha1 and 28.0.0-alpha3. Just change it to either of those or how it was previously, i.e., with .+ which just means any version under 28 major release.
For an alpha appcompat release 28.+ makes more sense.

Add the following code on build.gragle (project) for adding Google maven repository
allprojects {
repositories {
...
maven {
url 'https://maven.google.com/'
name 'Google'
}
...
}
}

some guys who still might have the problem like me (FOR IRANIAN and all the coutries who have sanctions) , this is error can be fixed with proxy
i used this free proxy for android studio 3.2
https://github.com/freedomofdevelopers/fod
just to to Settings (Ctrl + Alt + S) and search HTTP proxy then check Manual proxy configuration then add fodev.org
for host name and 8118 for Port number

As #Sourabh already pointed out, you can check in the Google Maven link what are the packages that Google has listed out.
If you, like me, are prompted with a similar message to this Failed to resolve: com.android.support:appcompat-v7:28.0, it could be that you got there after upgrading the targetSdkVersion or compileSdkVersion.
What is basically happening is that the package is not being found, as the message correctly says. If you upgraded the SDK, check the Google Maven, to check what are the available versions of the package for the new SDK version that you want to upgrade to.
I had these dependencies (on version 27):
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
And I had to change the SDK version and the rest of the package number:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
Now the packages are found and downloaded. Since the only available package for the 28 version of the SDK is 28.0.0 at the moment of writing this.

Run
gradlew -q app:dependencies
It will remove what is wrong.

my problem was just network connection. using VPN solved the issue.

implementation 'com.android.support:appcompat-v7:28.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
All to add

Ensure that your buildToolsVersion version tallies with your app compact version.
In order to find both installed compileSdkVersion and buildToolsVersion go to Tools > SDK Manager. This will pull up a window that will allow you to manage your compileSdkVersion and your buildToolsVersion.
To see the exact version breakdowns ensure you have the Show Package Details checkbox checked.
android {
compileSdkVersion 28
buildToolsVersion "28.0.3" (HERE)
defaultConfig {
applicationId "com.example.truecitizenquiz"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0' (HERE)
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
}

in build.gradle , the version of bellow line should be same
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0'

Related

Android API not allowing application to be released on play store

I have just finished working with my android project and decided to publish it on Google Play Store. When I uploaded the signed APK file in the production tab of Google Play Console, I faced the following issue:
Here is the gradle information:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.parma.torupee"
minSdkVersion 26
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 {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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.android.support:design:26.1.0'
compile 'com.jjoe64:graphview:4.2.1'
}
I have developed the application in Android Studio 3.0.1(did not update). I tried changing the targeted SDK to 29 but then I received errors for implementation 'com.android.support:appcompat-v7:26.1.0' and implementation 'com.android.support:design:26.1.0' lines in the gradle file.
How can I change the target SDK to 29 such that it supports the latest version and also support API level 26(Oreo)? Any help would be highly appreciated!
Compile SDK Version
The Compile SDK Version is the version of Android in which you write code. If you choose 9, you can write code with all the APIs in version 28.
Minimum SDK Version
Android operating system (OS) versions are backward-compatible. If your minSdkVersion is set to Android version 22, your application will run on Lolipop (5.1) and above .
Target SDK Version
You should set the targetSdkVersion to the most recent version of Android that you have tested on.
Whenever a new version of Android comes out, you will want to update the targetSdkVersion to the latest Android version and test your app to fix any problems. If you don’t google may force you to update it. This allows you to use the new security patches commonly applied for most of the OS versions.
Increasing your target sdk doesnt affect the minimum version number you have defined.
EDITED : Updated comment on support library
If you want to update your target SDK to 28 then it might be easier as you could use the below support libraries
com.android.support:support-compat:28.0.0 but if you plan to use target sdk as 29 then you have to migrate all your support packages to androidx libraries .
https://developer.android.com/topic/libraries/support-library/packages
For easier migration you could follow the stesp give here https://developer.android.com/jetpack/androidx/migrate
Let me know if this helps
You could use:
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support:design:29.0.0'

GradleCompatible error: implementation 'com.android.support:appcompat-v7:28.0.0'

I am beginner to android development. When I build my android project, it is throwing an error
INFO: API 'variantOutput.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: capacitor-android
I tried the solutions suggested in other topic at implementation 'com.android.support:appcompat-v7:28.0.0'
Can anyone help me please? Thank you for your time!
My build.gradle(capacitor-android) file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.novoda:bintray-release:0.9.1'
}
}
tasks.withType(Javadoc).all { enabled = false }
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
//implementation 'com.android.support:appcompat-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
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 'org.apache.cordova:framework:7.0.0'
}
def version = System.getenv("BINTRAY_PKG_VERSION")
publish {
userOrg = 'ionic-team'
repoName = 'capacitor'
groupId = 'ionic-team'
artifactId = 'capacitor-android'
if (version != null) {
publishVersion = System.getenv("BINTRAY_PKG_VERSION")
} else {
publishVersion = '0.0.0'
}
desc = 'Capacitor Android Runtime'
website = 'https://github.com/ionic-team/capacitor'
}
Best of luck with this platform.
This is not a direct solution, just a small piece of advise. But from now, please do not use the support library. Recently, Google has been introduced Android JetPack. The current stable version of Android Studio 3.6.1, you will be introduced to AndroidX by default and Google is highly recommended to use it.
AndroidX - Android Extension Library: From AndroidX documentation
You can also migrate from support Android to AndroidX. Just follow this step: Android Studio > Refactor Menu > Migrate to AndroidX. It is independent of the Android SDK version.
From Android Support Revision 28.0.0, you can see that this version will be the last feature release under the android.support packaging and developers are encouraged to migrate to AndroidX 1.0.0. You may face trouble getting support or a solution if you use the support library. So, it will be wise to use AndroidX.
Replace 'variantOutput.getPackageLibrary()' with 'variant.getPackageLibraryProvider()' in your code. It may works.
Option 1:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
instead of
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:appcompat-v4:28.0.0'
Option 2:
Migrate your project to AndroidX

Cannot fit requested classes in a single dex file, even for earlier commits which previously compiled fine

So I've just hit the maximum method count limit for my android project, which fails to build with the following error message:
Error: null, Cannot fit requested classes in a single dex file (# methods: 117407 > 65536)
I understand what the message means, and how to resolve it (running proguard, enabling multidex etc). My problem is that I don't understand why I'm suddenly getting this message - I was doing was removing some old bits of code which were redundant, hit build, and now I get this message.
Question 1: How can it be possible that my method count (117407 according to the error message) is suddenly massively over the limit (65536), even though I did not add any library dependencies? I actually removed code, and suddenly I have like 50 thousand methods too many?
Now this is where it gets really weird: I wanted to analyse the APK to figure out what's causing the problem, but of course I can't build it. So instead of enabling multidex I decided to revert my code to yesterday (which definitely absolutely did build fine yesterday - I have the app on my phone to prove it!), but I still get this build error message. I don't understand how this is possible. I tried reverting to several days ago, same thing (cloning a new repo and checking out an earlier commit).
So, question 2: How am I getting this build error for the exact same code which just yesterday built fine without error?
The only thing I can think of is that a library that I am using as a dependency has suddenly increased in size - but I'm declaring specific versions of everything in my gradle build, for example:
// RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.4'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
So, surely my dependencies should not have changed?
Any ideas what I can do to figure this out are greatly appreciated. I've tried cleaning my project, and invalidating caches/restart in android studio. I really don't want to enable multidex or have to run proguard on my debug build.
Here's the full build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "XXXXXXXXX"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true // see https://developer.android.com/studio/write/vector-asset-studio#sloption
}
buildTypes {
release {
minifyEnabled false
// Do code shrinking!
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Core stuff
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
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 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.google.android.gms:play-services-wearable:16.0.1'
// Dagger
implementation 'com.google.dagger:dagger:2.21'
kapt 'com.google.dagger:dagger-compiler:2.21'
// Dagger for Android
implementation 'com.google.dagger:dagger-android:2.21'
implementation 'com.google.dagger:dagger-android-support:2.21' // if you use the support libraries
kapt 'com.google.dagger:dagger-android-processor:2.21'
// Constraint layout
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// Associated WearOS project
wearApp project(':wear')
// Common library project
implementation project(':common')
// These were added to resolve gradle error on the 'com.android.support:appcompat-v7:28.0.0' implementation:
// All com.android.support libraries must use the exact same version specification (mixing versions can lead to
// runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0
// and com.android.support:support-media-compat:26.1.0
// This seems to be related to linking the wear project. If the wear project was not linked, the error went away.
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
// RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.4'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
// Retrofit RxJava
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
// Retrofit logging:
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
// Room
def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
implementation "android.arch.persistence.room:common:$room_version"
implementation "android.arch.persistence.room:rxjava2:$room_version"
kapt "android.arch.persistence.room:compiler:$room_version"
// For modern time handling (java.time requires API 26 or higher)
implementation 'com.jakewharton.threetenabp:threetenabp:1.1.1'
// Graphing
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'
// Dropbox
implementation 'com.dropbox.core:dropbox-core-sdk:3.0.11'
// OpenCSV
implementation 'com.opencsv:opencsv:4.5'
}
EDIT
So after enabling multidex, there are some heavy dependencies showing up under the following TLDs when I analyse the APK using Android Studio (I'm not sure if I should be looking at defined or referenced method numbers?):
com.dropbox: 26000 defined methods, 34000 referenced methods
com.android (mainly support libraries): 18700 defined, 24600 referenced
org.apache (commons, log etc): 15000 defined, 15700 referenced
These alone take me up to the limit. I still don't get why this is suddenly happening though :( Surely if I have not added any libraries, these numbers should not have changed?
Simple add this to your gradle (Module: app) >> multiDexEnabled true
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
}
...
}
then Rebuild Project
in Menu click => Build>Rebuild Project.
After looking at your entire build gradle file, your issue definitely stems from your dependencies! Attempt to clean them up and remove as many as you can that you don't use. Chances are you were very close to the limit and any of those dependencies may have been cached using older versions. You can attempt to remove the entire build folder (and clean your gradle cache) but I am fairly certain the issue will not go away.
If all of these dependencies are required unfortunately you will have to go the routes you mentioned, either multi-dex or minifying debug builds. Multi-dex should be ok and shouldn't cause any unforeseen issues while minifying will slow down your builds and potentially cause Android Studio to become unstable (especially instant run/apply changes!)
Good luck, one thing to take from this is to keep your dependencies clean and precise, only add when absolutely needed, and if all else fails, multi-dex is your friend.
None of the answers they gave you were exhaustive. The problem lies in the Multidex. You must add the library in the app gradle:
implementation 'com.android.support:multidex:1.0.3'
After, you should add in the defaultConfig of the app gradle:
multiDexEnabled true
From the Android docs:
"If your minSdkVersion is set to 21 or higher, multidex is enabled by default and you do not need the multidex support library."
As an alternative to manually enabling multidex, you could simply increase your minSdkVersion if possible.
I would recommend building the application with multidex, and then extracting the method ids from the multiple dex files from the new apk, and also extract the method ids from the old, single-dex apk and comparing the two lists.
roughly, something like:
baksmali list dex new.apk
baksmali list method new.apk/classes.dex > new.list
baksmali list method new.apk/classes2.dex >> new.list
sort new.list > new.sorted.list
baksmali list method old.apk > old.list
diff new.sorted.list old.list
Although, if you're using proguard, you may need to figure out some way to apply the reverse proguard name mangling before comparing the lists.
After reading your question I can only suggest try invalidate cache and restart after and force refresh your dependency using this .
./gradlew build --refresh-dependencies
As your problem, I had to delete the build folder and the *.iml files (Android Studio project files) y I had to recreate the project, then the build and then all worked fine again.
I encountered the same issue and the solution was to enable Instant Run under File -> Setting -> Build, Execution, Deployment -> Instant Run and that solved my problem. Hope it's helpful.
I tried this.
hopes it helps, found it on some documentation
( forgot the url :( )
build.gradle app
dependencies {...
grdef multidex_version ='2.0.1'
implementation "androidx.multidex:multidex:$multidex_version"
}...
in bulid.gradle app
implementation 'com.android.support:multidex:2.0.1'
android {
multiDexEnabled true
}
android > app > build.gradle
android {
defaultConfig {
versionCode 1
versionName "1.0"
+ multiDexEnabled true
}
}
Add implementation 'com.android.support:multidex:1.0.3'
in dependencies block
dependencies {
+ implementation 'com.android.support:multidex:1.0.3'
}
Community wiki
Its easy just increase this minSdkVersion, targetSdkVersion :
Old:
defaultConfig { minSdkVersion 19 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName }
New:
defaultConfig { minSdkVersion 21 targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName }
also this compileSdkVersion:
Old:
android { compileSdkVersion 28
New:
android { compileSdkVersion 29

error: duplicate value for resource 'attr/actionBarSize' with config ''

I'm porting my current android apk to meet recent playstore directive - " targetSdkVersion 26"
This my gradle file. I started off with compileSdkVersion 26 and ended up at 28. So for 28 I had to use AndroidX dependencies. Im stuck at the error as posted in subject line. Any help would be very much appreciated.
The error message is
AGPBI: {"kind":"error","text":"error: duplicate value for resource \u0027attr/actionBarSize\u0027 with config \u0027\u0027.","sources":[{"file":"/Users/sk/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/34c8fa33903fb2b3203e5c70952da588/res/values/values.xml","position":{"startLine":1303,"startColumn":4,"startOffset":70911,"endColumn":68,"endOffset":70975}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource previously defined here.","sources":[{"file":"/Users/sk/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/34c8fa33903fb2b3203e5c70952da588/res/values/values.xml","position":{"startLine":1303,"startColumn":4,"startOffset":70911,"endColumn":68,"endOffset":70975}}],"original":"","tool":"AAPT"}
:app:mergeDebugResources
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "pack.age.net"
minSdkVersion 16
//Since no updates to app can be published in Playstore beginning Nov 1, 2018 - bumping targetSdk to 26 from 19
targetSdkVersion 26
//Double check this before you move this to production
versionCode 22
versionName "3.3"
// Enabling multidex support.
multiDexEnabled true
//Language resources
resConfigs "en", "hi"
}
buildTypes {
release {
//Shrink your code
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/journeyapps/maven"
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
//implementation 'com.android.support:support-v4:28.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
// implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
//Hockey App for Crash Analytics
implementation 'net.hockeyapp.android:HockeySDK:5.1.1'
//Sundry library files
implementation files('libs/commons-codec-1.9.jar')
implementation files('libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
implementation files('libs/libphonenumber-6.2.jar')
//Mutlidex Support
implementation 'com.android.support:multidex:1.0.0'
//Square Picasso Image View
implementation 'com.squareup.picasso:picasso:2.5.2'
//Calligraphy for custom fonts
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
testImplementation 'junit:junit:4.12'
//Apache Commons
implementation 'org.apache.commons:commons-lang3:3.7'
implementation 'com.github.chrisbanes:PhotoView:2.2.0'
// Supports Android 4.0.3 and later (API level 15)
implementation 'com.journeyapps:zxing-android-embedded:2.0.1#aar'
// Supports Android 2.1 and later (API level 7), but not optimal for later Android versions.
// If you only plan on supporting Android 4.0.3 and up, you don't need to include this.
implementation 'com.journeyapps:zxing-android-legacy:2.0.1#aar'
// Convenience library to launch the scanning and encoding Activities.
// It automatically picks the best scanning library from the above two, depending on the
// Android version and what is available.
implementation 'com.journeyapps:zxing-android-integration:2.0.1#aar'
// Version 3.0.x of zxing core contains some code that is not compatible on Android 2.2 and earlier.
// This mostly affects encoding, but you should test if you plan to support these versions.
// Older versions e.g. 2.2 may also work if you need support for older Android versions.
implementation 'com.google.zxing:core:3.0.1'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
hello there~ I too got a disaster moving to Androidx... according to google document you should locate the gradle property and add these two lines which works fine for me!
android.enableJetifier=true
android.useAndroidX=true
Good Luck dude~
The proper answer might be, to update the Firebase dependencies to have versions, which already use androidx dependencies and if this should not be enough, to also enable the Jetfier, in case other libraries pull in com.android.support dependencies, which need to be re-written. To do so, add this into the gradle.properties file:
android.enableJetifier=true
android.useAndroidX=true
PS_ANDROIDBUILDTOOLSVERSION=29.0.1
android.aapt2FromMavenOverride=${Android_home}/build-tools/29.0.1/aapt2
disable aapt2 from maven
We need to change XML layout, any support value need to change to androiddx value
android.support.v4.widget.SwipeRefreshLayout need to change to androidx.swiperefreshlayout.widget.SwipeRefreshLayout

Error in building gradle - com.google.android.gms:play-services-basement is being requested by various other libraries

I am trying to integrate Facebook sign in feature to my android app using Firebase-UI library. I am following this tutorial - https://firebase.google.com/docs/auth/android/firebaseui?authuser=0
But I am getting below error while trying to build gradle:
The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
Below is my app level build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "company.com.mygame"
minSdkVersion 15
targetSdkVersion 28
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.0'
implementation 'com.facebook.android:facebook-android-sdk:4.37.0'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
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'
}
apply plugin: 'com.google.gms.google-services'
I saw below links -
com.google.android.gms:play-services-measurement-base is being requested by various other libraries
https://github.com/OneSignal/OneSignal-Gradle-Plugin/issues/37
But then I get this error -
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.firebaseui:firebase-ui-auth:4.2.0] C:\Users\me\.gradle\caches\transforms-1\files-1.1\firebase-ui-auth-4.2.0.aar\xxx\AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 16,
or use tools:overrideLibrary="com.firebase.ui.auth" to force usage (may lead to runtime failures)
But the issue is still not fixed. I have just started learning android, not sure what am I missing.
I had the same issue
Just make sure that you have the latest versions of all the dependencies. I used the current versions for Firebase core and auth.
You can get the latest versions from here .
Using the latest version at current point of time:
in app/build.gradle :
dependencies {
...
// Add these code
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.0'
}
in android/build.gradle :
buildscript {
ext {
...
minSdkVersion = 16
...
}
}
Your error says : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 and your build.gradle as minSdkVersion 15. Try to change it to 16 and see if that works for you.
All the best for learning android. May the force be with you.
Over and out,
Aashish

Categories

Resources