在我的应用程序中添加一个动画我的位图的类后,它们将不再出现在galaxy s3或s2手机上,但无论os版本如何都会出现在s4上。
测试:
s4 os版本4.3 - 工作。
s4 os版本4.2.2 - 有效。
s3 os版本4.2.2 - 失败。
s3 os版本4.1.1 - 失败。
s2 os版本4.2.2 - 失败。
在进行调试时,我注意到ondraw方法中没有一个方法由于某种原因而执行,但循环和if语句仍然被读取。
编辑:在恢复动画类的添加后,游戏再次在s3上运行,但我需要该类才能为我的精灵制作动画。我要去做更多的测试。EDIT2:我尝试过改变" bullet"从位图返回到动画。在画布试图绘制子弹之前一直正常。此时,画布的任何更新都不会被绘制。
任何已绘制的内容都会停留,但在ondraw()方法尝试绘制动画提取的位图之后,不会绘制任何先前未绘制的位图。
EDIT3:我发现了问题的根源。在s3上,Bitmap.createBitmap(Bitmap,int,int,int,int)似乎作为空透明位图返回。知道为什么吗?
EDIT4:决定尝试在动画类中调用Bitmap.createBitmap'构造函数,看看在每个绘图中调用它是否使用了太多的内存。仍然适用于s4,但在s3上它抛出了这个异常。
04-30 00:01:30.531: W/dalvikvm(1364): threadid=1: thread exiting with uncaught exception (group=0xa6156908)
04-30 00:01:30.531: E/AndroidRuntime(1364): FATAL EXCEPTION: main
04-30 00:01:30.531: E/AndroidRuntime(1364): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.irksomesloth.botbreaker/com.irksomesloth.botbreaker.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class com.irksomesloth.botbreaker.GameView
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.os.Handler.dispatchMessage(Handler.java:99)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.os.Looper.loop(Looper.java:137)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-30 00:01:30.531: E/AndroidRuntime(1364): at java.lang.reflect.Method.invokeNative(Native Method)
04-30 00:01:30.531: E/AndroidRuntime(1364): at java.lang.reflect.Method.invoke(Method.java:511)
04-30 00:01:30.531: E/AndroidRuntime(1364): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-30 00:01:30.531: E/AndroidRuntime(1364): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-30 00:01:30.531: E/AndroidRuntime(1364): at dalvik.system.NativeStart.main(Native Method)
04-30 00:01:30.531: E/AndroidRuntime(1364): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.irksomesloth.botbreaker.GameView
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
04-30 00:01:30.531: E/AndroidRuntime(1364): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.Activity.setContentView(Activity.java:1881)
04-30 00:01:30.531: E/AndroidRuntime(1364): at com.irksomesloth.botbreaker.MainActivity.onCreate(MainActivity.java:15)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.Activity.performCreate(Activity.java:5104)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
04-30 00:01:30.531: E/AndroidRuntime(1364): ... 11 more
04-30 00:01:30.531: E/AndroidRuntime(1364): Caused by: java.lang.reflect.InvocationTargetException
04-30 00:01:30.531: E/AndroidRuntime(1364): at java.lang.reflect.Constructor.constructNative(Native Method)
04-30 00:01:30.531: E/AndroidRuntime(1364): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
04-30 00:01:30.531: E/AndroidRuntime(1364): ... 22 more
04-30 00:01:30.531: E/AndroidRuntime(1364): Caused by: java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.graphics.Bitmap.createBitmap(Bitmap.java:546)
04-30 00:01:30.531: E/AndroidRuntime(1364): at android.graphics.Bitmap.createBitmap(Bitmap.java:514)
04-30 00:01:30.531: E/AndroidRuntime(1364): at com.irksomesloth.botbreaker.Animation.<init>(Animation.java:20)
04-30 00:01:30.531: E/AndroidRuntime(1364): at com.irksomesloth.botbreaker.GameView.<init>(GameView.java:56)
04-30 00:01:30.531: E/AndroidRuntime(1364): ... 25 more
....这里是动画类的新构造函数,供参考:
public class Animation {
private Bitmap[] bmpFrames;
private int intWidth;
private int intHeight;
private int intFrames;
private int intFrameCount = 0;
private double dblFrameMod = 0.25;
private int intMyFrame = 0;
public Animation(Bitmap source, int width, int height, int frames){
intWidth = width;
intHeight = height;
intFrames = frames;
bmpFrames = new Bitmap[intFrames];
for(int i = 0; i < intFrames; i++){
bmpFrames[i] = Bitmap.createBitmap(source, intWidth * i , intHeight * i,
intWidth * i + intWidth - 1, intHeight * i + intHeight - 1);
}
}
public Bitmap getBitmap(){
return bmpFrames[intMyFrame];
}
表面视图的代码,正在绘制位图:
编辑:在有人要求之前,高度和宽度是位图的确切高度和宽度,目前是占位符。
package com.irksomesloth.botbreaker;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Point;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
public class GameView extends SurfaceView implements SurfaceHolder.Callback{
//controllers
private GameLogic session;
private SurfaceHolder holder;
private FrameThread thread;
//touch-based stuff
private Point pntTouch;
//lane stuff
private int[] intLaneTimer;
private Animation laneIdle;
private Animation laneAct;
private Animation laneTouched;
private Animation laneBroke;
private ShotLane[] lanes;
//bullet stuff
private Animation bullet;
//player stuff
private Animation playerIdle;
private Animation playerDead;
//game status stuff
private boolean blnInitialized = false;
private boolean blnGameLoss = false;
private boolean blnPaused = false;
private String strHiScore;
//drawing tools
//BitmapFactory.Options setup = new BitmapFactory.Options();
private Paint p;
private Matrix m;
public GameView(Context context, AttributeSet attrs) {
super(context, attrs);
holder = getHolder();
//init animation thread
thread = new FrameThread(this);
//init touch detection variable
pntTouch = new Point(-100, -100);
//init lane sprites
laneIdle = new Animation(BitmapFactory.decodeResource(getResources(), R.drawable.laneidle), 437, 1000, 1);
laneAct = new Animation(BitmapFactory.decodeResource(getResources(), R.drawable.laneact), 437, 1000, 1);
laneTouched = new Animation(BitmapFactory.decodeResource(getResources(), R.drawable.lanetouched), 437, 1000, 1);
laneBroke = new Animation(BitmapFactory.decodeResource(getResources(), R.drawable.lanebroke), 437, 1000, 1);
//init bullet sprite
bullet = new Animation(BitmapFactory.decodeResource(getResources(), R.drawable.bullet), 150 , 150, 1);
//init player sprites
playerIdle = new Animation(BitmapFactory.decodeResource(getResources(), R.drawable.player), 200, 200 , 1);
playerDead = new Animation(BitmapFactory.decodeResource(getResources(), R.drawable.playerdead), 200, 200, 1);
//init lane data
intLaneTimer = new int[6];
lanes = new ShotLane[6];
//init drawing tools
//setup.inPurgeable = true;
p = new Paint();
m = new Matrix();
//add our callback
holder.addCallback(this);
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
//now that our surfaceview has dimensions
//we can init our game logic contoller
session = new GameLogic(getWidth(), getHeight());
// the line below this is line 80, which the second logcat is pointing to
p.setColor(Color.WHITE);
p.setTextSize(getHeight() / 4);
p.setTextAlign(Align.CENTER);
//...and start the animation thread
thread.setFPS(session.getFPS());
thread.runThread(true);
thread.start();
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
boolean blnRetry = true;
thread.runThread(false);
while(blnRetry){
try{
thread.join();
blnRetry = false;
}
catch(InterruptedException e){
}
}
thread = null;
session = null;
p = null;
m = null;
}
@SuppressLint("DrawAllocation")
@Override
public void onDraw(Canvas canvas){
canvas.drawColor(Color.BLACK);
//lets update our game controller
//and see if we got a game over
blnGameLoss = session.Update();
Point pntTouchTest = pntTouch;
pntTouch = new Point(-100, -100);
//on our first ondraw we'll init our lanes
for(int i = 0; i < 6; i++){
if(!blnInitialized){
lanes[i] = new ShotLane(laneIdle, laneAct, laneTouched, laneBroke,
i + 1, session.getPlayerX(), session.getPlayerY(), session.getCornerAngle());
}
m.reset();
m.postTranslate(lanes[i].getX(), lanes[i].getY());
m.postRotate((float) lanes[i].getAngle(), session.getPlayerX(), session.getPlayerY());
canvas.drawBitmap(lanes[i].getCurrentSprite().getBitmap(), m, p);
lanes[i].stepSprite();
if(pntTouchTest.x > 0 && pntTouchTest.y > 0){
if(lanes[i].DetectTouch(pntTouchTest.x, pntTouchTest.y)){
pntTouchTest = new Point(-100, -100);
boolean blnHit = session.Shoot(lanes[i].getId());
if(blnHit){
lanes[i].setSprite(1);
intLaneTimer[i] = 6;
}
else{
lanes[i].setSprite(2);
intLaneTimer[i] = 6;
}
}
}
if(intLaneTimer[i] > 0){
intLaneTimer[i]--;
}
else{
lanes[i].setSprite(0);
}
}
//process and draw any bullets that are in play
for(int b = 0; b < session.getBulletCount(); b++){
Point pntBullet = new Point(session.getBulletX(b) - (bullet.getBitmap().getWidth() / 2), session.getBulletY(b) - (bullet.getBitmap().getHeight() / 2));
m.reset();
m.postTranslate(pntBullet.x, pntBullet.y);
m.postRotate((float) session.getBulletAngle(b), session.getBulletX(b), session.getBulletY(b));
canvas.drawBitmap(bullet.getBitmap(), m, p);
bullet.step();
if(session.getBulletId(b) > 0){
int i = session.getBulletId(b) - 1;
lanes[i].setSprite(3);
intLaneTimer[i] = 6;
}
}
canvas.drawText(String.valueOf(session.getScore()), session.getPlayerX(), (getHeight() * 3 / 16) + (p.getTextSize() / 3), p);
canvas.drawText(strHiScore, session.getPlayerX(), (int) (getHeight() * 13 / 16) + (p.getTextSize() / 3), p);
//handle any confirmed game losses
if(blnGameLoss){
canvas.drawBitmap(playerDead.getBitmap(), session. getPlayerX() - (playerDead.getBitmap().getWidth() / 2), session.getPlayerY() - (playerDead.getBitmap().getHeight() / 2), p);
playerDead.step();
}
else{
//if we haven't lost, draw the player as normal
canvas.drawBitmap(playerIdle.getBitmap(), session. getPlayerX() - (playerIdle.getBitmap().getWidth() / 2), session.getPlayerY() - (playerIdle.getBitmap().getHeight() / 2), p);
playerIdle.step();
}
//the game was initialized in this ondraw
//so we wont need to re-initialize them
blnInitialized = true;
if(blnPaused){
canvas.drawARGB(120, 0, 0, 0);
}
}
public void PauseGame(){
blnPaused = true;
thread.setState(false);
}
public void ResumeGame(){
blnPaused = false;
thread.setState(true);
}
public void setHiScore(String score){
strHiScore = score;
}
public int getScore(){
try{
return session.getScore();
}
catch (Exception NullPointerException){
return 0;
}
}
public boolean getLoss(){
return blnGameLoss;
}
public void dump(){
laneIdle.purge();
laneAct.purge();
laneTouched.purge();
laneBroke.purge();
bullet.purge();
playerIdle.purge();
playerDead.purge();
blnInitialized = false;
blnGameLoss = false;
blnPaused = false;
System.gc();
}
@Override
public boolean onTouchEvent(MotionEvent event){
if(!blnGameLoss){
if(event.getAction() == MotionEvent.ACTION_DOWN){
//find the point on the screen the user touched
pntTouch.x = (int) event.getX();
pntTouch.y = (int) event.getY();
}
}
return true;
}
}
动画类的代码,我将表面视图中的位图替换为:
package com.irksomesloth.botbreaker;
import android.graphics.Bitmap;
public class Animation {
private Bitmap bmpSource;
private int intWidth;
private int intHeight;
private int intFrames;
private int intFrameCount = 0;
private double dblFrameMod = 0.25;
private int intMyFrame = 0;
public Animation(Bitmap source, int width, int height, int frames){
bmpSource = source;
intWidth = width;
intHeight = height;
intFrames = frames;
}
public Bitmap getBitmap(){
return Bitmap.createBitmap(bmpSource, intWidth * intMyFrame , intHeight * intMyFrame,
intWidth * intMyFrame + intWidth, intHeight * intMyFrame + intHeight);
}
public void setFrame(int frame){
intFrameCount = frame;
}
public int getFrame(){
return intFrameCount;
}
public void step(){
intMyFrame = (int) Math.floor(intFrameCount * dblFrameMod);
intFrameCount++;
if(intMyFrame == intFrames - 1){
intFrameCount = 0;
}
}
public void purge(){
bmpSource.recycle();
}
}
在s3 v 4.2.2上生成logcat:
04-28 23:02:35.188: D/dalvikvm(1202): Late-enabling CheckJNI
04-28 23:02:35.284: E/Trace(1202): error opening trace file: No such file or directory (2)
04-28 23:02:35.308: D/dalvikvm(1202): GC_FOR_ALLOC freed 51K, 7% free 2396K/2564K, paused 3ms, total 8ms
04-28 23:02:35.312: I/dalvikvm-heap(1202): Grow heap (frag case) to 4.115MB for 1748012-byte allocation
04-28 23:02:35.316: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 4% free 4102K/4272K, paused 1ms+0ms, total 4ms
04-28 23:02:35.316: D/dalvikvm(1202): WAIT_FOR_CONCURRENT_GC blocked 2ms
04-28 23:02:35.320: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 4% free 4102K/4272K, paused 3ms, total 3ms
04-28 23:02:35.324: I/dalvikvm-heap(1202): Grow heap (frag case) to 4.855MB for 776400-byte allocation
04-28 23:02:35.328: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 4% free 4860K/5032K, paused 4ms, total 4ms
04-28 23:02:35.332: D/dalvikvm(1202): GC_CONCURRENT freed 0K, 4% free 4860K/5032K, paused 2ms+1ms, total 4ms
04-28 23:02:35.340: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 38% free 3153K/5032K, paused 2ms, total 2ms
04-28 23:02:35.340: I/dalvikvm-heap(1202): Grow heap (frag case) to 4.855MB for 1748012-byte allocation
04-28 23:02:35.344: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 4% free 4860K/5032K, paused 1ms+0ms, total 3ms
04-28 23:02:35.368: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 3% free 5618K/5792K, paused 18ms+0ms, total 22ms
04-28 23:02:35.444: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 33% free 3912K/5792K, paused 22ms, total 22ms
04-28 23:02:35.448: I/dalvikvm-heap(1202): Grow heap (frag case) to 5.595MB for 1748012-byte allocation
04-28 23:02:35.460: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 3% free 5619K/5792K, paused 3ms+0ms, total 10ms
04-28 23:02:35.496: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 29% free 4670K/6552K, paused 3ms, total 7ms
04-28 23:02:35.496: I/dalvikvm-heap(1202): Grow heap (frag case) to 6.336MB for 1748012-byte allocation
04-28 23:02:35.500: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 3% free 6377K/6552K, paused 1ms+0ms, total 4ms
04-28 23:02:35.596: D/dalvikvm(1202): GC_CONCURRENT freed 1951K, 28% free 5694K/7832K, paused 7ms+1ms, total 19ms
04-28 23:02:35.596: D/dalvikvm(1202): WAIT_FOR_CONCURRENT_GC blocked 12ms
04-28 23:02:35.632: D/libEGL(1202): loaded /system/lib/egl/libEGL_emulation.so
04-28 23:02:35.636: D/(1202): HostConnection::get() New Host Connection established 0xb8ef1b80, tid 1202
04-28 23:02:35.648: D/libEGL(1202): loaded /system/lib/egl/libGLESv1_CM_emulation.so
04-28 23:02:35.648: D/libEGL(1202): loaded /system/lib/egl/libGLESv2_emulation.so
04-28 23:02:35.740: W/EGL_emulation(1202): eglSurfaceAttrib not implemented
04-28 23:02:35.756: D/OpenGLRenderer(1202): Enabling debug mode 0
04-28 23:02:35.776: D/(1202): HostConnection::get() New Host Connection established 0xb8ed59c8, tid 1221
04-28 23:02:37.784: W/EGL_emulation(1202): eglSurfaceAttrib not implemented
04-28 23:02:46.972: D/dalvikvm(1202): GC_EXPLICIT freed 3755K, 67% free 2585K/7812K, paused 0ms+1ms, total 6ms
04-28 23:02:47.004: D/dalvikvm(1202): GC_FOR_ALLOC freed 176K, 69% free 2423K/7812K, paused 2ms, total 2ms
04-28 23:02:47.004: I/dalvikvm-heap(1202): Grow heap (frag case) to 4.143MB for 1748012-byte allocation
04-28 23:02:47.040: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 48% free 4130K/7812K, paused 37ms, total 37ms
04-28 23:02:47.044: D/dalvikvm(1202): GC_CONCURRENT freed 0K, 48% free 4130K/7812K, paused 2ms+0ms, total 4ms
04-28 23:02:47.056: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 48% free 4130K/7812K, paused 5ms, total 8ms
04-28 23:02:47.060: I/dalvikvm-heap(1202): Grow heap (frag case) to 4.884MB for 776400-byte allocation
04-28 23:02:47.060: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 38% free 4888K/7812K, paused 3ms, total 3ms
04-28 23:02:47.064: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 38% free 4888K/7812K, paused 1ms+1ms, total 3ms
04-28 23:02:47.084: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 60% free 3181K/7812K, paused 9ms, total 9ms
04-28 23:02:47.084: I/dalvikvm-heap(1202): Grow heap (frag case) to 4.884MB for 1748012-byte allocation
04-28 23:02:47.088: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 38% free 4888K/7812K, paused 1ms+0ms, total 5ms
04-28 23:02:47.096: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 28% free 5647K/7812K, paused 1ms+1ms, total 4ms
04-28 23:02:47.112: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 50% free 3940K/7812K, paused 10ms, total 11ms
04-28 23:02:47.112: I/dalvikvm-heap(1202): Grow heap (frag case) to 5.625MB for 1748012-byte allocation
04-28 23:02:47.116: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 28% free 5647K/7812K, paused 2ms+1ms, total 4ms
04-28 23:02:47.132: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 28% free 5647K/7812K, paused 13ms, total 13ms
04-28 23:02:47.132: I/dalvikvm-heap(1202): Grow heap (frag case) to 6.365MB for 776400-byte allocation
04-28 23:02:47.144: D/dalvikvm(1202): GC_FOR_ALLOC freed 0K, 26% free 6405K/8572K, paused 3ms, total 3ms
04-28 23:02:47.152: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 46% free 4698K/8572K, paused 4ms, total 4ms
04-28 23:02:47.152: I/dalvikvm-heap(1202): Grow heap (frag case) to 6.365MB for 1748012-byte allocation
04-28 23:02:47.156: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 26% free 6405K/8572K, paused 2ms+1ms, total 4ms
04-28 23:02:47.160: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 26% free 6405K/8572K, paused 2ms, total 2ms
04-28 23:02:47.168: I/dalvikvm-heap(1202): Grow heap (frag case) to 7.106MB for 776400-byte allocation
04-28 23:02:47.192: D/dalvikvm(1202): GC_FOR_ALLOC freed 0K, 24% free 7163K/9332K, paused 11ms, total 11ms
04-28 23:02:47.244: W/EGL_emulation(1202): eglSurfaceAttrib not implemented
04-28 23:02:47.256: D/(1202): HostConnection::get() New Host Connection established 0xb8ef1b68, tid 1224
04-28 23:02:47.588: W/EGL_emulation(1202): eglSurfaceAttrib not implemented
04-28 23:02:47.780: D/dalvikvm(1202): GC_EXPLICIT freed 2466K, 38% free 5816K/9332K, paused 1ms+0ms, total 4ms
04-28 23:02:47.788: D/dalvikvm(1202): GC_FOR_ALLOC freed 6K, 38% free 5822K/9332K, paused 1ms, total 4ms
04-28 23:02:47.788: I/dalvikvm-heap(1202): Grow heap (frag case) to 7.463MB for 1748012-byte allocation
04-28 23:02:47.792: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 20% free 7529K/9332K, paused 3ms, total 3ms
04-28 23:02:47.792: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 20% free 7529K/9332K, paused 0ms+0ms, total 2ms
04-28 23:02:47.804: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 20% free 7529K/9332K, paused 8ms, total 8ms
04-28 23:02:47.804: I/dalvikvm-heap(1202): Grow heap (frag case) to 8.204MB for 776400-byte allocation
04-28 23:02:47.820: D/dalvikvm(1202): GC_FOR_ALLOC freed 0K, 18% free 8288K/10092K, paused 6ms, total 6ms
04-28 23:02:47.828: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 35% free 6581K/10092K, paused 3ms, total 9ms
04-28 23:02:47.828: I/dalvikvm-heap(1202): Grow heap (frag case) to 8.204MB for 1748012-byte allocation
04-28 23:02:47.832: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 18% free 8288K/10092K, paused 2ms+1ms, total 4ms
04-28 23:02:47.848: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 18% free 8288K/10092K, paused 12ms, total 12ms
04-28 23:02:47.848: I/dalvikvm-heap(1202): Grow heap (frag case) to 8.945MB for 776400-byte allocation
04-28 23:02:47.868: D/dalvikvm(1202): GC_FOR_ALLOC freed 0K, 17% free 9046K/10852K, paused 11ms, total 11ms
04-28 23:02:47.872: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 33% free 7339K/10852K, paused 3ms, total 3ms
04-28 23:02:47.872: I/dalvikvm-heap(1202): Grow heap (frag case) to 8.945MB for 1748012-byte allocation
04-28 23:02:47.880: D/dalvikvm(1202): GC_CONCURRENT freed <1K, 17% free 9046K/10852K, paused 2ms+0ms, total 7ms
04-28 23:02:47.880: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 17% free 9046K/10852K, paused 2ms, total 2ms
04-28 23:02:47.884: I/dalvikvm-heap(1202): Grow heap (frag case) to 9.685MB for 776400-byte allocation
04-28 23:02:47.908: D/dalvikvm(1202): GC_FOR_ALLOC freed 0K, 16% free 9804K/11612K, paused 14ms, total 14ms
04-28 23:02:47.912: D/dalvikvm(1202): GC_FOR_ALLOC freed 1707K, 31% free 8097K/11612K, paused 3ms, total 3ms
04-28 23:02:47.924: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 16% free 9805K/11612K, paused 8ms, total 8ms
04-28 23:02:47.924: I/dalvikvm-heap(1202): Grow heap (frag case) to 10.425MB for 776400-byte allocation
04-28 23:02:47.924: D/dalvikvm(1202): GC_FOR_ALLOC freed <1K, 15% free 10563K/12372K, paused 3ms, total 3ms
04-28 23:02:47.976: W/EGL_emulation(1202): eglSurfaceAttrib not implemented
04-28 23:02:48.212: W/EGL_emulation(1202): eglSurfaceAttrib not implemented
答案 0 :(得分:0)
将我的动画的宽度和高度设置为source.getwidth()和source.getHeight()由于某种原因而修复它,即使数值完全相同。
我猜它在s3和s2上读得很奇怪?