Mixing android plugins from gradle and gradle
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.
还没有使用实验性插件,但我想,您可以将您的项目划分为2个Gradle模块,并在NDK模块中为应用程序模块和新的实验性插件使用标准Android Gradle插件。
@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"
}
链接地址: http://www.djcxy.com/p/88556.html
上一篇: 如何擦除行/列?