Description
Steps to Reproduce
-
Create new flutter project
-
Create new Android app
-
Add flutter project into existing android app (from step 2) according to
-
run the android app and start the MainActivity of flutter project -> everything works
-
run gradle -> assemble for the flutter project Build directory
-
copy the flutterpart-release.aar generated at build/outputs/arr
-
Create a different new Android app
-
Create new module ->Import JAR/ARR package -> select flutterpart-release.aar -> finish
-
add to app build.grade "implementation project(':flutterpart')"
-
add button to start flutterpart MainAcitivty
ComponentName componentName = new ComponentName(getBaseContext(),
"com.example.flutterpart.MainActivity");
Intent intent = new Intent().setComponent(componentName);
startActivity(intent); -
Run the app -> click the button -> app crashed
Logs
Crash log
05-30 16:32:36.124 21199-21199/com.example.androidwithflutter3 A/flutter: [FATAL:flutter/fml/icu_util.cc(95)] Check failed: context->IsValid(). Must be able to initialize the ICU context. Tried: /data/user/0/com.example.androidwithflutter3/app_flutter/icudtl.dat
05-30 16:32:36.124 21199-21199/com.example.androidwithflutter3 A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 21199 (oidwithflutter3)
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.4.4, on Microsoft Windows [Version 10.0.16299.125], locale he-IL)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.1)
[!] IntelliJ IDEA Community Edition (version 2018.1)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] Connected devices (1 available)
Activity
luoyushouchai commentedon Jun 6, 2018
For my app, add :
ndk { abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86' }
App crash and throw the same error!
alexandresoler commentedon Jun 13, 2018
Same for me.
Works well when including the flutter project as a module with sources (like https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps)
Doesn't works when exporting the flutter project as an aar and include it on my Android APP as a fat aar. (Must be able to initialize the ICU context...)
davidbilly commentedon Jun 27, 2018
Same for me, after export to AAR.
App crash and show "A/flutter: [FATAL:flutter/fml/icu_util.cc(95)] Check failed: context->IsValid(). Must be able to initialize the ICU context. Tried: /data/user/0/APP_ID/app_flutter/icudtl.dat"
davidbilly commentedon Jun 27, 2018
Guys, after few attempt and i manage let AAR work with my demo app on simulator.
Reason : The "assets/flutter_shared/icudtl.dat" was not generated when you're export to AAR but export APK does include "icudtl" file if you directly embedded flutter SDK.
How to :
Step :
Note : i'm not sure that "icudtl.dat" file what for and not sure will be work on all of android devices, please share/contribute me the result as i not own much android devices to test.
Please share if have any better workaround for this issue.
Hopefully, in future flutter dev @mit-mit @mravn-google will included for export AAR.
Sorry for my bad english.
mravn-google commentedon Jun 27, 2018
@davidbilly Using the new Flutter module template, the
icudtl.dat
file is included in the apk of the host app. That file tells Flutter how to do international text processing with unicode.davidbilly commentedon Jun 27, 2018
@mravn-google
Hi, thanks for quick reply.
For my case, i have to use our company existing native SDK for our customer app and i'm thinking by using flutter framework just for UI part for IOS and android for 1 time development.
But the logic part still on native which we already developed long time ago.
So we have to use AAR to support our customer app. So far seem "flutter_view" and "platform_view" fulfil our requirement.
Also, we don't wish our customer have to setup for flutter env and download flutter source code just because they using our SDK. its too much development cost for them.
So, all the source within AAR will be better, they just need to import our AAR SDK to their project.
Thanks.
This is my env :
chaangliu commentedon Sep 17, 2018
Hi I'm using the new Flutter module template and adding flutter module as source code, but still encountering this issue..
When searching in the project I can see

icudtl.dat
is already included in the jar. Why can't flutter find it?matthew-carroll commentedon Sep 18, 2018
@tomergoldst I tried to repro your issue but was unable to find any issues. Here are the steps that I took:
The above steps worked as expected without any build errors or crashes.
I'm going to close this ticket. If you still have issues with the above steps then please re-open with any additional information that might help.
comigor commentedon Oct 30, 2018
@matthew-carroll We've just created a repo to reproduce the issue following your step above (using flutter 40fc45a): https://github.com/Igor1201/min-repro-flutter
Your steps actually were missing the import of flutter classes themselves (the .aar generated from the
.android/Flutter
project) that is not embedded on the MyApplication project (the one you converted from an app to a library).So our steps actually were:
app
(onandroid
folder)flutter_module
(on root)app
toflutter_module
as per the steps in the Wikiapp
to extend FlutterActivityapp
and confirmed that the Flutter UI displayed as expectedapp
to an Android library by editing the build.gradle fileapp
(onandroid_app_2
folder)android_app_2
./gradlew flutter:assemble
onandroid
folderflutter_module/.android/Flutter/(...)/outputs/flutter-debug.aar
) as a module toandroid_app_2
android_app_2
that launches MainActivity from within theapp
AARWe thought about some solutions to this problem:
Change flutter.jar to be flutter.aar
By definition, jar files on android shouldn't contain assets, so migrating flutter to an AAR would make it work, as the compiler would than merge the assets.
Add an
assets
folder containingflutter_shared
to the generated.android/Flutter
moduleThis way, the output of this project (which is an AAR) will contain the
flutter_shared
folder insideassets
, which will be merged to the final APK.What do you think about the solutions? Do you have anything in mind, or do you have any concern with any of these approaches?
graydalf commentedon Nov 2, 2018
Hi, I need your help.
Can you show me the build.gradle of your sixth step? please.
32 remaining items