Recently I have had to update my project to use Gradle 4.4 from 4.1.
i.e.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
in my gradle-wrapper.properties file.
However, this is incompabitble with the fabric plugin
apply plugin: 'io.fabric'
As since the gradle update, I now get build errors when syncing my project.
Such as:
Error:Could not get unknown property 'manifestFile' for task
':Module:generateVariantFlavorRFile' of type
com.android.build.gradle.internal.res.GenerateLibraryRFileTask.
Does anyone know when/if there will be a new plugin update that is compatible with gradle 4.4+?
So my project included feature modules, where in the the base module's build.gradle, I apply the fabric plugin. i.e. apply plugin: 'io.fabric'
It turns out that gradle version 4.4 + does work but you need to add the following:
crashlytics { instantAppSupport true }
in your base module's build.gradle. I didn't actually have an instant app, but even with feature modules in appears that this line is needed.
More info on how this can be added can be found here:
How do I integrate Crashlytics with Android Instant Apps?
Related
I am following the AWS docs, here. I am able to add everything into my project's build.gradle, AndroidManifest.xml, and app's build.gradle EXCEPT for the apply plugin. When I add:
apply plugin: 'com.amazonaws.appsync'
I get the following error:
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.amazonaws.appsync']
How do I fix this? When I remove the apply plugin from the app's build.gradle, then my app works again.
Did you try updating you gradle version and is your android studio also in the latest state, follow this thread and also update your question with the project's build.gradle file
https://stackoverflow.com/a/37091489/1503130
I updated my Android Studio version to 3.2. Now I am facing following error for my project - com.novoda.gradle.release.AndroidLibrary$LibraryUsage.getDependencyConstraints()Ljava/util/Set;
Currently I am using gradle version 4.6.
Issue link https://github.com/novoda/bintray-release/issues/177 says to downgrade gradle version to 4.4 but minimum supported version for Android Studio 3.2 is 4.6.
How to resolve this error.
I solved the same error by changing the order of the plugins in your build.gradle file to :
//has to be BEFORE 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
apply plugin: 'com.android.library'
The solution is stated here - Take a look at : Issue III.
While keeping the distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip in my gradle-wrapper.properties file.
This solution worked for me:
As Bintray has fixed the issue in its new release i.e. 0.9 so adding that in build.gradle (project) files removes the error.
classpath 'com.novoda:bintray-release:0.9'
You will either need to downgrade back to AS 3.1.x or attempt the workarounds described on the Novoda issue you linked. Namely this plugin...
I need gradle ver 2.1.4 so I tried changing
classpath 'com.android.tools.build:gradle:2.1.3'
to
classpath 'com.android.tools.build:gradle:2.1.4'
but it didn't work. I also tried this method http://devdeeds.com/update-gradle-plugin-android-studio/ but that didn't work either.
This is the error that I am getting
Error:Could not find com.android.tools.build:gradle:2.1.4. Searched in
the following locations:
file:/C:/Users/Reimu/Downloads/android-studio-ide-145.3200535-windows/android-studio/gradle/m2repository/com/android/tools/build/gradle/2.1.4/gradle-2.1.4.pom
file:/C:/Users/Reimu/Downloads/android-studio-ide-145.3200535-windows/android-studio/gradle/m2repository/com/android/tools/build/gradle/2.1.4/gradle-2.1.4.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.4/gradle-2.1.4.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.4/gradle-2.1.4.jar
Required by:
:MyApp:unspecified
I can't run any projects without this being updated apparently.
Any help is appreciated
The classpath 'com.android.tools.build:gradle:2.1.3' is not for Gradle itself, but the Gradle Android build plugin that you apply with the apply plugin: 'com.android.application' or apply plugin: 'com.android.library' in your module's build.gradle file.
If you want to use another version of gradle in your project, reconfigure your gradle wrapper. Search for the /gradle/wrapper/gradle-wrapper.properties file in your project root, and apply the correct distributionUrl, for example:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
For the 2.14.1 version of gradle. This is probably what you need, because there is no such thing as Gradle v. 2.1.4. There is also no Android Gradle plugin v. 2.1.4.
And if it turns out, that you need the newest android grade build plugin, then change your class path to 'com.android.tools.build:gradle:2.2.0-beta2'. Version 2.1.3 is currently the newest stable version.
Is there any way or workarounds or just hints to make plugins from gradle and gradle-experimental working together?
For example to mix those two versions:
com.android.tools.build:gradle:1.3.1
com.android.tools.build:gradle-experimental:0.3.0-alpha4
I have an existing project which uses some external plugins (app/build.gradle):
apply plugin: 'com.android.model.application'
apply plugin: 'com.android.databinding'
apply plugin: 'com.jakewharton.hugo'
in my root build.gradle I have:
com.android.tools.build:gradle-experimental:0.3.0-alpha4
Issues which I have:
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.databinding']
> java.lang.NullPointerException (no error message)
or
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.jakewharton.hugo']
> 'android' or 'android-library' plugin required.
Without other plugins my project works fine (I have Android Library with some NDK code which is called from my main project. Problem occurs when I add mentioned plugins on any others.
And the question is - is it a gradle-experimental issue or issue of each plugin (hugo, databinding, apt, probably much more).
Or maybe you have any hints if there is any other way to have app with current stable gradle plugin and library (with NDK code) which uses gradle-experimental?
What I want to avoid is a dealing with *.mk files and (as full as possible) Android Studio support. Bigger picture is to prepare .aar library with NDK code (just simple computation) which will be able to plug in to existing projects.
I've been able to mix gradle stable and -experimental android plugins without any issues by using recent versions in my project.
You should be able to define both dependencies inside your project's build.gradle file:
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.3.0-alpha7'
classpath 'com.android.tools.build:gradle:1.4.0-beta6'
}
and then either use apply com.android.(application|library) or com.android.model.(application|library) from your various module's build.gradle files.
Haven't used experimental plugin yet, but I guess, you can divide your project into 2 Gradle modules and use standard Android Gradle Plugin for the application module and new experimental plugin in the NDK module.
#ph0b is right, I am just giving an update of that answer.
you will need in your gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
and in your project build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath "com.android.tools.build:gradle-experimental:0.7.3"
}
I understand as Gradle is build tool and android provide plugin for android build.
When Gradle meet "apply plugin : 'android'" gradle-0.13.3.jar will be downloaded somewhere. right??
But I can not find android plugin anywhere.
How does Gradle build android using plugin ??
apply plugin: "xyz" applies a plugin that's already on the build class path. To get a third-party plugin such as the Android plugin on the build class path, a plugin dependency has to be specified in a buildscript block. For details on this, check the Gradle User Guide or the Android Gradle plugin docs.
(Gradle 2.1 introduces a new plugins block that allows to apply plugins available from http://plugins.gradle.org/ without specifying a plugin dependency.)