flatter aar未能加载动态库

u1ehiz5o  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(319)

我将Flutter应用程序项目转换为Flutter模块项目
构建aar放在android studio java项目中
可以运行,但有些功能无法正常使用
发生了以下错误

E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library (dlopen failed: library "libed25519.so" not found)
    #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:55)
    #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:20:12)
    #2      ed25519Lib (package:myfluttername/native_add/native_add.dart:16:26)
    #3      ed25519Lib (package:myfluttername/native_add/native_add.dart)
    #4      ed25519CreateKeypair (package:myfluttername/native_add/native_add.dart:40:28)
    #5      ed25519CreateKeypair (package:myfluttername/native_add/native_add.dart)
    #6      Ed25519.generateKeyPair (package:myfluttername/native_add/native_add.dart:119:5)
    #7      new ATHandshakeData (package:myfluttername/ATWaKit/ATHandshakeData.dart:16:15)
    #8      ATProprietaryProtocol.atHandshakeData (package:myfluttername/ATWaKit/ATProprietaryProtocol.dart:21:48)
    #9      ATProprietaryProtocol.atHandshakeData (package:myfluttername/ATWaKit/ATProprietaryProtocol.dart)
    #10     ATProprietaryProtocol.setup (package:myfluttername/ATWaKit/ATProprietaryProtocol.dart:50:24)
    #11     ATSession._doHandShake (package:myfluttername/ATWaKit/ATSession.dart:63:34)
    #12     ATSession.createSession (package:myfluttername/ATWaKit/ATSession.dart:81:5)
    #13     ATCommandSender._sendCommand (package:myfluttername/ATWaKit/ATCommandSender.dart:64:16)
    #14     ATCommandSender.enqueue (package:myfluttername/ATWaKit/ATCommandSender.dart:110:5)
    #15     ATColdWa.getVersionInfo (package:myfluttername/ATWaKit/ATColdWa.dart:184:18)
    #16     _FindDevicesScreenState.connectDevice.<anonymous closure> (package:myfluttername/screen/find_device_screen.dart:512:49)
    #17     _rootRunUnary (dart:async/zone.dart:1198:47)
    #18     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
    #19     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
    #20     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
    #21     _DelayedData.perform (dart:async/stream_impl.dart:611:14)
    #22     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
    #23     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:687:7)
    #24     _rootRun (dart:async/zone.dart:1182:47)
    #25     _CustomZone.run (dart:async/zone.dart:1093:19)
    #26     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
    #27     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
    #28     _rootRun (dart:async/zone.dart:1190:13)
    #29     _CustomZone.run (dart:async/zone.dart:1093:19)
    #30     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
    #31     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
    #32     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    #33     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

错误代码 native_add.dart 第15~17行(16:26是“开”的“o”) import 'dart:ffi' as ffi;final ffi.DynamicLibrary ed25519Lib = Platform.isAndroid ? ffi.DynamicLibrary.open("libed25519.so") : ffi.DynamicLibrary.process();native_add.dart 第38~43行(40:28是'ed25519lib'的'e')

final void Function(
        ffi.Pointer<ffi.Uint8>, ffi.Pointer<ffi.Uint8>, ffi.Pointer<ffi.Uint8>)
    ed25519CreateKeypair = ed25519Lib
        .lookup<ffi.NativeFunction<ed25519_create_keypair_func>>(
            'ed25519_create_keypair')
        .asFunction<Ed25519CreateKeypair>();

build.gradle(:app)

repositories {
    maven {
        url '---/build/host/outputs/repo'
    }
    maven {
        url 'https://storage.googleapis.com/download.flutter.io'
    }
}

请帮帮我
任何想法和建议都可以

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题