eclipse 找不到 android.support.v4.widget.SwipeRefreshLayout
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22736008/
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
eclipse can't find android.support.v4.widget.SwipeRefreshLayout
提问by Katedral Pillon
Even after clicking on Add Support Library and choosing version 19, eclipse still can't find android.support.v4.widget.SwipeRefreshLayout. Does anyone know how to get this to work? I am using
即使在点击添加支持库并选择版本 19 后,eclipse 仍然找不到 android.support.v4.widget.SwipeRefreshLayout。有谁知道如何让这个工作?我在用
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
I am working on a mac mavericks computer with Juno.
我正在与 Juno 一起使用 Mac Mavericks 计算机。
update: import section
更新:导入部分
import java.util.Observer;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.support.v4.widget.SwipeRefreshLayout;//red underline
Update
更新
By the way, I don't know if this matters: this is an Appengine Connected Android Project, which I build using Google-Eclipse-Plugin
顺便说一句,我不知道这是否重要:这是一个 Appengine Connected Android 项目,我使用 Google-Eclipse-Plugin 构建
Update 3:
更新 3:
It's looking like the Android Support Library 19.1.0 is not available through the SDK Manager. How else might I obtain it?
看起来 Android 支持库 19.1.0 无法通过 SDK 管理器使用。我还能如何获得它?
采纳答案by Katedral Pillon
So it turns out the library is in the following location
所以事实证明图书馆在以下位置
/android-sdk-macosx/extras/android/m2repository/com/android/support/support-v4/19.1.0
As opposed to the usual
与通常的相反
/android-sdk-macosx/extras/android/support
Also I had to restart eclipse and go to Android SDK Manager
over and over and over, until the 19.1.0 version shows up.
我也不得不重新启动 eclipse 并Android SDK Manager
一遍又一遍地重复,直到 19.1.0 版本出现。
I hope this saves someone else some trouble.
我希望这可以为其他人省去一些麻烦。
回答by Michael Obi
It was difficult to update the support library to version 19.1 so i downloaded it manually from https://dl-ssl.google.com/android/repository/support_r19.1.zipand added the jar to my build path manually. works for me. I dont know why the 19 update shows instead of 19.1.0
将支持库更新到版本 19.1 很困难,所以我从https://dl-ssl.google.com/android/repository/support_r19.1.zip手动下载它并手动将 jar 添加到我的构建路径中。对我来说有效。我不知道为什么显示 19 更新而不是 19.1.0
回答by Lee HyunSoo
The SDK Manager update Android Support Library to 19.1.0. But when you use Android Tools > Add Support Library, eclipse update Android Support Library to 19.0. I think this is a bug. Copy Android Support Library 19.1.0 to libs folder manually.
SDK 管理器将 Android 支持库更新到 19.1.0。但是当您使用 Android Tools > Add Support Library 时,eclipse 会将 Android Support Library 更新为 19.0。我认为这是一个错误。手动将 Android Support Library 19.1.0 复制到 libs 文件夹。
回答by user936580
It looks as if you don't have the android-support-v4.jar in Java Build Path. Add it from the android-support-v7-appcompat.
看起来您在 Java Build Path 中没有 android-support- v4.jar。从 android-support-v7-appcompat 添加它。
回答by Haresh Chaudhary
For some reason, even though you may include v4 support library
or you may have v7-appcompat
included in your project, you may not be able to import SwipeRefreshLayout
.
出于某种原因,即使您可能包含v4 support library
或可能已经v7-appcompat
包含在您的项目中,您也可能无法导入SwipeRefreshLayout
.
You need to make sure that
你需要确保
- you change the
target=android-19
totarget=android-22
(It should be anything greater that 19) and - manually import :
import android.support.v4.widget.SwipeRefreshLayout;
in your activity which will resolve the import related issue.
- 您将更
target=android-19
改为target=android-22
(应该是大于 19 的任何值)和 - 手动导入:
import android.support.v4.widget.SwipeRefreshLayout;
在您的活动中,这将解决与导入相关的问题。
回答by user158
In androidx
, add
在androidx
,添加
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
inorder to use SwipeRefreshLayout
为了使用 SwipeRefreshLayout
回答by tehnolog
I had the same problem with old project. But when I create new project, Eclipse can find this import.
我在旧项目中遇到了同样的问题。但是当我创建新项目时,Eclipse 可以找到这个导入。
回答by birdy
It's a problem with updating support library from eclipse: https://code.google.com/p/android/issues/detail?id=67991
从 eclipse 更新支持库有问题:https: //code.google.com/p/android/issues/detail?id=67991
Just update it by starting Android SDK manager manually and add new v4 lib to your project.
只需通过手动启动 Android SDK 管理器来更新它,并将新的 v4 库添加到您的项目中。
回答by dangthaison.91
Thanks for tehnolog's tips. Update to 19.1 by follow above link -> create new project and import android.support.v4 library -> simply copy android.support.v4.jar to old project's libs folder, Add To BuildPath. SwipeRefreshLayout will appear :D
感谢 tehnolog 的提示。按照上面的链接更新到 19.1 -> 创建新项目并导入 android.support.v4 库 -> 只需将 android.support.v4.jar 复制到旧项目的 libs 文件夹,添加到 BuildPath。SwipeRefreshLayout 将出现:D