我正在编写一个Android应用程序,它在我创建的anims
和drawable
文件夹中有多个活动和文件。直到今天,我在android 4.2
运行并测试我的应用程序,它运行良好,仍然有效。但今天我尝试在android 2.2 and 2.3.3
中运行它。但即使将minSdkVersion
设置为8 (android 2.2)
,它也会失败。它会抛出下面的exeption
,我找不到任何解决方法。你有这个错误的解决方案吗?我真的在网上找不到任何关于它的东西。谢谢。
这是抛出错误的地方:
@SuppressLint("NewApi")
public void slideUpDown(final View view) {
final Animation bottomUp = AnimationUtils.loadAnimation(this, R.anim.sowc_bottom_up);
final Animation bottomDown = AnimationUtils.loadAnimation(this, R.anim.sowc_bottom_down);
if (!isPanelShown()) {
hiddenPanel.startAnimation(bottomUp);
hiddenPanel.setVisibility(View.VISIBLE);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ObjectAnimator colorFade = ObjectAnimator.ofObject(view, "backgroundColor", new ArgbEvaluator(), Color.argb(0, 0, 0, 0), Color.argb(200, 0, 0, 0));
colorFade.setDuration(300);
colorFade.start();
}
}, 300);
}
else {
ObjectAnimator colorFade = ObjectAnimator.ofObject(view, "backgroundColor", new ArgbEvaluator(), Color.argb(200, 0, 0, 0), Color.argb(0, 0, 0, 0));
colorFade.setDuration(300);
colorFade.start();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
hiddenPanel.startAnimation(bottomDown);
hiddenPanel.setVisibility(View.GONE);
}
}, 200);
}
}
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: android.animation.ArgbEvaluator
at com.inovarge.shoponway.activities.LoginActivity$1.run(LoginActivity.java:64)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)