I'm in the final stages putting my project on cloud firebase. Added all required firebase requirements using the firebase console. The Android compile fails with the error: Could not find com.google.firebase:firebase-appcheck-playintegrity:.
This is a copy of the implementation in the build.gradle file:
implementation 'com.google.firebase:firebase-appcheck-playintegrity'
Is this the correct statement for these dependencies? I assume there is no version number. This project is my first attempt putting a project on the cloud firebase. Appreciate any help.
Roger
As per the documentation:
https://firebase.google.com/docs/app-check/android/play-integrity-provider?authuser=0#install-sdk
You don’t need to specify version only if you also defined BoM dependency. Otherwise version is required.
dependencies {
// Declare the dependency for the App Check library
// When NOT using the BoM, you must specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-appcheck-playintegrity:16.0.0'
}
When building gradle I'm getting this message:
API 'BaseVariant.getApplicationIdTextResource' is obsolete and has been replaced with 'VariantProperties.applicationId'
I'm using Android Studio 4.1 Canary 10 and gradle:4.1.0-alpha10
It seems like the Navigation Safe Args plugin uses getApplicationIdTextResource(), so it is most likely that the error message is caused by your usage of that plugin.
You'd want to star the existing issue to ask the Safe Args plugin to use the new replacement API.
Changing to androidx.navigation:navigation-*:2.4.0-alpha02 as described here allowed a build of my app under Arctic Fox without getting the getApplicationIdTestResource warning
From the application build.gradle file:
def nav_version = "2.4.0-alpha02"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
And in the build.gradle file:
def nav_version = "2.4.0-alpha02"
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
few days i see the same issue. Then i go to ->
build.gradle file
My Dependencies before update
check the dependencies
I update the dependencies google services to 4.3.4
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
After update
Now its working fine.
This error was for NavigationComponent for me in Android Studio Cannery 13.
So I changed the nav_version to this and My issue was solved.
ext {
*************** nav_version = "2.4.0-alpha10" ************
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0-alpha13'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
and in app module build.gradle:
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
It will be solved, when 4.2.0 is stable.
From the existing issue:
Android Gradle Plugin deprecated the getApplicationIdTextResource()
API on the class BaseVariant in version 4.1.0 (see bug). The
replacement API (onVariantProperties) did not work properly for
feature libraries, so to avoid the deprecation warning, reflection was
used. That is only a short term solution, and when AGP 4.2.0 is stable
we should update to that version and remove the reflection immediately
So if you need Safe Args and do not need latest features of Gradle, keep Gradle version in Android Gradle Plugin version at 3.6.4. Once stable 4.2.0 released, update to the latest.
This error happened after i updated kotlin version to 1.7.
this was for NavigationComponent in Android Studio
So I changed the nav_version to this and My issue was solved : "2.4.0-beta02"
// Navigation Component
implementation "androidx.navigation:navigation-fragment-ktx:2.4.0-beta02"
implementation "androidx.navigation:navigation-ui-ktx:2.4.0-beta02"
For me it was because of different Kotlin versions between IDE Kotlin plugin and project_name/build.gradle file
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
"Kotlin version that is used for building with Gradle (1.3.72) differs from the one bundled into the IDE plugin (1.4.31) "
Once I made it even it started to compile again.
In my case I was using 2.3.1 version of navigation-fragment.
I just updated it to 2.4.2 and it's helped me
So, What i have done is that I have upgraded all the gradle plugins as well as dependecies versions and then run, It worked for me
I had the same problem and it was solved like this:
So I go to -> build.gradle file
My dependencies before upgrade
check the dependencies
I update Google services dependencies to latest version
dependencies {
classpath 'com.android.tools.build:gradle:(latest version)'
classpath 'com.google.gms:google-services:(latest version)'
}
Android Studio 4.1 giving the following information and It will be removed in version 5.0 of Android Gradle Plugin.
API 'BaseVariant.getApplicationIdTextResource' is obsolete and has been replaced with 'VariantProperties.applicationId'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see TBD.
To determine what is calling BaseVariant.getApplicationIdTextResource, use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
As #ianhanniballake has pointed out, it seems likely that it's caused by the Navigation Safe Args plugin, see the existing issue, also referenced from his answer. The issue was marked as fixed on 9 November.
In terms of fixing the build error, upgrading Android Studio from 4.1.0 to 4.1.1 fixed it for me.
delete the .idea and .gradle files from the project .. it worked with me
From what I understand, in order to use firebase messaging I need my google-play-services version to match my firebase-messaging version in my app's build.gradle. According to Google's Firebase setup guide the firebase version I should use is 17.3.0, so I figure I'm supposed to use google-play-services version 17.3.0, but that doesn't work because Android Studio can't find that version:
Here is how I've added them to app/build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.google.android.gms:play-services:17.3.0'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
implementation "com.android.support:support-v4:24.1.1+"
// SUB-PROJECT DEPENDENCIES END
}
What am I doing wrong here?
From what I understand, in order to use firebase messaging I need my
google-play-services version to match my firebase-messaging version
That is no longer true, google recently changed to semantic versioning so libraries are no longer tied to the same version. 12.0.1 I believe was the last version that you could make the same version for everything play services related and everything else must follow the new versioning system
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
You can check googles maven repository for the latest version of any library
https://dl.google.com/dl/android/maven2/index.html
Also you should not include all of google play services in your project and you should only declare the libraries you need as this makes your app smaller.
When loading com.google.android.gms:play-services-* packages same version needs to be used in different packages.
I'm importing gms-location and gms-analytics using:
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-analytics:15.0.0'
I'm Using version 15.0.0 in both since location latest version is 15.0.1 yet analytics is skipping 15.0.1, latest is 15.0.2.
So 15.0.0 is the latest common release.
Versions list can be seen here:
https://dl.google.com/dl/android/maven2/index.html
Im getting an error about com.google.android.gms:ads-identifier (which imports itself somehow) it's version is 15.0.1 - the conflict creates runtime issues in release versions.
How do I get rid of ads-identifier ?
As you can see in the release notes, just like firebase, play services libs now have independent versions as well. So add them with their respective versions:
Google Play services libraries after 15.0.0 now have independent
version numbers
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:15.0.2'
Check as well if your gms plugin is up to date:
classpath 'com.google.gms:google-services:3.3.1'
I have a library project with submodules that include many dependencies that I'd like to pass to the developer's application. For example, module A may include all the necessary appcompat dependencies.
With the migration changes, I've updated all compile cases to api, which should not affect anything. However, I no longer have access to any of the libraries dependencies. I can only use code and references from my library itself.
Is there any way around this?
One of the build gradle files of my library submodules can be found here for reference.
The dependencies:
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib:${KOTLIN}"
api "com.android.support:appcompat-v7:${ANDROID_SUPPORT_LIBS}"
api "com.android.support:support-v13:${ANDROID_SUPPORT_LIBS}"
api "com.android.support:design:${ANDROID_SUPPORT_LIBS}"
api "com.android.support:recyclerview-v7:${ANDROID_SUPPORT_LIBS}"
api "com.android.support:cardview-v7:${ANDROID_SUPPORT_LIBS}"
api "com.android.support.constraint:constraint-layout:${CONSTRAINT_LAYOUT}"
api "com.mikepenz:iconics-core:${ICONICS}#aar"
api "com.mikepenz:google-material-typeface:${IICON_GOOGLE}.original#aar"
api "com.afollestad.material-dialogs:core:${MATERIAL_DIALOG}"
api "com.jakewharton.timber:timber:${TIMBER}"
api "org.jetbrains.anko:anko-commons:${ANKO}"
}
Edit:
To clarify, the sample project in the module actually does build properly, but there's an issue with using the dependencies in any other app, where it pulls from jitpack. See this gradle as an example that won't build.
I've tried using combinations of api, implementation, #aar, and transitive.
Come to think of it, this may be a jitpack issue and not a gradle issue, but if anyone else has a resolution I'd like to hear it.
I no longer have access to any of the libraries dependencies. I can only use code and references from my library itself.
It is correct.
From the gradle docs :
dependencies {
api 'commons-httpclient:commons-httpclient:3.1'
implementation 'org.apache.commons:commons-lang3:3.5'
}
Dependencies appearing in the api configurations will be
transitively exposed to consumers of the library, and as such will
appear on the compile classpath of consumers.
Dependencies found in the implementation configuration will, on the
other hand, not be exposed to consumers, and therefore not leak into
the consumers' compile classpath. This comes with several benefits:
dependencies do not leak into the compile classpath of consumers anymore, so you will never accidentally depend on a transitive
dependency
faster compilation thanks to reduced classpath size
less recompilations when implementation dependencies change: consumers would not need to be recompiled
cleaner publishing: when used in conjunction with the new maven-publish plugin, Java libraries produce POM files that
distinguish exactly between what is required to compile against the
library and what is required to use the library at runtime (in other
words, don't mix what is needed to compile the library itself and what
is needed to compile against the library).
The issue seems to be related to the android-maven-gradle-plugin
Issue Report
It's has been fixed in version "2.0" of android-maven-gradle-plugin
just update to
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
or using the new syntax since Gradle 2.1
plugins {
id "com.github.dcendents.android-maven" version "2.0"
}
using api in your library module allows you to access the transient dependencies only in your library code; not the apps that consume it.
so to achieve the desired effect you need to change in your sample module.
implementation project(':core')
to
api project(':core')
note you don't need to use api in your library it's better to use implementation as it speeds up your build.