The phrase 'matchingFallbacks is deprecated' is seen in gradle 7.3.1
What are the alternatives?
[
It seems it's an issue with the docs, according to this: https://developer.android.com/reference/tools/gradle-api/7.3/com/android/build/api/dsl/BuildType#matchingFallbacks() this property is not deprecated. Even the pop up on your screenshot from Android Studio states that it was replaced with matchingFallbacks.
Related
In current my android project i have use android gradle plugin version 2.3.0 but when i try to complier i have receive this warning
Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
i see in Google's Maven Repository and i see at com.android.tools.build -> gradle i don't found index of gradle version below 2.+
Did any one know is my assumption is true? If it true how can i found reference link for this announcement from google android official web site?
Thank you.
As the error states, you have to replace compile with implementation in dependencies since compile is obsolete.
Please check here for example.
(Kotlin version that is used for building with Gradle (1.2.71) differs from the one bundled into the IDE plugin (1.3.0))
How can I solve this?
In build.gradle, look for kotlin_version or kotlinVersion, and change it from 1.2.71 to 1.3.0 (Note: the version variable could also possibly be defined in another .gradle script in the project, or in gradle.properties, instead of build.gradle).
Download the project of Google IO 2018 (iosched), try to compile it in Android Studio 3.3 Canary 7, also the probe in 3.2 RC1. But I get the following error:
error: resource style/TextAppearance.MaterialComponents.BottomNavigationView.Colored (aka com.google.samples.apps.iosched:style/TextAppearance.MaterialComponents.BottomNavigationView.Colored) not found.
Checking the file style. xml, it is observed that fails to find the style TextAppearance.MaterialComponents.BottomNavigationView.Colored.
<style name="TextAppearance.IOSched.BottomNavigationView" parent="#style/TextAppearance.MaterialComponents.BottomNavigationView.Colored">
<item name="android:fontFamily">#font/google_sans</item>
<item name="android:textColor">#color/bottom_nav_item</item>
</style>
Also check that the Google Material components dependency if implemented.
implementation "com.google.android.material:material:$rootProject.materialVersion"
I can't understand why it might be making this mistake.
you can see here
https://github.com/google/iosched/issues/285#issuecomment-416114763
you can use the Android Studio Stable 3.2
use the last dependencies.
in the file iosched/gradle.properties,mofiy
androidGradlePluginVersion = '3.2.0'
materialVersion = '1.0.0'
kotlinVersion = '1.2.51'
in the file iosched/mobile/src/main/res/values/styles.xml
change
#style/TextAppearance.MaterialComponents.BottomNavigationView.Colored
to
#style/Widget.MaterialComponents.BottomNavigationView.Colored
I have managed to make it compile by installing android studio 3.2.0 beta 4.
as seen in the following image
with Android Studio 3.1.4 it builds, unless updating the outdated dependencies. there also is on open issue: https://github.com/google/iosched/issues/285
and it does complain much when building with ./gradlew build
once I've manually updated those beta01 versions to rc01 I also get that:
error: resource style/TextAppearance.MaterialComponents.BottomNavigationView.Colored (aka com.google.samples.apps.iosched:style/TextAppearance.MaterialComponents.BottomNavigationView.Colored) not found.
which basically means, that material-components-android is missing or outdated. to resolve this, you could simply copy the absent style from GitHub and manually add it into styles.xml or simply do not update that outdated library versions, until there is a final release of all those release candidates, which are not yet considered as "stable".
the bottom line may be, that it builds against materialVersion = '1.0.0-beta01' (which might contain that style), but not against materialVersion = '1.0.0-rc01' (which may lack that style).
maybe consider using a stable version of Android Studio, alike 3.1.4 - instead of using the canary channel and then complain it won't work; maybe you even build unknowingly against the rc01 version, because this is exactly the issue which I get when updating that library to rc01 - and the title of this question also boldly states RC01.
In order to maintain the version numbers of my gradle dependencies, I chose the below pattern.
In my project level build.gradle I added:
ext.versions = [
'kotlin_version' : '1.2.30',
'dagger' : '2.16'
]
And in my app module's build.gradle I added:
implementation "com.google.dagger:dagger:${versions.dagger}"
implementation "com.google.dagger:dagger-android-support:${versions.dagger}"
implementation "com.google.dagger:dagger-android:${versions.dagger}"
kapt "com.google.dagger:dagger-compiler:${versions.dagger}"
kapt "com.google.dagger:dagger-android-processor:${versions.dagger}"
But my problem is after doing this, I lost the lint warnings of "Newer Library versions available".
What is the correct way to do this without missing the lint checks?
Note: I have also tried other ways like moving these versions to gradle.properties file (for global variables).
I am looking for a solution inside Android Studio. There is one solution which I already found:
Analyze -> Run Inspection by name... -> Type "Newer Library Versions Available"
But my concern is, it is easy to miss on updates until we run some or the other script. That is why I am trying to find a way where dependency versions can be put in a variable and get lint warning for new updates.
See this answer: https://stackoverflow.com/a/46296198/2053763
There is a link to a gradle plugin which can check for dependency updates.
Android Studio 3.1.2 offers some lint checks while using version variables, but still misses some of the updates. See image below:
You can extract dependencies versions into variables stored in a separate Gradle file and then check and update them from the Project Structure (ctrl+alt+shift+S) (screenshot from Android Studio 3.6.3):
I didn’t work full-time with Android in the last couple of years, and now whenever I try to fork someone code on GitHub I get a lot of errors since android tools and Gradle syntax are changing frequently.
I wonder what is the best way to handle these changes, and be able to upgrade other GitHub projects and some of my old projects to work with the latest Android tools. Here are some of the things that I struggle with:
I noticed some of the issues are related to changes in the Gradle syntax. How can I know what Gradle version the build.grade syntax was written with? and then how to upgrade it to the current version (is there a migration guide for Gradle versions?).
Sometimes I get issues related to tools that are not compatible with others, how can I know which version are compatible with which? and whats the easy way to manage that? here are some of these tools:
Gradle
Android Plugin for Gradle
Build Tools
Android Studio
How can I know what Gradle version the build.grade syntax was written with?
If the project contains a gradle/wrapper/gradle-wrapper.properties file, that is the version of Gradle that the developer of the project is using.
is there a migration guide for Gradle versions?
I am not aware of much Gradle syntax that would have changed that would affect Android developers for garden-variety projects. Most of the changes are from the DSL added via the Gradle for Android plugin. You can find the version of the plugin that the project developer was using via the classpath statement in the project's top-level build.gradle file.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
The above snippet is requesting version 1.3.0 of the Gradle for Android plugin.
Migration documentation for the Gradle for Android plugin is minimal. What there is can be found up on http://tools.android.com.
how can I know which version are compatible with which?
Here is Google's statement on the issue, though this has not been updated in a few months.
and whats the easy way to manage that?
If the tools complain, change them to a set that you know is good (e.g., by copying values from a known-working project). If you need something that was introduced in a newer version of the tools, change them to a set that you know is good. Otherwise, don't worry about them.