我正在尝试使用" Multiple NDK Projects"实验gradle插件的功能。我正在使用Android Studio 2.1和gradle插件0.7.0稳定。该博客似乎表示在编译期间将包含本机库的exportedHeaders部分中指定的头文件
exportedHeaders {
srcDir "src"
}
这对我来说似乎不起作用。比方说我有以下文件夹结构,我希望Addition.h在native.cpp中可用,即我应该可以说
#include <Addition.h>
但仅
#include "../../../../../../../Framework/Addition/src/Addition.h"
的工作原理。添加cppFlags以包含标题没有区别。
以下是一些相关文件查找示例项目的方式。示例项目模块&#34; app&#34;取决于本机库模块&#34;添加&#34;添加2个数字。本机库使用新的本机插件。
settings.gradle
include ':app'
include ':Addition'
project (":Addition").projectDir = new File("../../../Framework/Addition")
gradle-wrapper.properties
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
build.gradle(:app)
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
ndk {
moduleName = 'native'
platformVersion = 17
toolchain "clang"
cppFlags.addAll(['-I' + file('src/main/jni'),
'-I' + file('../../../Framework/Addition')])
}
sources {
main {
jni {
dependencies {
project ':Addition' linkage 'static'
}
}
}
}
defaultConfig {
applicationId "com.harkish.nativepluginexample"
minSdkVersion.apiLevel 21
targetSdkVersion.apiLevel 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
}
build.gradle(:Addition)
apply plugin: 'com.android.model.native'
model {
android {
compileSdkVersion = 23
buildToolsVersion = '23.0.2'
defaultConfig {
minSdkVersion.apiLevel = 21
targetSdkVersion.apiLevel = 23
versionCode = 1
versionName = '1.0'
}
ndk {
moduleName = 'addition'
}
sources {
main {
jni {
source {
srcDir "src"
}
exportedHeaders {
srcDir "src"
}
}
}
}
}
}
有人解决了这个问题吗?想法?