微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

任务 ':simple_edge_detection:externalNativeBuildDebug' 执行失败

如何解决任务 ':simple_edge_detection:externalNativeBuildDebug' 执行失败

在这里使用 simple_edge_detection 库:

https://www.flutterclutter.dev/flutter/tutorials/implementing-edge-detection-in-flutter/2020/1509/

CMakeLists.txt

cmake_minimum_required(VERSION 3.4.1)
include_directories(../include)
add_library(lib_opencv SHARED IMPORTED)
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libopencv_java4.so)
set(EDGE_DETECTION_DIR "../ios/Classes")
set(SOURCES
    ${EDGE_DETECTION_DIR}/native_edge_detection.cpp
    ${EDGE_DETECTION_DIR}/edge_detector.cpp
    ${EDGE_DETECTION_DIR}/image_processor.cpp
)
add_library(native_edge_detection SHARED ${SOURCES})
target_link_libraries(native_edge_detection lib_opencv)

build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$FlutterRoot/packages/Flutter_tools/gradle/Flutter.gradle"

android {
    compileSdkVersion 28
  //  flavorDimensions "default"

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // Todo: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "dev.Flutterclutter.simple_edge_detection_example"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode FlutterVersionCode.toInteger()
        versionName FlutterVersionName
        externalNativeBuild {
            cmake {
                cppFlags '-frtti -fexceptions -std=c++11'
                arguments "-DANDROID_STL=c++_shared"

            }
        }
    }

    buildTypes {
        release {
            // Todo: Add your own signing config for the release build.
            // Signing with the debug keys for Now,so `Flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }

    externalNativeBuild {
        cmake {
            path "D:/Flutter Projects/Flutter-simple-edge-detection/example/android/CMakeLists.txt"
        }
    }
}

但我收到此错误

FAILURE:构建失败,出现异常。

任务“:simple_edge_detection:externalNativeBuildDebug”执行失败。

构建命令失败。 使用参数 {--build D:\Flutter Projects\Flutter-simple-edge-detection\ 执行进程 C:\Users\Andorid\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe 时出错android.cxx\cmake\debug\armeabi-v7a --target native_edge_detection}

ninja: error: '../../../../src/main/jniLibs/armeabi-v7a/libopencv_java4.so','D:/Flutter Projects/Flutter-simple-edge- 需要检测/示例/构建/simple_edge_detection/intermediates/cmake/debug/obj/armeabi-v7a/libnative_edge_detection.so',缺少并且没有已知的规则来实现

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。