Android Crashlytics and Gradle 4.10.1 'varient.getExternalNativeBuildTasks()' warning - android

Just upgraded to the latest Gradle build and am getting the following warning:
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
I know it's caused by the fabric plugin because removing apply plugin: 'io.fabric' from my app's build.gradle file removes the error when syncing.
Anyone know when fabric will update their plugin to conform to the new Gradle standard or how to manually change the code? I see exactly the problem, but don't know how or if I can change that line of code within fabric myself.
I don't think it's a functional problem yet, but really annoying to see each time I sync the gradle file.

This has been fixed in the 1.28.0 release of the gradle plugin
Users should have this in their top-level build.gradle:
buildscript {
repositories {
// ... repositories, etc. ...
}
dependencies {
// ...other dependencies ...
classpath 'io.fabric.tools:gradle:1.28.0'
}
}
Other details
https://issuetracker.google.com/issues/116408637
https://github.com/firebase/firebase-android-sdk/issues/198#issuecomment-473435453
https://docs.fabric.io/android/changelog.html#march-15-2019

Related

How to run "Watchface for wearos" codelab?

I am new to Android and WearOS and also to Gradle, and I just want to follow along this Codelab:
https://codelabs.developers.google.com/codelabs/watchface/index.html#0
So I downloaded Android Studio and imported the project
https://github.com/googlecodelabs/watchface
but when compiling I just get the error
Failed to resolve: com.google.android.support:wearable:2.0.0
I already tried to change SDK Versions and other things, but it didn't help.
I'm pretty sure it's just a few version settings, but I have no idea where to look.
Did anyone maybe complete this codelab and made it run with the "actual" version of AndroidStudio?
thanks,
Thorsten
The code on github was last updated in May 2017, which is a shame, as it is a useful introduction to watchfaces. A number of things have changed since then. There is even a pull request on github with gradle updates from Nov 2018, but it hasn't been merged.
Your 'Failed to resolve' error is likely related to Google now providing some packages in their own Maven repository, in addition to jcenter.
This can be fixed by adding google() to the repositories closures in the Package build.gradle file:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
The version of the gradle plugin has been changed to 4.0.2 above too, so also update the file gradle-wrapper.properties with:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Gradle should now build, but it may still log some warnings or errors in the Build window which you can open at the bottom of Android Studio.
The gradle dependency keyword 'provided' has been replaced with 'compileOnly' and 'compile' with 'implementation'. Shift+Ctrl+R in Android Studio will enable you to easily do the replacement project-wide.
It should also be useful for updating compileSdkVersion and targetSdkVersion (to 30) and buildToolsVersion (to 30.0.2) in all the module build.gradle files.
The package versions are out of date, with the wearable ones currently at 2.8.1 and play-services-wearable at 17.0.0. Ctrl+Alt+Shift+S takes you to 'Suggestions' in 'Project Structure', which can help you in future to stay current.
The last problem is that the Android Support Library has been obsoleted in favor of jetpack/androidx. See the old reference.
In this project, it is only a problem in the build.gradle of module 5-palette. You may replace 'com.android.support:palette-v7:23.3.0' with 'androidx.palette:palette:1.0.0'. See Jetpack Artifact Mappings. You then need to change the import statement in MyWatchFaceService.java.
Finally add the following line to gradle.properties:
android.useAndroidX=true

The Android Gradle plugin supports only Crashlytics Gradle plugin version 1.25.4 and higher

After couple of months of not working on my app I have decided to continue and before doing so I wanted to update all dependencies, libraries etc.
After 3h+ of a nightmare with googles nonsense I am at the final (probably not even close) stage.
This error of:
The Android Gradle plugin supports only Crashlytics Gradle plugin
version 1.25.4 and higher.
Is driving me nuts. I did a global search on my project of 1.25.4 and 1 result came up which was for the classpath 'io.fabric.tools:gradle:1.25.1' so I changed it to classpath 'io.fabric.tools:gradle:1.25.4' and hoped for the best.. But the same error keeps coming up every time I am trying to build the app..
Can anyone tell me what kind of magic potion should I spray this gradle so it actually starts to work?
add this to the root project's build.gradle:
buildscript {
repositories {
...
maven { url "https://maven.fabric.io/public" }
}
dependencies {
...
classpath "io.fabric.tools:gradle:1.26.1"
}
}
and this on top of the module level's build.gradle:
apply plugin: "io.fabric"

Google Cloud Speech API protobuf is causing 'debugAndroidTestCompile' not found

I have copied and compiled the source code for speech api last month on this location https://github.com/GoogleCloudPlatform/android-docs-samples/tree/master/speech/Speech
and works. Now, when I revisited it, I'm having a Configuration with name 'debugAndroidTestCompile' not found. error.
What is causing this? If you ask me how did I know it is the one, I did the process of elimination. I removed one by one on the gradle file and sync. When I removed apply plugin: 'com.google.protobuf' the error disappears.
Update the protobuf version to the latest in build.gradle. Currently it's 0.8.8, check the latest version from the GitHub repository Protobuf Plugin for Gradle.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
}
}

Error when migrating Crashlytics to Firebase Android

I'm basically following the migration guide from within Crashlytics (which is pretty much summarized in this post).
I followed the same instructions verbatim, you can see that from my git diff:
Yet when I sync my Gradle, I get this error:
5:02 PM Gradle sync failed: Could not find method compile() for
arguments [com.google.firebase:firebase-core:11.4.2] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Update
As mentioned in the comments (and as experienced by us at the end), we shouldn't migrate anyway until further notice:
Update 2
In fabric, if you click on Crashlytics, there is a link on the left nav bar that says Firebase, when you click on it you get this ad
The buildscript block is not a place for your application level dependencies. See this answer for more information on the buildscript block.
You need to place your compile or implementation/api(for gradle 3.4+ and android gradle plugin 3.0+) dependencies into the separate dependencies{} block with the rest of your dependencies, that is usually on the same level as your android plugin configuration.
In your project level grade file, you need to add, maven {
url 'https://maven.fabric.io/public'
} to the repositories.
add the following to your dependencies classpath 'io.fabric.tools:gradle:1.25.1''
In your app level Gradle file put apply plugin: 'io.fabric' below apply plugin: 'com.android.application' and under depencies place this implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true
}
place apply plugin:'com.google.gms.google-services' at the bottom of the app level gradle file.
Change compile '...' to implementation '...'
You are using Google Services plugin 3.0.0. The instructions for adding the Crashlytics SDK indicate that 3.1.2 or higher is required:
Note: Crashlytics requires Google Services plugin version 3.1.2 or
higher. Check the com.google.gms:google-services version number in
your project's build.gradle dependencies.

How to find out which the latest version of any dependency we include in Gradle is?

In gradle I do not use dynamic versions because that could lead to indeterminate builds.
So I state my dependencies like so:
compile 'com.squareup.okhttp:okhttp:2.2.0'
However, how do I find out if there is a new version available and what its number is?
You can use a gradle-versions-plugin to do it. This plugin provides a dependencyUpdates task, which
Displays a report of the project dependencies that are up-to-date, exceed the latest version found, have upgrades, or failed to be resolved.
All you need to do, is to apply, by configuration of build.script dependencies, as:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
// classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5' // uncomment if you're using Gradle 1.x
}
}
And applying the plugin itself, with:
apply plugin: 'com.github.ben-manes.versions'
You could use this site to search your library latest version.

Categories

Resources