Error “text_jni.so’: dlopen failed: library “libtask_text_jni.so” not found”

I am trying to use the tflite_flutter and tflite_flutter_helper_plus libraries in the following versions:

`dependencies:
flutter:
sdk: flutter

tflite_flutter: ^0.10.4
tflite_flutter_helper_plus: ^0.0.2`

Here is my implementation, which follows the documentation.
https://github.com/odejinmi/tflite_flutter_helper_plus

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>import 'package:flutter/material.dart';
import 'package:tflite_flutter_helper_plus/tflite_flutter_helper_plus.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: TextButton(
onPressed: () { getAnswer();},
child: Text('click me to get answer'),
),
)
);
}
void getAnswer() async {
String question = "What is the capital of Brazil?";
String context = "Brazil is a country in South America. It is the largest country in South America and the fifth largest country in the world. The capital of Brazil is Brasília.";
final bertQuestionAnswerer = await BertQuestionAnswerer.createFromAsset('assets/bert_qa.tflite');
List<QaAnswer> answeres = bertQuestionAnswerer.answer(context, question);
print(answeres);
}
}
</code>
<code>import 'package:flutter/material.dart'; import 'package:tflite_flutter_helper_plus/tflite_flutter_helper_plus.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override State<MyHomePage> createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: Text(widget.title), ), body: Center( child: TextButton( onPressed: () { getAnswer();}, child: Text('click me to get answer'), ), ) ); } void getAnswer() async { String question = "What is the capital of Brazil?"; String context = "Brazil is a country in South America. It is the largest country in South America and the fifth largest country in the world. The capital of Brazil is Brasília."; final bertQuestionAnswerer = await BertQuestionAnswerer.createFromAsset('assets/bert_qa.tflite'); List<QaAnswer> answeres = bertQuestionAnswerer.answer(context, question); print(answeres); } } </code>
import 'package:flutter/material.dart';
import 'package:tflite_flutter_helper_plus/tflite_flutter_helper_plus.dart';


void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});


  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: TextButton(
          onPressed: () { getAnswer();},
          child: Text('click me to get answer'),
        ),
      )
    );
  }


  void getAnswer() async {
    String question = "What is the capital of Brazil?";
    String context = "Brazil is a country in South America. It is the largest country in South America and the fifth largest country in the world. The capital of Brazil is Brasília.";
    final bertQuestionAnswerer = await BertQuestionAnswerer.createFromAsset('assets/bert_qa.tflite');
    List<QaAnswer> answeres = bertQuestionAnswerer.answer(context, question);
    print(answeres);
   }
}

But I am getting this error:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>E/flutter (12951): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libtask_text_jni.so': dlopen failed: library "libtask_text_jni.so" not found
E/flutter (12951): #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
E/flutter (12951): #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
E/flutter (12951): #2 tflitelib.<anonymous closure> (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart:32:27)
E/flutter (12951): #3 tflitelib (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart:40:2)
E/flutter (12951): #4 tflitelib (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart)
E/flutter (12951): #5 BertQuestionAnswererFromFile (package:tflite_flutter_helper_plus/src/task/bindings/text/qa/bert_qa.dart:13:32)
E/flutter (12951): #6 BertQuestionAnswererFromFile (package:tflite_flutter_helper_plus/src/task/bindings/text/qa/bert_qa.dart)
E/flutter (12951): #7 BertQuestionAnswerer.create (package:tflite_flutter_helper_plus/src/task/text/qa/bert_question_answerer.dart:42:23)
E/flutter (12951): #8 BertQuestionAnswerer.createFromAsset (package:tflite_flutter_helper_plus/src/task/text/qa/bert_question_answerer.dart:78:12)
E/flutter (12951): <asynchronous suspension>
E/flutter (12951): #9 _MyHomePageState.getAnswer (package:bert_qa_teste/main.dart:56:34)
E/flutter (12951): <asynchronous suspension>
E/flutter (12951):
</code>
<code>E/flutter (12951): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libtask_text_jni.so': dlopen failed: library "libtask_text_jni.so" not found E/flutter (12951): #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43) E/flutter (12951): #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12) E/flutter (12951): #2 tflitelib.<anonymous closure> (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart:32:27) E/flutter (12951): #3 tflitelib (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart:40:2) E/flutter (12951): #4 tflitelib (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart) E/flutter (12951): #5 BertQuestionAnswererFromFile (package:tflite_flutter_helper_plus/src/task/bindings/text/qa/bert_qa.dart:13:32) E/flutter (12951): #6 BertQuestionAnswererFromFile (package:tflite_flutter_helper_plus/src/task/bindings/text/qa/bert_qa.dart) E/flutter (12951): #7 BertQuestionAnswerer.create (package:tflite_flutter_helper_plus/src/task/text/qa/bert_question_answerer.dart:42:23) E/flutter (12951): #8 BertQuestionAnswerer.createFromAsset (package:tflite_flutter_helper_plus/src/task/text/qa/bert_question_answerer.dart:78:12) E/flutter (12951): <asynchronous suspension> E/flutter (12951): #9 _MyHomePageState.getAnswer (package:bert_qa_teste/main.dart:56:34) E/flutter (12951): <asynchronous suspension> E/flutter (12951): </code>
E/flutter (12951): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libtask_text_jni.so': dlopen failed: library "libtask_text_jni.so" not found
E/flutter (12951): #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
E/flutter (12951): #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
E/flutter (12951): #2      tflitelib.<anonymous closure> (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart:32:27)
E/flutter (12951): #3      tflitelib (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart:40:2)
E/flutter (12951): #4      tflitelib (package:tflite_flutter_helper_plus/src/task/bindings/dlib.dart)
E/flutter (12951): #5      BertQuestionAnswererFromFile (package:tflite_flutter_helper_plus/src/task/bindings/text/qa/bert_qa.dart:13:32)
E/flutter (12951): #6      BertQuestionAnswererFromFile (package:tflite_flutter_helper_plus/src/task/bindings/text/qa/bert_qa.dart)
E/flutter (12951): #7      BertQuestionAnswerer.create (package:tflite_flutter_helper_plus/src/task/text/qa/bert_question_answerer.dart:42:23)
E/flutter (12951): #8      BertQuestionAnswerer.createFromAsset (package:tflite_flutter_helper_plus/src/task/text/qa/bert_question_answerer.dart:78:12)
E/flutter (12951): <asynchronous suspension>
E/flutter (12951): #9      _MyHomePageState.getAnswer (package:bert_qa_teste/main.dart:56:34)
E/flutter (12951): <asynchronous suspension>
E/flutter (12951): 

I tried changing the Android version by emulating more recent versions. I would like to understand this error and, if possible, get a solution.

New contributor

Willer Silva de Morais is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật