OpenCV的样品获得"无法建立BuildConfig类" [英] OpenCV samples get "Failed to create BuildConfig class"

查看:255
本文介绍了OpenCV的样品获得"无法建立BuildConfig类"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在运行OpenCV的样本为Android找到<一href=\"http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.3.1/OpenCV-2.3.1-android-bin.tar.bz2/download\"相对=nofollow>这里(我曾尝试与较新版本,但我跟着从<一的建议href=\"http://stackoverflow.com/questions/9198949/errors-importing-opencv-in-eclipse-wont-go-away\">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类

Failed to create BuildConfig class

以及

OpenCV的-2.3.1] Android的要求编译器遵从性级别5.0或6.0。找到1.7来代替。请使用Android工具>修复项目

OpenCV-2.3.1] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project

有关在第一个错误;我仍然无法找到一个解决方案;我试着在更换最新的OpenCV的建议(2.3.1)在答题<一个href=\"http://stackoverflow.com/questions/9198949/errors-importing-opencv-in-eclipse-wont-go-away\">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.

有关在第二个错误,我想建议以下<一个href=\"http://stackoverflow.com/questions/7637144/android-requires-compiler-compliance-level-5-0-or-6-0-found-1-7-instead-plea\">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

我找不到多少帮助网上的问题,我一直在寻找出办法解决它有一段时间了。我跟着<一个具体步骤href=\"http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_binary_package.html#get-the-opencv-package-for-android-development\"相对=nofollow>其中误差项确实是预期和看似简单的教程来消除,但他们没有那些问题本教程(下载完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 version of that linked in the question) stating

如果您已经创建包目录的工作区,然后只需点击浏览按钮,并立即关闭目录选择对话框
  点击OK按钮!

If you have created workspace in the package directory, then just click Browse... button and instantly close directory choosing dialog with OK button!

这似乎是一绝; 将包目录
Eclipse工作空间即是。我已经看到了这个建议,也可以作为
回答这个问题

我有同时安装Android的API 11 从SDK管理器(前面
我只安装的是该API级别8和16)
在本教程推荐的最低水平。仅仅是安装
我做了所建议的答案的一个步骤这个问题
那里的问题提到类似的错误那些我有一个
发现试图建立样本。我不能确定这是否不过是
为什么错误消失的原因之一,因为我之前做了这个步骤
移动OpenCV库到Eclipse工作区没有检测
在据我记得之间的样本项目。

I've also installed Android API 11 from the SDK manager (earlier I've only installed the API levels 8 and 16) which was the recommended minimum level in the tutorial. The mere installation was a step I've made as suggested in an answer to this question where the question referred to an error similar to one of those I've found trying to build the samples. I am unsure however whether this was one of the reasons why errors faded, since I did this step before moving the opencv library to the eclipse workspace with no testing of the sample projects in between as far as I recall.

我测试过的
然而,一个是Android2.2(API等级8)的手机样品(的的模拟器。我不
知道这是可能的,因为在<一个href=\"http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/O4A_SDK.html#open-opencv-library-and-samples-in-eclipse\"相对=nofollow>这个教程它提到,
只样本项目的教程0 的和的教程1 的将在一个工作
模拟器,从我的经验,到目前为止也没有),这是
也最低API级别(8)我OpenCV的样品在当前设置
清单文件,和它的工作。

I've tested the samples on an Android2.2 (API level 8) phone however(not emulator. I'm not sure if that's possible since in this tutorial it mentioned that only sample projects Tutorial 0 and Tutorial 1 would work on an emulator, from my experience so far neither have), which is also 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 ++
  问题

Cannot run program "\ndk-build": Launching failed PROJECT NAME C/C++ Problem

这是很容易解决,但访问的项目属性
(每个项目需要),前往 C / C ++编译> 环保>
添加(看到表标题右侧的环境变量设置的>填写命名 NDKROOT 的和提供
值的NDK路径。从我已经参考
发现了这个建议(凡有存在其他选项),请检查
Q&安培; A

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 provide your ndk path in the Value. For the reference from which I've found this advice (and where there exist other options) please check this Q&A.

这是我为让OpenCV的样本为Android工作经验。

That was my experience for letting the OpenCV samples for Android work.

这篇关于OpenCV的样品获得&QUOT;无法建立BuildConfig类&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆