我得到这个:

错误:使用操作系统独立路径'lib / armeabi-v7a / libopencv_java3.so'找到了多个文件

我尝试将这段代码放在gradle中:

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

然后我得到这个错误:

错误:使用操作系统独立路径'lib / armeabi-v7a / libMyLibs.so'找到多个文件

所以我添加了这个:
packagingOptions{
    exclude 'lib/armeabi-v7a/libopencv_java3.so'
    exclude 'lib/armeabi-v7a/libMyLibs.so'
}

它运行良好,但是由于出现此错误,所以无法将其安装在设备上:

无法完成 session :INSTALL_FAILED_NO_MATCHING_ABIS:无法提取本机库,res = -113

这意味着它不能安装在这种类型的体系结构上。因此,我认为排除armeabi-v7a并不是答案。

这是我在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')
}

提前致谢!

最佳答案

也许您可以尝试一下:

packagingOptions{
  pickFirst 'xxxxx.so'
}

关于android - 使用操作系统独立路径 'lib/armeabi-v7a/libopencv_java3.so'找到了多个文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48749876/

10-12 17:28