Java import android.support 无法解决

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18856264/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 11:40:02  来源:igfitidea点击:

import android.support cannot be resolved

javaandroidnotifications

提问by OhNoItsAnOverflow

I'm getting an error stating: import android.support cannot be resolved at the line:

我收到一条错误消息: import android.support 无法在该行解析:

import android.support.v4.app.NotificationCompat;

Has anyone seen this before or have any idea what I can do to resolve it? The issue occurs when adding a library I've built - and goes away when I remove it.

有没有人以前见过这个或知道我可以做些什么来解决它?添加我构建的库时会出现问题 - 当我删除它时就会消失。

采纳答案by Aravin

Right click the project properties->java build path->libraries click add external jar.

右键单击project properties->java build path->libraries click add external jar

browse go to android installation folder like C:\Program Files\Android\android-sdk\extras\android\support\v4there you find the android_support_v4.jarfile then add the jar file and go to order and export tab check the library and click ok..

浏览到 android 安装文件夹,就像C:\Program Files\Android\android-sdk\extras\android\support\v4在那里找到android_support_v4.jar文件,然后添加 jar 文件,然后转到 order 和 export 选项卡检查库,然后单击 ok..

回答by Daniel Gabriel

You need to add the android-support-v4.jarto your project. It looks like your library requires it.

您需要将其添加android-support-v4.jar到您的项目中。看起来您的图书馆需要它。

回答by Simon Bungartz

Looks like you are missing a dependecy to the Support Library.

看起来您缺少对支持库的依赖。

See http://developer.android.com/tools/support-library/setup.htmlon how to add the dependency in your IDE.

有关如何在 IDE 中添加依赖项的信息,请参阅http://developer.android.com/tools/support-library/setup.html