Skip to content
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

Display correct errors and warnings while editing Android code on Flutter project in Android Studio #4819

Closed
omatt opened this issue Sep 10, 2020 · 5 comments

Comments

@omatt
Copy link

omatt commented Sep 10, 2020

Errors seems to be always displayed on Android-specific code in the Flutter project. Correct errors and warnings are displayed if 'Open for Editing in Android Studio' was clicked. The Flutter app runs as expected though.

Steps to Reproduce

Edit Android code in Flutter project.

Screen Shot 2020-09-10 at 4 28 38 AM

Clicking 'Open for Editing in Android Studio', the errors displayed goes away.

Screen Shot 2020-09-10 at 4 28 59 AM

Version info

/Users/{USER}/Downloads/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6)
• Flutter version 1.20.3 at /Users/{USER}/Downloads/flutter
• Framework revision 216dee60c0 (9 days ago), 2020-09-01 12:24:47 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/{USER}/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/{USER}/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C505
• CocoaPods version 1.9.0

[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.48.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.12.2

[✓] Connected device (1 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!
Process finished with exit code 0

@stevemessick
Copy link
Member

Have you enabled the experimental feature that supports this? To check, open Flutter Preferences/Settings and make sure the check box is ticked for Enable code completion, navigation, etc. for Java / Kotlin. You'll need to restart Android Studio to trigger a Gradle sync.

That option has been around for a while but it will probably always be experimental. It is really difficult to keep it working. It depends on APIs that both Jetbrains and Android Studio frequently modify. And the Flutter team often restructures their libraries, which is another source of breakage.

@omatt
Copy link
Author

omatt commented Sep 10, 2020

Could you provide the steps so I can navigate to Enable code completion... settings? I can't seem to find this option on Android Studio Preferences. Do I need to be on a specific build of Flutter or Android Studio?

@stevemessick
Copy link
Member

It's toward the bottom.

Screen Shot 2020-09-10 at 3 52 27 PM

@omatt
Copy link
Author

omatt commented Sep 11, 2020

Thanks for the steps @stevemessick. It worked for me.

@omatt omatt closed this as completed Sep 11, 2020
@stevemessick
Copy link
Member

Great! Thanks for verifying that it still works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants