实验性gradle的问题:android插件必须应用于项目 [英] Issue with experimental gradle: The android plugin must be applied to the project
问题描述
我正在尝试使用Android Studio中的NDK运行一些本机代码.
我已按照此处所示的步骤进行操作
使用实验性Gradle,但显然并非一帆风顺.
我收到此错误:The android or android-library plugin must be applied to the project
这是我的gradle文件:
I'm trying to run some native code with the NDK in Android Studio.
I have followed the steps shown HERE
to use the experimental Gradle, but obviously it's not all going smoothly.
I'm getting this error: The android or android-library plugin must be applied to the project
Here is my gradle file:
apply plugin: 'com.android.model.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'io.fabric'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
android.ndk {
moduleName = "test"
}
defaultConfig.with {
applicationId = "com.shaperstudio.dartboard"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
packagingOptions {
exclude = 'META-INF/services/javax.annotation.processing.Processor'
}
}
repositories {
maven {
url "https://jitpack.io"
}
maven { url 'https://maven.fabric.io/public' }
}
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'io.fabric.tools:gradle:1.+'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'de.greenrobot:eventbus:2.4.0'
apt 'com.bluelinelabs:logansquare-compiler:1.1.0'
compile 'com.bluelinelabs:logansquare:1.1.0'
compile 'com.birbit:android-priority-jobqueue:1.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: '*.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
transitive = true;
}
}
对于我为什么收到此错误的任何帮助,将不胜感激
Any help as to why I'm getting this error would be appreciated
推荐答案
几周前我就遇到了这个问题. com.neenbedankt.android-apt插件需要android或android-library插件.
I faced with this problem to some weeks ago. The com.neenbedankt.android-apt plugin require android or android-library plugin.
我写信给apt插件作者 https://bitbucket.org/hvisser/android-apt .
I wrote a letter to apt plugin author https://bitbucket.org/hvisser/android-apt.
你好! 谷歌几天前宣布了支持jni的android studio预览1.3.为此,他们使用插件com.android.model.application(类路径"com.android.tools.build:gradle-experimental:0.1.0").它与您的插件不兼容.我尝试做自己的fork,但是我在插件开发方面并不擅长.您要支持新插件吗?
Hello! Google announced android studio preview 1.3 with jni support few days ago. For this purpose they use plugin com.android.model.application (classpath "com.android.tools.build:gradle-experimental:0.1.0"). It is not compatible with your plugin. I tried to do my own fork, but I am not good in plugin development. Are you going to support new plugin?
答案.
在短期内不会,因为所需的钩子仍然丢失,并且由于很多变化,它似乎将被重写.您应该能够使用实验性插件为NDK创建单独的模块,并使用稳定插件为所有其他Android应用程序创建一个模块.
Not in the short term, since the required hooks are still missing and it looks like it would be a rewrite since a lot has changed. You should be able to create a separate module for NDK stuff using the experimental plugin, and another for all other Android stuff using the stable plugin.
我还尝试制作自己的android-apt分支,但我不是gradle专家,而且我没有足够的时间.
I also tried to make my own fork of android-apt, but I am not a gradle guru, and I have not enough time.
因此,您应该仅为NDK创建单独的模块(例如,计算某些内容).
So you should create separate module only for NDK (for example to compute something).
这篇关于实验性gradle的问题:android插件必须应用于项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!