无法将LocalBroadcastManager添加到Android Studio中的项目 [英] Can't add LocalBroadcastManager to project in Android Studio

查看:344
本文介绍了无法将LocalBroadcastManager添加到Android Studio中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我已经尝试了一切...

I think I've tried everything now...

我到处都是堆栈溢出,甚至查阅过android文档

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

这里的大多数文章都显示了如何在Eclipse"android工具->添加支持库"或类似内容中添加.jar文件

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

因此,我尝试通过doc.告诉我,方法是build.gradle,然后将compile 'com.android.support:support-v4:19.0.0'添加到dependencies

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

但是即使我添加它并重建项目,我仍然无法导入android.support.v4.content.LocalBroadcastManager ...它甚至不知道android.support是什么...

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...

已经更新了Android SDK,并确保该库存在于sdk文件夹中,所以我知道它存在...我只是无法让android studio添加它出于某些原因...

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...

推荐答案

请确保您的库已成功添加.

Make sure your library got added successfully.

检查以下内容.

1.您的build.gradle应该类似于

1.Your build.gradle should be like

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

2.File> Project Structure> Modules> Dependency选项卡 如果它们已解决,则对话框中不应有任何红色标记显示错误.

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

3.检查您的Module_Name.iml文件

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"/>

如果那里没有条目关闭,则工作室删除.iml文件,然后再次打开工作室,等待gradle同步完成.您将再次创建.iml文件,以检查条目.

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.

如果一切正常,请使用工具栏中的这个可爱的小gradle按钮,再次使用gradle同步您的项目.

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

这篇关于无法将LocalBroadcastManager添加到Android Studio中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆