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"
}
Related
I was trying to build an android apk using Jenkins but I am stuck with one failure message -
app: 'annotationProcessor' dependencies won't be recognized as kapt annotation
processors. Please change the configuration name to 'kapt' for these artifacts:
'com.android.databinding:compiler:3.1.0'.
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':stripe:check'.
Task with path 'checkstyle' not found in project ':stripe'.
I have added a third party module stripe in my project and in app level gradle file entry is -
implementation project(':stripe')
I don't know what's wrong is going on build with jenkins is failing all the time.
Note- Below is my stripe's gradle file -
apply plugin: 'com.android.library'
apply plugin: 'checkstyle'
// make sure this line comes *after* you apply the Android plugin
apply plugin: 'com.getkeepsafe.dexcount'
assemble.dependsOn('lint')
check.dependsOn('checkstyle')
You are using kotlin compiler and in kotlin we use "kapt" instead of "annotationProcessor". Check your "Stripe" project and changed gradle accordingly.
After removing below line from stripe's gradle and replacing all the app: 'annotationProcessor' dependencies to kapt , Jenkins is generating build successfully.
check.dependsOn('checkstyle')
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?
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.
I was just wondering why that line of code exists in my gradle configuration
Android gradle apply plugin: 'com.android.application'
Gradle is a general-purpose build system. It uses plugins to teach it how to build different types of software. com.android.application is a Gradle plugin that teaches Gradle how to build Android applications, just as com.android.library is a plugin that teaches Gradle how to build Android library projects. There are many plugins available for Gradle, to teach it how to build other sorts of systems or augment other plugins.
As describe in the official website:The first line in the build configuration applies the Android plugin for
Gradle to this build and makes the android block available to specify
Android-specific build options.
I have an Android project in IntelliJ IDEA. It consists of two modules: app and library. App depends on library and library depends on app (Yes, it's not good, but I have what I have and can't change this). IDEA in project settings warn me about circular dependencies, but project builds correctly. Project structure looks like this:
project
|__app
| |__src
| |__build.gradle
|__libarary
| |__src
| |__build.gradle
|__build.gradle
|__settings.gradle
Now I'm trying to migrate to new Android build system based on Gradle and have a trouble here. In my build.gradle from app module I add dependency on library
compile project(":library")
Also I tryed to add dependency in library on app like
compile project(":app")
But gets error from build system, when gradle trys to assemble library module:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> Module version project:app:unspecified depends on libraries but is not a library itself
What I can do with this without changing project structure
This parameters have changed.
You should now refactor:
In the library project use:
apply plugin: 'com.android.library'
In the app project use:
apply plugin: 'com.android.application'
In the library project use:
apply plugin: 'android-library'
In the app project use:
apply plugin: 'android'
Make sure you have the newest Android tools:
classpath 'com.android.tools.build:gradle:0.5.+'
If you arrive here searching for the same error with Android 3.0 you should know the current workaround is:
downgrade to kotlinVersion = '1.1.2-2'
and disable incremental build in gradle.properties kotlin.incremental=false
The issue is planned for the next alpha https://issuetracker.google.com/issues/38447344