Question

I think I've tried everything now...

I've been all over stack overflow, I've even consulted the android doc

Most of the posts here show how to add the .jar file in Eclipse "android tools -> add support library" or something

So I've tried to do it how the doc tells me, by going to build.gradle, and adding compile 'com.android.support:support-v4:19.0.0' to the dependencies

but even if I add it, and rebuild the project, I still can't import android.support.v4.content.LocalBroadcastManager... it doesn't even know what android.support is...

So is there anyone who can help me with this? the issue is getting very annoying, and it's slowed me down by hours...

Edit: I have updated the Android SDK, and made sure that the library exists in the sdk folder, so I know it's there... I just can't make android studio add it for some reason...

Edit 2: Only by navigating to the exact file path, manually, and then copying said path I was able to access the file... Still, I'd very much like to know what I can do to make this a more painless process...

Was it helpful?

Solution

Make sure your library got added successfully.

Check the following things.

1.Your build.gradle should be like

   dependencies {
          compile 'com.android.support:support-v4:19.0.+'
   }

2.File > Project Structure > Modules >Dependency Tab There should not be any red mark in dialog showing error if they are fix them.

enter image description here

3.Check your Module_Name.iml file

It should have this entry in last section

<orderEntry type="library" exported="" name="support-v4-19.0.0" level="project"/>

If its there with no entry close you studio delete .iml file and open studio again wait for gradle sync to be complete.You .iml file will be created again check for entry.

If every thing is fine do sync Your project with gradle again using this lovely tiny gradle button in toolbar.

enter image description here

OTHER TIPS

Try adding one of those dependencies to your app level build.gradle :

AndroidX

implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'

Support Library

implementation 'com.android.support:localbroadcastmanager:28.0.0'

Then sync project with Gradle files.

After lot of searching and R&D i found some solution. This is working for me i hope this is helping you.

implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'

If you not use Androidx please add this line

implementation 'android.legacy:legacy-support-core-utils:1.0.0'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top