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

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

问题描述

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

I think I've tried everything now...

我一直在堆栈溢出,我什至咨询了android doc

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

这里的大部分帖子都展示了如何在 Eclipse 中添加 .jar 文件android 工具 -> 添加支持库"之类的

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

所以我尝试按照文档告诉我的方式去做,方法是转到 build.gradle,并将 compile 'com.android.support:support-v4:19.0.0' 添加到依赖项

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

编辑 2:只有通过手动导航到确切的文件路径,然后复制所述路径,我才能访问该文件......不过,我非常想知道我可以做些什么来使它成为一个更无痛的过程...

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 Tab如果修复它们,对话框中不应有任何显示错误的红色标记.

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天全站免登陆