Java “找不到类‘android.support.v4.app.FragmentActivity’”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21619305/
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-13 09:41:26  来源:igfitidea点击:

"Could not find class 'android.support.v4.app.FragmentActivity'" Error

javaandroideclipseandroid-fragments

提问by Kurt Wagner

I'm getting the following error:

我收到以下错误:

> 02-06 23:10:24.104: E/dalvikvm(912): Could not find class
> 'android.support.v4.app.FragmentActivity', referenced from method
> com.robotium.solo.Waiter.getSupportFragment

When running a project I'm using for Programming Mobile Applications for Android Handheld Systems on Coursera.I believe this error is somehow related to my output answer being considered incorrect. if I can fix this error,I can fix my output.

在运行我用于在 Coursera 上为 Android 手持系统编程移动应用程序的项目时,我相信此错误与我的输出答案被认为不正确有关。如果我能修复这个错误,我就能修复我的输出。

I didn't have the latest version of Android Support Repository (not installed) when I initially ran my tests,but I now have the latest version of Android Support Repository according to the SDK Manager (v4),and have even restarted Eclipse and the emulator,but I'm still getting the error.

最初运行测试时,我没有最新版本的 Android Support Repository(未安装),但我现在根据 SDK Manager (v4) 拥有最新版本的 Android Support Repository,甚至重新启动了 Eclipse 和模拟器,但我仍然收到错误。

How can I fix the LogCat claiming ASR doesn't exist when it's installed according to the SDK?

根据 SDK 安装时,如何修复声称 ASR 不存在的 LogCat?

采纳答案by Mayank Saini

If there is no "libs" folder then create one

如果没有“libs”文件夹,则创建一个

then click

然后点击

Project> Android Tools >Add support Library.

项目 > Android 工具 > 添加支持库。

This will help you. Finally clean the project and restart Eclipse

这会帮助你。最后清理项目并重启Eclipse

回答by Brendon

Either create a "libs" folder and put the "android-support-v4.jar" file

创建一个“libs”文件夹并放入“android-support-v4.jar”文件

else

别的

import the " android-support-v4.jar" to Android Private Libraries folder, and restart the IDE to take effect.

将“android-support-v4.jar”导入Android Private Libraries文件夹,重启IDE即可生效。

回答by Jordan Junior

You need to add the support library com.android.support:support-v4

您需要添加支持库com.android.support:support-v4

On Android Studio, go in the menu File > Project Structure(Ctrl + Alt + Shift + S) Select app, tab Dependecies, and in the +and search for the Maven libraries that you will use. In your case, the com.android.support:support-v4enter image description here

在 Android Studio 上,进入菜单File > Project Structure(Ctrl + Alt + Shift + S) 选择app,选项卡Dependecies,然后在+ 中搜索您将使用的 Maven 库。在你的情况下,com.android.support:support-v4在此处输入图片说明

回答by Vsw10

Please Perform these two steps: 1)It's better to create libs folder and add "android-support-v4.jar" and dont forget to check checkbox mentioning "system library " . 2) Copy "android-support-v4.jar" from "adt-bundle-linux-x86-20140702/sdk/extras/android/support/v4" folder to your "/home/vinny/workspace/appcompat_v7/libs" appcompat libs folder.You can add "android-support-v7-appcompat.jar" this jar also to this folder from "adt-bundle-linux-x86-20140702/sdk/extras/android/support/v7"

请执行以下两个步骤: 1)最好创建 libs 文件夹并添加“android-support-v4.jar”,不要忘记选中提及“系统库”的复选框。2)将“android-support-v4.jar”从“adt-bundle-linux-x86-20140702/sdk/extras/android/support/v4”文件夹复制到你的“/home/vinny/workspace/appcompat_v7/libs”appcompat libs文件夹。您也可以将“android-support-v7-appcompat.jar”这个jar也从“adt-bundle-linux-x86-20140702/sdk/extras/android/support/v7”添加到这个文件夹中

Note: Don't forget to perform this step, properties->Android->Library-> add

注意:不要忘记执行这一步,properties->Android->Library->add