gpt4 book ai didi

android - 在 2.2 错误上运行 fragment - 找不到类

转载 作者:行者123 更新时间:2023-11-29 02:01:26 25 4
gpt4 key购买 nike

我正在尝试使我的应用向后兼容 Android 2.2。

我有 Fragments、ListFragments、FragmentPagerAdapter 和 ActionBarSherlock 都在发生。

我已经包含了 android 支持库,并且构建在我的 android 4.1 设备上完美运行,但在 2.2 设备上,我得到以下信息:

09-21 00:10:32.867: I/dalvikvm(1229): Failed resolving Lanother/music/player/AlbumListFragment; interface 521 'Landroid/widget/SearchView$OnQueryTextListener;'
09-21 00:10:32.877: W/dalvikvm(1229): Link of class 'Lanother/music/player/AlbumListFragment;' failed
09-21 00:10:32.877: E/dalvikvm(1229): Could not find class 'another.music.player.AlbumListFragment', referenced from method another.music.player.MainActivity.<init>
09-21 00:10:32.877: W/dalvikvm(1229): VFY: unable to resolve new-instance 531 (Lanother/music/player/AlbumListFragment;) in Lanother/music/player/MainActivity;
09-21 00:10:32.877: I/dalvikvm(1229): Could not find method another.music.player.MainActivity.getActionBar, referenced from method another.music.player.MainActivity.onCreate
09-21 00:10:32.887: W/dalvikvm(1229): VFY: unable to resolve virtual method 3906: Lanother/music/player/MainActivity;.getActionBar ()Landroid/app/ActionBar;
09-21 00:10:32.887: I/dalvikvm(1229): Failed resolving Lanother/music/player/AlbumListFragment; interface 521 'Landroid/widget/SearchView$OnQueryTextListener;'
09-21 00:10:32.887: W/dalvikvm(1229): Link of class 'Lanother/music/player/AlbumListFragment;' failed
09-21 00:10:32.887: E/dalvikvm(1229): Could not find class 'another.music.player.AlbumListFragment', referenced from method another.music.player.MainActivity.onListItemClicked
09-21 00:10:32.887: W/dalvikvm(1229): VFY: unable to resolve new-instance 531 (Lanother/music/player/AlbumListFragment;) in Lanother/music/player/MainActivity;
09-21 00:10:32.887: I/dalvikvm(1229): Failed resolving Lanother/music/player/SongListFragment; interface 521 'Landroid/widget/SearchView$OnQueryTextListener;'
09-21 00:10:32.887: W/dalvikvm(1229): Link of class 'Lanother/music/player/SongListFragment;' failed
09-21 00:10:32.887: E/dalvikvm(1229): Could not find class 'another.music.player.SongListFragment', referenced from method another.music.player.MainActivity.onListItemClicked
09-21 00:10:32.887: W/dalvikvm(1229): VFY: unable to resolve new-instance 576 (Lanother/music/player/SongListFragment;) in Lanother/music/player/MainActivity;
09-21 00:10:32.887: I/dalvikvm(1229): Could not find method another.music.player.MainActivity.getActionBar, referenced from method another.music.player.MainActivity.onOptionsItemSelected
09-21 00:10:32.887: W/dalvikvm(1229): VFY: unable to resolve virtual method 3906: Lanother/music/player/MainActivity;.getActionBar ()Landroid/app/ActionBar;
09-21 00:10:32.887: I/dalvikvm(1229): Failed resolving Lanother/music/player/AlbumListFragment; interface 521 'Landroid/widget/SearchView$OnQueryTextListener;'
09-21 00:10:32.887: W/dalvikvm(1229): Link of class 'Lanother/music/player/AlbumListFragment;' failed
09-21 00:10:32.887: E/dalvikvm(1229): Could not find class 'another.music.player.AlbumListFragment', referenced from method another.music.player.MainActivity.onOptionsItemSelected
09-21 00:10:32.887: W/dalvikvm(1229): VFY: unable to resolve new-instance 531 (Lanother/music/player/AlbumListFragment;) in Lanother/music/player/MainActivity;
09-21 00:10:32.897: I/dalvikvm(1229): Could not find method android.support.v4.app.FragmentActivity.getActionBar, referenced from method another.music.player.ArtistListFragment.onListItemClick
09-21 00:10:32.897: W/dalvikvm(1229): VFY: unable to resolve virtual method 810: Landroid/support/v4/app/FragmentActivity;.getActionBar ()Landroid/app/ActionBar;

我已经研究了好几个小时了,但我就是不知道该尝试什么。任何建议表示赞赏。如果您需要查看一些代码,请告诉我。

谢谢。

最佳答案

我在阅读自己的 SO 问题后意识到,我没有正确解释以下内容:

09-21 00:10:32.867: I/dalvikvm(1229): Failed resolving Lanother/music/player/AlbumListFragment; interface 521 'Landroid/widget/SearchView$OnQueryTextListener;

ActionBarSherlock 似乎不支持 onQueryTextListener 和其他一些元素。反正我不需要这些方法,所以我把它们从ativity中去掉,问题就解决了。

我想 4.1 设备原生支持 onQueryTextChange,但在 2.2 设备上(ActionBarsherlock 支持 actionBar),这些方法不受支持。

关于android - 在 2.2 错误上运行 fragment - 找不到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12514556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com