我花了一周的时间来解决Android 4.0.x的这个错误,但仍然无法修复它,所以我必须来这里请专业编码人员帮我解决这个错误。
我的游戏工作在Android 4.2.x上找到了,但它在Android 4.0.x上出错了。
Bellow是我从Developer Console(Crashes& ANRs)复制的错误日志。
java.lang.NoSuchMethodError: android.view.ViewPropertyAnimator.withEndAction
at kids.games.antsmasherkhmer.play_1.translate6(play_1.java:1560)
at kids.games.antsmasherkhmer.play_1.onCreate(play_1.java:138)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
at dalvik.system.NativeStart.main(Native Method)
public void translate6()
{
//Get Screen H, W
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int Screen_Width = size.x;
int Screen_Height = size.y;
ant_play_6 = (ImageView) findViewById(R.id.ant_play_6);
ant_play_6.setBackgroundResource(R.drawable.ant_3_walking);
walking_6 = (AnimationDrawable) ant_play_6.getBackground();
ant_play_6.setVisibility(View.VISIBLE);
ant_play_6.setEnabled(true);
walking_6.start();
ant_play_6.setX((Screen_Width/2)-(ant_WH.getWidth()/2));
ant_play_6.setY(-(ant_WH.getHeight()));
ant_play_6.animate().setDuration(10000);
ant_play_6.animate().translationY(Screen_Height+ant_WH.getHeight()+bigboss_WH.getHeight());
ant_play_6.animate().withEndAction(new Runnable() {
@Override
public void run() {
lifeUpdate();
}
});
ant_play_6.animate().setListener(new AnimatorListenerAdapter(){
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
translate6();
}
}).start();
ant_play_6.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
smashed_ant.start();
walking_6.stop();
ant_play_6.animate().setListener(null);
ant_play_6.animate().cancel();
ant_play_6.setEnabled(false);
ant_play_6.setBackgroundResource(R.drawable.ant3_smashed);
//Update ant was smashed
scoreUpdate();
AlphaAnimation alpha_6 = new AlphaAnimation(1.0f, 0.0f); alpha_6.setDuration(500);
ant_play_6.startAnimation(alpha_6);
ant_play_6.setVisibility(View.GONE);
}
});
}
请在这件事上帮助我。先谢谢了。
答案 0 :(得分:0)
将AnimatorListenerAdapter
替换为AnimatorListener
。
您必须覆盖更多方法,但它将起作用。
AnimatorListenerAdapter
。