eclipse typeanumber 中的错误 - android.support.v4.app.fragment 无法解决

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

error in typeanumber - android.support.v4.app.fragment cannot be resolved

eclipsegoogle-play-games

提问by Hamzah Malik

Im using eclipse ide and recently decided to try out the google play game services. Im following this tutorial:

我使用 eclipse ide,最近决定试用 google play 游戏服务。我正在关注本教程:

https://developers.google.com/games/services/android/quickstart#before_you_begin

https://developers.google.com/games/services/android/quickstart#before_you_begin

Ive added the google play services SDK by downloading using android SDK manager, then copying the folder to my workspace. I then used file>import>android>project from exisiting code.

我通过使用 android SDK 管理器下载添加了 google play services SDK,然后将该文件夹复制到我的工作区。然后我使用了现有代码中的文件>导入>android>项目。

In step three it is adking me to import the typeanumber project. However as soon as i import it there are errors in it.

在第三步中,它建议我导入 typeanumber 项目。但是,一旦我导入它,就会出现错误。

Am i doing something wrong?

难道我做错了什么?

Ive searched around but nothing seems to help

我四处寻找,但似乎没有任何帮助

采纳答案by Hamzah Malik

I fixed this myself by adding the google-play-lib library and BaseGameUtil to the Android build path NOT the java build path. That is, under project properties, in the Android tab, add the libraries

我通过将 google-play-lib 库和 BaseGameUtil 添加到 Android 构建路径而不是 java 构建路径来解决这个问题。即,在项目属性下,在Android选项卡中,添加库

回答by Shilpa

Go to the project properties -> Java Build Path -> Libraries -> Add External JARs (Under 'extras' folder select 'Android' -> support -> v4 -> android-support-v4.jar) Add the file and build the project to get rid of this error

转到项目属性 -> Java 构建路径 -> 库 -> 添加外部 JAR(在 'extras' 文件夹下选择 'Android' -> support -> v4 -> android-support-v4.jar)添加文件并构建项目摆脱这个错误

回答by Jeremy Scoggins

You need to make sure android-support-v4.jaris in your project Libraries (in project properties, under Java Build Path.

您需要确保android-support-v4.jar在您的项目库中(在项目属性中,在 Java Build Path 下。

http://developer.android.com/tools/support-library/index.html

http://developer.android.com/tools/support-library/index.html

http://developer.android.com/tools/support-library/setup.html

http://developer.android.com/tools/support-library/setup.html

回答by mariabina07

I got that error too, but I used appCompat library. You must close appCompat project then clean your project, run it until it failed. Then open the appCompat project, then clean your project, and run it.

我也遇到了那个错误,但我使用了 appCompat 库。您必须关闭 appCompat 项目,然后清理您的项目,运行它直到它失败。然后打开 appCompat 项目,然后清理您的项目,并运行它。

回答by E.Salah

android.support.v4.app.fragmentcannot be resolved

android.support.v4.app.fragment无法解决

hay guys find easy way

干草家伙找到简单的方法

1-import android.support.v4.app.Fragment;

1-import android.support.v4.app.Fragment;

2-here is the code will looks like.

2-这里是代码的样子。

if (view == findViewById(R.id.button))
{
    fragment = new FragmentOne();
    android.support.v4.app.FragmentManager fm =getSupportFragmentManager(); 
    android.support.v4.app.FragmentTransaction ft = fm.beginTransaction();
    android.support.v4.app.FragmentTransaction replace = ft.replace(R.id.fragment_place, fragment); 
    ft.commit();
}

you will just add android.support.v4.app.getSupportFragmentManager();instead getFragmentManager();

你只是补充android.support.v4.app.getSupportFragmentManager();而不是getFragmentManager();

it works good luck.

祝你好运。