实验性 gradle 问题:android 插件必须应用于项目
Issue with experimental gradle: The android plugin must be applied to the project
我正在尝试 运行 在 Android Studio 中使用 NDK 编写一些本机代码。
我已按照显示的步骤进行操作 HERE
使用实验性的Gradle,但显然并不是一帆风顺。
我收到此错误:The android or android-library plugin must be applied to the project
这是我的 gradle 文件:
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;
}
}
任何关于为什么我会收到此错误的帮助将不胜感激
几周前我就遇到过这个问题。 com.neenbedankt.android-apt 插件需要 android 或 android-library 插件。
我给apt插件作者写了一封信https://bitbucket.org/hvisser/android-apt。
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?
回答。
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 大师,而且我没有足够的时间。
所以你应该只为 NDK 创建单独的模块(例如计算一些东西)。
尝试使用这个插件
https://bitbucket.org/pvoid/android-apt-experemental/overview
而不是android-apt
我正在尝试 运行 在 Android Studio 中使用 NDK 编写一些本机代码。
我已按照显示的步骤进行操作 HERE
使用实验性的Gradle,但显然并不是一帆风顺。
我收到此错误:The android or android-library plugin must be applied to the project
这是我的 gradle 文件:
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;
}
}
任何关于为什么我会收到此错误的帮助将不胜感激
几周前我就遇到过这个问题。 com.neenbedankt.android-apt 插件需要 android 或 android-library 插件。
我给apt插件作者写了一封信https://bitbucket.org/hvisser/android-apt。
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?
回答。
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 大师,而且我没有足够的时间。
所以你应该只为 NDK 创建单独的模块(例如计算一些东西)。
尝试使用这个插件
https://bitbucket.org/pvoid/android-apt-experemental/overview
而不是android-apt