question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't run Flutter project if it's within a Bazel directory

See original GitHub issue

I have a Flutter project that’s within a Bazel directory. It’s not built by Bazel in any way, but it happens to be in a monorepo that uses Bazel for most other things.

Running and debugging from within Android Studio used to work fine, but is now broken. Trying to launch main.dart results in an error:

Entrypoint isn’t within a Flutter pub root.

Looking at Preferences > Languages & Frameworks > Flutter shows that the Flutter SDK path has changed to /Users/rohan/tidbyt/null <set by bazel project>. That isn’t a valid path on my machine. Resetting the setting here doesn’t seem to do anything.

I have a hunch that this is related to #4735 (/cc @helin24 @jacob314). My guess is that that broke the IntelliJ plugin for Flutter projects in Bazel directories outside of Google.

Steps to Reproduce

  1. Have a Flutter project that’s inside a Bazel workspace. (not at Google)
  2. Try to run the project from within Android Studio

Version info

[✓] Flutter (Channel unknown, 1.20.2, on Mac OS X 10.15.6 19G2021, locale en-US)
    • Flutter version 1.20.2 at /opt/flutter
    • Framework revision bbfbf1770c (5 weeks ago), 2020-08-13 08:33:09 -0700
    • Engine revision 9d5b21729f
    • Dart version 2.9.1

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/rohan/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • 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)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.

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

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] 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.49.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.14.1

[✓] Connected device (3 available)
    • Pixel 3 (mobile) • 8BWX1G3QH  • android-arm64  • Android 11 (API 30)
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web)     • chrome     • web-javascript • Google Chrome 85.0.4183.102

! Doctor found issues in 1 category.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rohansinghcommented, Sep 23, 2020

@helin24 Yup, that’s exactly how my project is setup.

1reaction
helin24commented, Sep 14, 2020

Thanks for checking; it’s likely there is an issue with our bazel check, so we’ll look into it.

Last thing, can you send along your log? Help -> show log in finder

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bazel not running flutter correctly - Stack Overflow
The immediate issue you're running into is that Bazel runs each action (i.e. build step) in a sandbox, so unless an input to...
Read more >
Bazel Tutorial: Build an Android App
The sample project for this tutorial is in examples/android/tutorial . For the rest of the tutorial, you will be executing commands in this...
Read more >
Examples - Cirrus CI
To preserve caches between Gradle runs, add a cache instruction as shown below. The trick here is to clean up ~/.gradle/caches folder in...
Read more >
Android Studio Dolphin | 2021.3.1
Discover what's new in the latest versions of Android Studio, ... it stays at the top of the list across all your studio...
Read more >
11 Great Tools for a Monorepo in 2021 | Bits and Pieces
These days, many tools can run “npm install” and “npm run build” in 20 different ... It allows you to change the code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found