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
I faced with this problem to some weeks ago. The com.neenbedankt.android-apt plugin require android or android-library plugin.
I wrote a letter to apt plugin author https://bitbucket.org/hvisser/android-apt.
Answer.
I also tried to make my own fork of android-apt, but I am not a gradle guru, and I have not enough time.
So you should create separate module only for NDK (for example to compute something).
Try to use this plugin
https://bitbucket.org/pvoid/android-apt-experemental/overview
instead of android-apt