2016-05-24 62 views
-1

https://github.com/mustafaakin/image-matcher一些奇怪的android错误

我用AndroidStudio的“Import Eclipse Studio Project”导入了这个项目。将.properties'OpenCV - x.x.x'编辑为'opencv'。这是错误:

/home/uttaran/Downloads/h1/h/src/main/res/layout/main_layout.xml 
Error:(62) No resource identifier found for attribute 'camera_id' in package 'in.mustafaak.imagematcher' 
Error:(62) No resource identifier found for attribute 'show_fps' in package 'in.mustafaak.imagematcher' 
Error:Execution failed for task ':h:processDebugResources'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/uttaran/Android/Sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1 
Information:BUILD FAILED 
+1

请记下代码和错误与正确的格式,并删除图像 – Miki

+0

项目是否有文件的build.gradle?因为我没有看到任何。 –

回答

1

正如丹尼尔ķ已经正确地指出:

重要的Android应用程序/库Android Studio中,要导入该项目需要的build.gradlePOM .xml文件,以便Android Studio自带的构建系统(Gradle/Maven)可以在项目导入过程中解决依赖关系等问题...

您引用的Github项目也是这样吗? https://github.com/mustafaakin/image-matcher 显然它得到了书面与Eclipse IDE ......推到Github上没有任何build文件...

您仍然可以导入,通过手动创建一个的build.gradle文件在项目的根和然后尝试再次导入该应用程序。

一个可能的工作的build.gradle文件(取决于你的Android Studio的摇篮插件版本等我刚才假设你复制从你的工作项目您的build.gradle文件)将是:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion '23.0.3' 
    defaultConfig { 
     minSdkVersion 21 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    productFlavors { 
    } 
} 

repositories { 
    mavenCentral() 
    flatDir { 
     dirs 'libs' 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.google.android.gms:play-services-base:8.4.0' 
    compile 'com.android.support:support-v4:23.3.0' 
    compile 'com.android.support:appcompat-v7:23.3.0' 
} 

如果你这样做,它可能不会找到OpenCV库依赖项(OpenCV类/方法和导入下的红线),你必须在Android Studio中去: 文件|项目结构| image-matcher-master |依赖关系| +

在那里你添加你的OpenCV库作为“文件依赖”...如果它是一个JAR ...否则,如果你的下载文件夹中的opencv是源...你也可以在Android Studio中加载,选择“模块依赖”。

如果这行不通......这可能是有用的,以及: http://docs.opencv.org/3.0-beta/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html

UPDATE:

main_layout.xml包含喜欢的东西:

<org.opencv.android.NativeCameraView 
      android:id="@+id/tutorial1_activity_native_surface_view" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:onClick="cameraclick" 
      android:visibility="gone" 
      opencv:camera_id="any" 
      android:layout_weight="1" 
      opencv:show_fps="true" /> 

所以你OpenCV库带有无法找到的资源和视图,因此您的项目中的src结构仍然存在问题。 这个答案可能与: Android Studio can't find opencv modules, but compiles ok

如果实在不行,我会建议导入一个OpenCV的Android的样本,检查是否建立和编译,然后从你的项目中的src结构差异比较示例项目...

Open the Android native Camera using OpenCV

+0

非常感谢! –