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.

Unable to resolve imports from Android Support Repository

See original GitHub issue

I used the Android SDK Manager to install the Android Support Repository. When I now try to import something from there (e.g. android.support.v4.content.LocalBroadcastManager) into the Android app of my Flutter app, IntelliJ is unable to resolve it:

Cannot resolve Symbol 'LocalBroadcastManager'

The app compiles just fine with that import though. I played around a little with the “Project Structure…” settings, but without much success. It seems like there is no jar for the Android Support Repository on disk that I can include.

Would be nice to document how you can add and use stuff from the Android SDK with the new “Editing Android code in IntelliJ IDEA” support in IntelliJ with Flutter.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jakobr-googlecommented, Jun 23, 2017

I tried to reproduce this, and I think the issue is with how we set up the projects, as well as a little hiccup with Android dependencies.

Here’s what I did:

  • flutter create foo
  • Open foo/android in IDEA. Let it import the project from Gradle.
  • Added compile 'com.android.support:support-v4:25.3.1' dependency in android/app/build.gradle`.

At this point, I would normally expect a Gradle sync in IDEA to pick up the added dependency and just work, but it didn’t. I actually had to

  • Build -> Build Project

After that, LocalBroadcastManager (and whatever else I wanted from support) was available in IDEA.

So, looks like the Android dependencies are fetched from the android/build directory, since LocalBroadcastManager stopped working in the IDE when I removed that directory.

I don’t think we should try to work around this, and if we do, it should only be temporary until this issue is fixed upstream.

Also note that I didn’t open foo/ in IDEA. That project doesn’t look like it’s set up correctly for native Android development. In particular, it doesn’t look like it uses Gradle, and it didn’t pick up the new dependency even after I’d built the project.

0reactions
stevemessickcommented, Feb 21, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to resolve imports from Android Support Repository ...
I suspect that you have to add the full version code, for example: compile 'com.android.support:appcompat-v7:27.0.0' compile ...
Read more >
Java – Android Studio: Can't resolve imports (android.support.*)
Yes, there's an entry for Maven in the "build.gradle" file that is directly in the project folder. The "app" gradle file: apply plugin:...
Read more >
Add build dependencies - Android Developers
Learn how to add build dependencies using the Gradle build system in Android Studio.
Read more >
Support Library Setup - Android Developers
You can continue to use the support library. Historical artifacts (those versioned 27 and earlier, and packaged as android.support.* ) will remain available...
Read more >
Known issues with Android Studio and Android Gradle Plugin
To fix this issue, upgrade your Android 11 emulator to version 9 or higher by navigating to Tools > SDK Manager. In the...
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