jojaba
jojaba

Reputation: 31

More than one file was found with OS independent path 'lib/armeabi-v7a/libopencv_java3.so'

I'm getting this:

error: More than one file was found with OS independent path 'lib/armeabi-v7a/libopencv_java3.so'

I tried putting this block of code in my gradle:

packagingOptions{
exclude 'lib/armeabi-v7a/libopencv_java3.so'
}

Then I get this error:

error: More than one file was found with OS independent path 'lib/armeabi-v7a/libMyLibs.so'

So I added this:

packagingOptions{
    exclude 'lib/armeabi-v7a/libopencv_java3.so'
    exclude 'lib/armeabi-v7a/libMyLibs.so'
}

And it built fine, but I can't install it on my device because I get this error:

Failed to finalize session : INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113

Which means that it can't be installed on this type of architecture. So I don't think excluding armeabi-v7a is the answer.

Here's what I have in Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.citytelecoin.opencvfacetest"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    sourceSets.main {
        jni.srcDirs = [] //disable automatic ndk-build call
    }

    task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
        commandLine "/home/liane/Android/Sdk/ndk-bundle/ndk-build",
                'NDK_PROJECT_PATH=build/intermediates/ndk',
                'NDK_LIBS_OUT=src/main/jniLibs',
                'APP_BUILD_SCRIPT=src/main/jni/Android.mk',
                'NDK_APPLICATION_MK=src/main/jni/Application.mk'
    }

    tasks.withType(JavaCompile) {
        compileTask -> compileTask.dependsOn ndkBuild
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    externalNativeBuild {
        ndkBuild {
            path 'src/main/jni/Android.mk'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation project(':openCVLibrary320')
} 

Thanks in advance!

Upvotes: 3

Views: 2635

Answers (1)

Tommy
Tommy

Reputation: 179

Maybe you can try it:

packagingOptions{
  pickFirst 'xxxxx.so'
}

Upvotes: 1

Related Questions