问题描述
我目前正在运行OpenCV的样本为Android找到这里(我曾尝试与较新版本,但我跟着从this问题的答案)和我跑入误差
I am currently trying to run the OpenCV samples for Android found here (I have tried with more recent versions, but I followed the suggestion from this question's answer) and am running into the error
无法创建BuildConfig类
以及
OpenCV的-2.3.1] Android的要求编译器遵从性级别5.0或6.0。找到1.7来代替。请使用Android工具>修复项目
有关在第一个错误;我仍然无法找到一个解决方案;我试着在更换最新的OpenCV的建议(2.3.1)在答题mentioned上述而不是2.4.2(也试过2.4.0)。答案建议使用2.3.1确切的版本,但到目前为止,它似乎并没有这样的伎俩。
For the first error; I still cannot find a solution; I've tried replacing the latest OpenCV with that suggested (2.3.1) in the answer mentioned above instead of 2.4.2 (also tried 2.4.0). The answer advised to use the exact version 2.3.1, but so far it doesn't seem to do the trick.
有关在第二个错误,我想建议以下here通过调整的 JDK compilance 的版本,而且这一问题还没有得到解决。
For the second error, I tried following the suggestion here by adjusting the JDK compilance version but also that problem hasn't been solved.
下面是一些错误的快照:
Here's a snapshot of some of the errors:
是结果
- Eclipse的靛蓝结果
- Windows7的64位
Using:
- Eclipse Indigo
- Windows7- 64bit
我找不到多少帮助网上的问题,我一直在寻找出办法解决它有一段时间了。我跟着其中误差项确实是预期和看似简单的教程来消除,但他们没有那些问题本教程(下载完NDK最多时达到了这一点)。
I couldn't find much help online for the problem, I've been looking out for a way around it for some time now. I've followed the exact steps in this tutorial (done downloading the ndk and reached up to this point) where errors were indeed anticipated and seemingly easy to eliminate in the tutorial, but they're not as those in question.
感谢您提前。
推荐答案
下面是三种解决方案,结合,似乎做的伎俩(消除错误)。
Below are three solutions that, combined, seemed to do the trick (to eliminate the errors). The samples work fine now (tested on an Android 2.2 phone):
-
我注意到在本教程(似乎另一个版本
的,在问题的链接),说明
I've noticed a line in this tutorial (seems as another versionof that linked in the question) stating
如果您已经创建包目录的工作区,然后只需点击浏览按钮,并立即关闭目录选择对话框
点击OK按钮!
这似乎是一绝; 将包目录的
Eclipse工作空间即是。我已经看到了这个建议,也可以作为
回答
我有同时安装Android的API 11 从SDK管理器(前面
我只安装的是该API级别8和16)
在本教程推荐的最低水平。仅仅是安装
我做了所建议的答案的一个步骤
那里的问题提到类似的错误那些我有一个
发现试图建立样本。我不能确定这是否不过是
为什么错误消失的原因之一,因为我之前做了这个步骤
移动OpenCV库到Eclipse工作区没有检测
在据我记得之间的样本项目。
I've also installed Android API 11 from the SDK manager (earlierI've only installed the API levels 8 and 16) which was therecommended minimum level in the tutorial. The mere installation wasa step I've made as suggested in an answer to this questionwhere the question referred to an error similar to one of those I'vefound trying to build the samples. I am unsure however whether this wasone of the reasons why errors faded, since I did this step beforemoving the opencv library to the eclipse workspace with no testing ofthe sample projects in between as far as I recall.
我测试过的
然而,一个是Android2.2(API等级8)的手机样品(的不的模拟器。我不
知道这是可能的,因为在这个教程它提到,
只样本项目的教程0 的和的教程1 的将在一个工作
模拟器,从我的经验,到目前为止也没有),这是
也最低API级别(8)我OpenCV的样品在当前设置
清单文件,和它的工作。
I've tested thesamples on an Android2.2 (API level 8) phone however(not emulator. I'm notsure if that's possible since in this tutorial it mentioned thatonly sample projects Tutorial 0 and Tutorial 1 would work on anemulator, from my experience so far neither have), which isalso the minimum API level (8) currently set in my opencv samples'manifest files, and it worked.
最后,我不得不保持这个错误;
Lastly, I had this error remaining;
不能运行程序\\ NDK的构建:发射失败的项目名称的C / C ++
问题
这是很容易解决,但访问的项目属性
(每个项目需要),前往 C / C ++编译> 环保>
添加(看到表标题右侧的环境变量设置的>填写命名与 NDKROOT 的和提供
在值的NDK路径。从我已经参考
发现了这个建议(凡有存在其他选项),请检查
这
which was easily resolved but accessing the project properties(per needed project), heading to C/C++ Build > Environment >Add (seen to the right of the table heading Environment variables to set > fill in the Name with NDKROOT and provideyour ndk path in the Value. For the reference from which I'vefound this advice (and where there exist other options) please checkthis Q&A.
这是我为让OpenCV的样本为Android工作经验。
That was my experience for letting the OpenCV samples for Android work.
这篇关于OpenCV的样品获得"无法建立BuildConfig类"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!