OpenCV样本获得“无法创建BuildConfig类” [英] OpenCV samples get "Failed to create BuildConfig class"

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

问题描述

我目前正在尝试运行针对Android的OpenCV样本,(完成下载ndk并达到这一点),其中错误确实是预期的,并且在教程中看起来很容易消除,但它们并不是这些问题。



提前谢谢。

解决方案

,结合起来,似乎在诀窍(消除错误)。样本现在可以正常工作(在Android 2.2手机上测试):




  • 我注意到这个教程(似乎是在该问题链接的另一个版本
    )说明


    如果您已经在包目录中创建了工作空间,那么只需单击浏览...按钮,并立即关闭目录选择对话框
    与确定按钮!


    这似乎是必须的; 将包目录放在
    eclipse工作区中。我已经看到这个建议也是一个
    的答案,这个问题。


  • 我有也从SDK经理安装了Android API 11 (早期
    我只安装了API级别8和16),这是教程中
    推荐的最低级别。根据
    的回答建议,只需安装
    a步骤问题
    其中的问题提到一个类似于我已经
    之一的错误发现尝试构建样本的错误。我不确定这是否是
    为什么错误消失的原因之一,因为我在
    之前执行了这个步骤,将opencv库移动到eclipse工作空间,没有测试
    中间的示例项目据我所知



    我已经在Android2.2(API 8级)手机上测试了
    样本(不是 m不是
    确定如果这是可能的,因为在这个教程,它提到
    仅示例项目教程0 教程1 将工作一个
    模拟器,根据我迄今为止的经验,也没有),这是
    也是目前在我的opencv示例'
    清单文件中设置的最小API级别(8),它的工作。 p>


  • 最后,我还有这个错误;


    无法运行程序 \\\
    dk-build:启动失败项目名称 C / C ++
    问题


    其中很容易解决,但访问项目属性
    (根据需要的项目),标题为 C / C ++ B uild > 环境>
    添加(见表格标题右侧的要设置的环境变量>填写名称 NDKROOT ,并在中提供
    您的ndk路径。为了参考我从
    发现这个建议(和哪里有其他选项)请检查
    这个 Q& A




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


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

Failed to create BuildConfig class

as well as

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

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.

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:

Using:
- Eclipse Indigo
- Windows7- 64bit

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.

Thank you in advance.

解决方案

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

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

    This seems as a must; placing the package directory in the eclipse workspace that is. I've seen this recommendation also as an answer to this question.

  • 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.

    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;

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

    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.

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

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

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