簡體   English   中英

使用Java CV時在Android Studio上獲取構建錯誤

[英]Getting a build error on android studio while using java cv

我無法在使用Java CV的android studio中成功構建gradle。
錯誤看起來像這樣:

Caused by: com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'org/bytedeco/javacpp/windows-x86/api-ms-win-crt-locale-l1-1-0.dll' 

我的build.gradle看起來像這樣

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.bytecoders.myapplication"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    compile group: 'org.bytedeco', name: 'javacv-platform', version: '1.4.2'

}

更新:
通過不使用依賴項中的整個javacv平台來解決此問題。
我發現,當我們使用整個javacv-platform進行Windows之類的android開發時,所有不必要的依賴關系都將OS X包含在等級中,從而導致冗余文件。
因此,僅包括我所需的依賴項,在這種情況下,例如:

  • JavaCV臂
  • OpenCV臂
  • FFmpeg手臂

嘗試:

 defaultConfig {
        ....
        multiDexEnabled true

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM