Приложение отлично работает на эмуляторах, но вылетает на устройстве с: java.lang.UnsatisfiedLinkError: сбой dlopen: не удается найти символ «__aeabi_memcpy»

1

Я пытаюсь внедрить yctung AndroidLibSvm в свой проект с Android Studio 3.2.1. Хотя приложение отлично работает на любом эмулируемом устройстве (я пробовал Android 23 и 28, оба работали безупречно), оно вылетает на моем реальном устройстве (планшет lenovo с Android 6.0) со следующей ошибкой:

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__aeabi_memcpy" referenced by "/data/app/com.krautkremer.nils.mymirror-2/lib/arm/libjnilibsvm.so"

как только приложение попытается запустить ту часть кода, которая использует cytung lib. Есть несколько подобных случаев на SO, например, здесь или здесь, но установка моего

arguments "-DANDROID_PLATFORM=android-23"

или любой другой android-x и мой targetSdkVersion до 23 в build.gradle не решили эту проблему.

это мой build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.krautkremer.nils.mymirror"
    minSdkVersion 23
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    externalNativeBuild {
        cmake {
            cppFlags ""
            arguments "-DANDROID_PLATFORM=android-23"
        }
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    //exclude 'META-INF/proguard/androidx-annotations.pro'
}

externalNativeBuild {
    cmake {
        path "CMakeLists.txt"


    }
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.media:media:1.1.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.annotation:annotation:1.0.1'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-ml-vision:18.0.2'
implementation 'com.google.firebase:firebase-ml-common:16.1.6'
implementation 'com.google.firebase:firebase-ml-vision-face-model:17.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1-alpha01'
implementation project(':androidlibsvm-release')
}
apply plugin: 'com.google.gms.google-services'

Я даже понизил версию NDK с 18 до 15, но безуспешно. Есть идеи, в чем может быть проблема?

Помоги мне, Оби-Ван Кеноби. Ты моя единственная надежда.

РЕДАКТИРОВАТЬ: Это мой CMakeLists.txt, если это поможет. Я ничего не изменил, не так ли?

# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.
        native-lib

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        src/main/cpp/native-lib.cpp)

# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.

find_library( # Sets the name of the path variable.
        log-lib

        # Specifies the name of the NDK library that
        # you want CMake to locate.
        log)

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries( # Specifies the target library.
        native-lib

        # Links the target library to the log library
        # included in the NDK.
        ${log-lib})
Теги:
android-studio
cmake
android-ndk

1 ответ

0

Попробуйте изменить ваш minSdkVersion и targetSdkVersion, т.е.

minSdkVersion 15
targetSdkVersion 23
  • 0
    Спасибо за помощь мне! Я попробовал несколько комбинаций мин- и целевых Sdkversions, но ни одна из них не сработала.
  • 0
    Это не нужно. Это происходит сбой на Android 6.0, который является уровнем API 23. Показанный выше minSdkVersion должен подойти.

Ещё вопросы

Сообщество Overcoder
Наверх
Меню