2016-05-24 60 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

非常感謝! –