我在我的Android应用程序中使用ListViewAnimations
核心库3.1.0版。我根据setup instructions只包含了lib-core
库。但不幸的是,我收到以下错误java.lang.NoClassDefFoundError
:
java.lang.NoClassDefFoundError: Failed resolution of: [Lcom/nineoldandroids/animation/Animator;
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at com.nhaarman.listviewanimations.appearance.AnimationAdapter.animateViewIfNecessary(AnimationAdapter.java:174)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at com.nhaarman.listviewanimations.appearance.AnimationAdapter.getView(AnimationAdapter.java:145)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.AbsListView.obtainView(AbsListView.java:2346)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.makeAndAddView(ListView.java:1875)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.fillDown(ListView.java:702)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.fillFromTop(ListView.java:763)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.layoutChildren(ListView.java:1684)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.AbsListView.onLayout(AbsListView.java:2148)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.view.View.layout(View.java:16630)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:5437)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
我在我的应用中使用此动画库,如下所示:
ListView lv = new ListView(getActivity());
SwingBottomInAnimationAdapter bottomInAnimationAdapter = new SwingBottomInAnimationAdapter(new ArrayAdapter<String>(getActivity(), R.layout.subgroup_list_layout, R.id.textView, result));
bottomInAnimationAdapter.setAbsListView(lv);
lv.setAdapter(bottomInAnimationAdapter);
知道我做错了吗?
答案 0 :(得分:0)
你还应该包括&#34; nineoldandroids-2.4.0.jar&#34;项目中的文件以及dependencies {
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
}
将jar文件添加到lib文件夹并依赖添加此行
compile files('libs/nineoldandroids-2.4.0.jar')
它适用于此错误&#34; java.lang.NoClassDefFoundError:解析失败:[Lcom / nineoldandroids / animation / Animator;&#34;
链接下载jar文件https://github.com/downloads/JakeWharton/NineOldAndroids/nineoldandroids-2.4.0.jar