[英]Android NDK-build process in Android Studio
I am trying to get the sample app of antidote running ( source code ). 我试图获得解毒剂运行的示例应用程序( 源代码 )。
I am confused as to how I need to run my app in Android Studio. 我对如何在Android Studio中运行我的应用程序感到困惑。 I put the C-source files in the
/jni
folder, installed Cygwin and run the command ../android/android-ndk-r10d/ndk-build NDK_PROJECT_PATH=app/src/main/
from in the /myworkspace/myApp
-folder. 我把C源文件放在
/jni
文件夹中,安装了Cygwin并在/myworkspace/myApp
-folder中运行命令../android/android-ndk-r10d/ndk-build NDK_PROJECT_PATH=app/src/main/
from 。
I don't seem to be getting any errors, and a /libs
folder has been created with in it a library, as depicted in the image below. 我似乎没有收到任何错误,并且已经创建了一个
/libs
文件夹,其中包含一个库,如下图所示。
However, when clicking the green run-button, Android Studio still gives errors in :app:compileDebugNdk
. 但是,当单击绿色运行按钮时,Android Studio仍会在
:app:compileDebugNdk
出现错误。 Since the code is compiled, does the ndk still need to be run? 由于代码是编译的,ndk是否仍然需要运行? How do I turn this off?
我怎么关掉这个? And do I still need to somehow install the library ndk-build has made?
我还需要以某种方式安装ndk-build所做的库吗?
This is my build.gradle
for the project: 这是我的项目
build.gradle
:
sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
And this is the build.gradle
for the Module: 这是Module的
build.gradle
:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.signove.health.service"
minSdkVersion 15
targetSdkVersion 21
}
sourceSets.main{
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
You're disabling automatic ndk-build calls from sourceSets.main{ jni.srcDirs = [ ] } Then you may want to make Gradle plugin call it adding the ndkBuild task . 你正在禁用来自sourceSets.main的自动ndk-build调用{ jni.srcDirs = [] }然后你可能想让Gradle插件调用它添加ndkBuild任务 。
Check this answer out: execution failed for task ':app:compileDebugNdk' failed to run this command ndk-build.cmd 检查这个答案: 任务执行失败':app:compileDebugNdk'无法运行此命令ndk-build.cmd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.