-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot start FlutterActivity when adding flutterpart library as aar module to existing application #18025
Comments
For my app, add : |
Same for me. |
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" |
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 :
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. |
@davidbilly Using the new Flutter module template, the |
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 :
|
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 |
@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. |
@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 So our steps actually were:
We thought about some solutions to this problem:
What do you think about the solutions? Do you have anything in mind, or do you have any concern with any of these approaches? |
Hi, I need your help. |
I wanted to let you all know that I've seen the new posts here, I just haven't had a chance to come back to this issue. I'll re-open it and come back to it when I can. @Igor1201 FYI - Changing flutter.jar to flutter.aar is currently not possible due to infrastructure issues within the Flutter embedding/engine. I'll look into your other suggestion when I get a chance. |
@matthew-carroll Manually adding the icudtl file into a new assets folder works and fixes the issue, but now when you have a Flutter project that uses any plugin like path_provider for example, and you build the AAR file (with the icu file included), the project throws a missing plugin exception cause none of the plugins were included in the AAR im guessing. It's an addition to the icu issue. I made a separate issue for the missing plugins in the AAR here: #23944 |
@mravn-google any updates here? issue is still present. |
Update: Support for AAR packaging is still not an imminent implementation. It is on the roadmap but there are no hard dates. CC for feature request visibility: @dnfield @cbracken @chinmaygarde @jason-simmons @sbaranov @mklim |
@matthew-carroll We've already implemented the second suggestion discussed here on the following PR: #23782 Hixie requested some tests on this matter however, as we described here, we're not sure how to implement these tests as the changes are on gradle level and none of these are currently tested (and we're not sure how to setup a infrastructure to do this). Do you have any idea on how can we advance this for now? |
@Igor1201 and this PR solves the issue? |
@jelenacarnegie Yes. We are able to make this work with the PR + generate a FatAAR, as discussed on #23944 |
As I already said, this is a deal breaker for me(and probably many other developers). @Igor1201 says his PR solves this issue. Can anyone from Flutter team at least take a look at it? Thank you. |
Things are pretty busy with Flutter Live being only a few days away. I suspect this will need some help from @matthew-carroll. To set expectations: with Flutter Live and the holiday season, it's possible we won't get to help get the PR resolved until early 2019. :( Obviously we'll try to do to better than that. |
In additio to @eseidel's comments, for visibility, this issue might require work or input from any of the following: myself, @jason-simmons, @sbaranov, @mklim, @chinmaygarde, @cbracken If this problem is primarily Gradle related then I think myself, @jason-simmons, and @sbaranov are likely to be involved. If this problem requires general AAR support then we have a buildroot issue that is likely to involve @jason-simmons, @chinmaygarde, and @cbracken |
private String buildModeFor(Project project) {
return resolveProperty(project, 'flutter.buildMode', 'release')
} |
+1 |
@carl1990 proguard maybe? |
@jelenalecic yes ,has resolved |
any updates? :) |
I have no updates, no. Re-reading the bug, is the fix here just to make Flutter's gradle plugin and gradle templates a bit smarter to be .aar compatible? Is that a correct read @Igor1201 @matthew-carroll ? We don't have anyone on the Flutter team at Google who is particularly well versed in Gradle (hence a bunch of small bugs and needless performance slowdowns I'm told in our gradle rules). If someone in the community is particularly gradle-saavy and would like to help with this or other bugs in Flutter, contributions would be most welcome! :) FYI @tvolkert |
Use caseIn my project we have ios and android native project. But after heard about flutter we decide that new functionality will develop into flutter module ( Now go to my android project and import flutter exported .aar file in android project as module or lib. for reference see the image After import we analyze .aar just like .apk file and here are image for reference How can we call dart route page from Android app`
Call this code from my android activity .. issueNow we create other module in flutter and import same as last time. during the import .aar we can change name of module using android studio. Here are we attaching image reference. Now you can see the .so file in second .aar file with the same name of last one .aar file.. when we run this it gives error |
I'd like to reset this bug since the previous solution was a half offering and a lot has changed since. For instance, we have a proper If you had issues with this in the past, could you try the new process https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#1-depend-on-the-android-archive-aar on the master channel? |
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
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
The text was updated successfully, but these errors were encountered: