尝试通过V4兼容导致NoClassDefFoundErrors使用DialogFragments [英] Trying to use DialogFragments via v4 compatability causes NoClassDefFoundErrors

查看:242
本文介绍了尝试通过V4兼容导致NoClassDefFoundErrors使用DialogFragments的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候和致敬,

短版本:我试图利用DialogFragment在我的Andr​​oid应用程序,它具有8 minSkdVersion(Android 2.2的)。为了利用他们,我必须能够称之为getSupportFragmentManager()。为了做到这一点,我试图改变呼叫活动到FragmentActivity,允许getSupportFragmentManager()在运行时来解决,而是试图创造意图在运行时,我得到的NoClassDefFoundError作为应用程序无法解决的东西上游它

Short Version: I am trying to make use of DialogFragment in my Android Application which has a minSkdVersion of 8 (Android 2.2). In order to make use of them, I must be able to call "getSupportFragmentManager()". In order to do this, I tried altering the calling Activity to a FragmentActivity, which allowed getSupportFragmentManager() to resolve at run time, but when trying to create that intent at runtime I get a NoClassDefFoundError as the application can't resolve something upstream of it

W / dalvikvm(333):无法解析超...

W/dalvikvm(333): Unable to resolve superclass...

既然如此,我怎么能调用getSupportFragmentManager()从一个简单的活动,没有作出该项活动FragmentActivity(其中没有工作)?或者我需要,使活动成为FragmentActivity,但我需要做一些其他的变化使它工作?

That being the case, how can I call getSupportFragmentManager() from a simple Activity without making that activity a FragmentActivity (which failed to work)? Or do I need to make the activity into a FragmentActivity, but I need to make a few other changes to make it work?

只是为了记录:我已经添加了Android的支持 - v4.jar到项目(否则,我不能够编译所有)

Just for the record: I have added the android-support-v4.jar to the project already (otherwise, I'd not be able to compile at all).

感谢您提前为您的帮助。

Thank you in advance for your assistance.

推荐答案

由于FragmentActivity是无法找到的课,我想我知道是什么问题。你确定你的兼容性库得到包含您的APK?您可以使用dex2jar进行检查。看来你需要移动你的图书馆到文件夹,他们得到列入了android工具更新的版本。

Since the FragmentActivity is the class that can't be found, I think I know what the problem is. Are you sure your compatibility library is getting included with your apk? You can use dex2jar to check this. It seems that you need to move your libraries to the libs folder for them to get included in newer revisions of the android tools.

这篇关于尝试通过V4兼容导致NoClassDefFoundErrors使用DialogFragments的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆