在 Android Studio 中使用OpenCV所遇到问题

二、遇到错误:

Error:Execution failed for task ‘:app:compileDebugNdk’.> com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException: Process ‘command ‘C\:\\Tools\\adt-bundle-windows-x86_64-20140702\\android-ndk-r10c\\ndk-build.cmd” finished with non-zero exit value 2

1. May be this is known NDK bug. Try to add empty .c file to your jni dir (like empty.c).2. Try adding this to the build.gradle file:android {…sourceSets.main {jni.srcDirs = [ ]}}注:可能是NDK的Bug,在编译时,,还必须在jni目录生成一个空的.c文件。

三、遇到错误

Error:Error: NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin. For details, see Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.

Here is how to solve this issue :

add gradle.properties file to root folder of your projectadd ‘android.useDeprecatedNdk=true’ to gradle.properties file

Here is my gradle.properties :

# Project-wide Gradle settings.# IDE (e.g. Android Studio) users:# Gradle settings configured through the IDE *will override*# any settings specified in this file.# For more details on how to configure your build environment visit# # Specifies the JVM arguments used for the daemon process.# The setting is particularly useful for tweaking memory settings.# Default value: -Xmx10248m -XX:MaxPermSize=256m# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8# When configured, Gradle will run in incubating parallel mode.# This option should only be used with decoupled projects. More details, visit# #sec:decoupled_projects# org.gradle.parallel=trueandroid.useDeprecatedNdk=true

And add it to root of your project :

And rebuild your project.

四、遇到错误

"com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\Program Files\Java\jdk1.8.0_60\bin\java.exe” finished with non-zero exit value 2"

导致原因:项目中出现了重复的依赖。删除依赖项便可很容易地解决该问题。

版权声明:本文为博主原创文章,未经博主允许不得转载。

在认识你之后,我才发现自己可以这样情愿的付出……

在 Android Studio 中使用OpenCV所遇到问题

相关文章:

你感兴趣的文章:

标签云: