android程序都没有什么错误了,就是RUN不过。看了LOG CAT ,里面的library 错误有改了,添加use library 了,还是有提示此错误。请高手解决啊。下面是完整的LOG CAT ERROR:
   06-15 02:33:57.442: ERROR/vold(550): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
06-15 02:33:57.442: ERROR/vold(550): Error bootstrapping switch '/sys/class/switch/test2' (m)
06-15 02:33:57.442: ERROR/vold(550): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
06-15 02:33:57.442: ERROR/vold(550): Error bootstrapping switch '/sys/class/switch/test' (m)
06-15 02:33:57.642: ERROR/flash_image(558): can't find recovery partition
06-15 02:34:11.181: ERROR/MemoryHeapBase(579): error opening /dev/pmem: No such file or directory
06-15 02:34:11.191: ERROR/SurfaceFlinger(579): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
06-15 02:34:11.240: ERROR/GLLogger(579): couldn't load <libhgl.so> library (Cannot find library)
06-15 02:34:11.352: ERROR/GLLogger(579): couldn't load <libhgl.so> library (Cannot find library)
06-15 02:34:14.431: ERROR/BatteryService(579): Could not open '/sys/class/power_supply/usb/online'
06-15 02:34:14.431: ERROR/BatteryService(579): Could not open '/sys/class/power_supply/battery/batt_vol'
06-15 02:34:14.431: ERROR/BatteryService(579): Could not open '/sys/class/power_supply/battery/batt_temp'
06-15 02:34:14.781: ERROR/EventHub(579): could not get driver version for /dev/input/mouse0, Not a typewriter
06-15 02:34:14.811: ERROR/EventHub(579): could not get driver version for /dev/input/mice, Not a typewriter
06-15 02:34:14.862: ERROR/System(579): Failure starting core service
06-15 02:34:14.862: ERROR/System(579): java.lang.SecurityException
06-15 02:34:14.862: ERROR/System(579):     at android.os.BinderProxy.transact(Native Method)
06-15 02:34:14.862: ERROR/System(579):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
06-15 02:34:14.862: ERROR/System(579):     at android.os.ServiceManager.addService(ServiceManager.java:72)
06-15 02:34:14.862: ERROR/System(579):     at com.android.server.ServerThread.run(SystemServer.java:163)
06-15 02:34:14.871: ERROR/AndroidRuntime(579): Crash logging skipped, no checkin service
06-15 02:34:16.392: ERROR/LockPatternKeyguardView(579): Failed to bind to GLS while checking for account
06-15 02:34:21.291: ERROR/ApplicationContext(579): Couldn't create directory for SharedPreferences file shared_prefs/wallpaper-hints.xml
06-15 02:34:22.270: ERROR/ActivityThread(625): Failed to find provider info for android.server.checkin
06-15 02:34:23.750: ERROR/ActivityThread(625): Failed to find provider info for android.server.checkin
06-15 02:34:23.851: ERROR/ActivityThread(625): Failed to find provider info for android.server.checkin

解决方案 »

  1.   

    按照你说的做拉,还是不行。咳,就是在Snake源码上修改一下,就跑不过拉。
      

  2.   

    No such file or directory,这个不是说找不到文件或路径嘛,那肯定就是路径不对啦
      

  3.   

    我有设置CLASSPATH变量,也不行。是不是还差什么。怎么设置啊。
      

  4.   

    vold是Android下的udev,硬件自动挂载不上,/sys /dev 文件系统的这种路径 、还有flash_image都找不到,听你说设置了CLASSPATH,我表示质疑:你是真机测试还是模拟器
      

  5.   

    路径出错!没有找到相应的文件!建议重新建一个项目!把里面的文件代码考到新项目中去run下!有时也经常遇到这类问题,就是不知道,明明建了文件,就是提示找不到路径!但是拷到重建的一个项目中又可以运行了!着实让人费解!LZ不妨试试!
      

  6.   

    最新的LOG CAT ERROR:
    06-22 12:53:16.870: ERROR/vold(550): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
    06-22 12:53:16.870: ERROR/vold(550): Error bootstrapping switch '/sys/class/switch/test2' (m)
    06-22 12:53:16.870: ERROR/vold(550): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
    06-22 12:53:16.870: ERROR/vold(550): Error bootstrapping switch '/sys/class/switch/test' (m)
    06-22 12:53:16.900: ERROR/flash_image(556): can't find recovery partition
    06-22 12:53:29.490: ERROR/MemoryHeapBase(578): error opening /dev/pmem: No such file or directory
    06-22 12:53:29.499: ERROR/SurfaceFlinger(578): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
    06-22 12:53:29.539: ERROR/GLLogger(578): couldn't load <libhgl.so> library (Cannot find library)
    06-22 12:53:29.641: ERROR/GLLogger(578): couldn't load <libhgl.so> library (Cannot find library)
    06-22 12:53:32.650: ERROR/BatteryService(578): Could not open '/sys/class/power_supply/usb/online'
    06-22 12:53:32.650: ERROR/BatteryService(578): Could not open '/sys/class/power_supply/battery/batt_vol'
    06-22 12:53:32.650: ERROR/BatteryService(578): Could not open '/sys/class/power_supply/battery/batt_temp'
    06-22 12:53:32.981: ERROR/EventHub(578): could not get driver version for /dev/input/mouse0, Not a typewriter
    06-22 12:53:33.010: ERROR/EventHub(578): could not get driver version for /dev/input/mice, Not a typewriter
    06-22 12:53:33.061: ERROR/System(578): Failure starting core service
    06-22 12:53:33.061: ERROR/System(578): java.lang.SecurityException
    06-22 12:53:33.061: ERROR/System(578):     at android.os.BinderProxy.transact(Native Method)
    06-22 12:53:33.061: ERROR/System(578):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
    06-22 12:53:33.061: ERROR/System(578):     at android.os.ServiceManager.addService(ServiceManager.java:72)
    06-22 12:53:33.061: ERROR/System(578):     at com.android.server.ServerThread.run(SystemServer.java:163)
    06-22 12:53:33.071: ERROR/AndroidRuntime(578): Crash logging skipped, no checkin service
    06-22 12:53:34.449: ERROR/LockPatternKeyguardView(578): Failed to bind to GLS while checking for account
    06-22 12:53:38.590: ERROR/ApplicationContext(578): Couldn't create directory for SharedPreferences file shared_prefs/wallpaper-hints.xml
    06-22 12:53:38.981: ERROR/ActivityThread(624): Failed to find provider info for android.server.checkin
    06-22 12:53:40.230: ERROR/ActivityThread(624): Failed to find provider info for android.server.checkin
    06-22 12:53:40.380: ERROR/ActivityThread(624): Failed to find provider info for android.server.checkin
      

  7.   

    系统变量CLASSPATH: %JAVA_HOME%\lib; %JAVA_HOME%\lib\dt.jar; %JAVA_HOME%\lib\tools.jar;
      

  8.   

    vold是Android下的udev,硬件自动挂载不上,/sys /dev 文件系统的这种路径 、还有flash_image都找不到
      

  9.   

    就是在Snake源码上修改一下,全局变量设置就不说了。改变的YLXZVIEW.JAVA如下:package com.android.Ylxz;import android.os.Bundle;
    import java.util.ArrayList;import java.util.Random;import com.android.Ylxz.R;import android.content.Context;
    import android.content.res.Resources;
    import android.os.Handler;
    import android.os.Message;
    import android.util.AttributeSet;
    import android.util.Log;
    import android.view.KeyEvent;
    import android.view.View;
    import android.widget.TextView;public class YlxzView extends TileView {
        /** Called when the activity is first created. */
        private static final String TAG="YlxzView";
        int mMode = READY;
        public static final int PAUSE = 0;
        public static final int READY = 1;
        public static final int RUNNING = 2;
        public static final int LOSE = 3;
                /**
         * Current direction the ylxz is headed.
         */
        int mDirection = NORTH;
        int mNextDirection = NORTH;
        static final int NORTH = 1;
        static final int SOUTH = 2;
        static final int EAST = 3;
        static final int WEST = 4;    /**
         * Labels for the drawables that will be loaded into the TileView class
         */
        static final int LTOU_STAR = 1;
        static final int ZBAOZS_STAR = 2;
        static final int LWEI_STAR = 3;
        static final int LSHE_STAR = 4;
        static final int SHAN_STAR = 5;
        static final int YUN_STAR = 6;   /**
         * mScore: used to track the number of zhubaos captuLTOU mMoveDelay: number of
         * milliseconds between ylxz movements. This will decrease as zhubaos are
         * captuLTOU.
         */
        private long mScore = 0;
         /**
         * mLastMove: tracks the absolute time when the ylxz last moved, and is used
         * to determine if a move should be made based on mMoveDelay.
         */
        private long mLastMove;
        private long mMoveDelay=600; 
        /**
         * mStatusText: text shows to the user in some run states
         */
        private TextView mStatusText;
             // mYlxzTrail: a list of Coordinates that make up the ylxz's body
         // mZhubaoList: the secret location of the juicy zhubaos the ylxz craves.
        private ArrayList<Coordinate>mYlxzTrail=new ArrayList<Coordinate>();
        private ArrayList<Coordinate>mZhubaolist=new ArrayList<Coordinate>();
        /**
         * Everyone needs a little randomness in their life
         */
         private static final Random RNG=new Random();
         private RefreshHandler mRedrawHandler=new RefreshHandler();
        
                 class RefreshHandler extends Handler{
                 public void handleMessage(Message msg){
                  YlxzView.this.update();
                  YlxzView.this.invalidate();
                 }
                 public void sleep(long delayMillis){
                 this.removeMessages(0);
                 sendMessageDelayed(obtainMessage(0),delayMillis);
                 }
                  
              }
                 /**
                  * Constructs a YlxzView based on inflation from XML
                  * 
                  * @param context
                  * @param attrs
                  */
            public YlxzView(Context context,AttributeSet attrs){
                super(context,attrs);
                initYlxzView();
                   }
            
            public YlxzView(Context context,AttributeSet attrs,int defStyle){
                super(context,attrs,defStyle);
                initYlxzView();
                   }
                 
                 
    private void initYlxzView() {
    // TODO Auto-generated method stub
    setFocusable(true);
    Resources r=this.getContext().getResources();
    resetTile(6);
    loadTile(LTOU_STAR,r.getDrawable(R.drawable.ltoustar));
    loadTile(LSHE_STAR,r.getDrawable(R.drawable.lshestar));
    loadTile(LWEI_STAR,r.getDrawable(R.drawable.lweistar));
    loadTile(ZBAOZS_STAR,r.getDrawable(R.drawable.zbaozsstar));
    loadTile(SHAN_STAR,r.getDrawable(R.drawable.shanstar));
    loadTile(YUN_STAR,r.getDrawable(R.drawable.yunstar));
     
        }
                void initNewGame(){
                 mYlxzTrail.clear();
                 mZhubaolist.clear();
                 // For now we're just going to load up a short default eastbound ylxz
                    // that's just turned north
                    mYlxzTrail.add(new Coordinate(7,7));
                    mYlxzTrail.add(new Coordinate(6,7));
                    mYlxzTrail.add(new Coordinate(5,7));
                    mYlxzTrail.add(new Coordinate(4,7));
                    mYlxzTrail.add(new Coordinate(3,7));
                    mYlxzTrail.add(new Coordinate(2,7));
                    mNextDirection=NORTH;
                    // one zhubaos to start with ,become to one..
                 addRandomZhubao();
                 mMoveDelay=600;
                 mScore=0;
                    
                }
      

  10.   

    private int[] coordArrayListToArray(ArrayList<Coordinate>cvec){
                     int count=cvec.size();
                     int[]rawArray=new int[count*2];
                     for(int index=0;index<count;index++){
                      Coordinate c=cvec.get(index);
                      rawArray[2*index]=c.x;
                      rawArray[2*index+1]=c.y;
                       }
                     return rawArray;
                }
                public Bundle saveState(){
                    Bundle map=new Bundle();
                    map.putIntArray("mZhubaoList", coordArrayListToArray(mZhubaolist));
                       map.putInt("mDirection", Integer.valueOf(mDirection));
                       map.putInt("mNextDirection", Integer.valueOf(mNextDirection));
                       map.putLong("mMoveDelay", Long.valueOf(mMoveDelay));
                       map.putLong("mScore", Long.valueOf(mScore));
                       map.putIntArray("mYlxzTrail", coordArrayListToArray(mYlxzTrail));                   return map;
                }
                /**
                 * Given a flattened array of ordinate pairs, we reconstitute them into a
                 * ArrayList of Coordinate objects
                 * 
                 * @param rawArray : [x1,y1,x2,y2,...]
                 * @return a ArrayList of Coordinates
                 */
               private ArrayList<Coordinate>coordArrayToArrayList(int[]rawArray){
                    ArrayList<Coordinate>coordArrayList=new ArrayList<Coordinate>();
                    int coordCount=rawArray.length;
                    for(int index=0;index<coordCount;index+=2){
                     Coordinate c=new Coordinate(rawArray[index],rawArray[index+1]);
                     coordArrayList.add(c);
                    }
                    return coordArrayList;
                    }                                     
               /**
                * Restore game state if our process is being relaunched
                * 
                * @param icicle a Bundle containing the game state
                */
                public void restoreState(Bundle icicle){
                 setMode(PAUSE);
                 mZhubaolist=coordArrayToArrayList(icicle.getIntArray("mZhubaoList"));
                 mDirection = icicle.getInt("mDirection");
                    mNextDirection = icicle.getInt("mNextDirection");
                    mMoveDelay = icicle.getLong("mMoveDelay");
                    mScore =  icicle.getLong("mScore");
                    mYlxzTrail = coordArrayToArrayList(icicle.getIntArray("mYlxzTrail"));            }
                /*
                 * handles key events in the game. Update the direction our ylxz is traveling
                 * based on the DPAD. Ignore events that would cause the ylxz to immediately
                 * turn back on itself.
                 * 
                 * (non-Javadoc)
                 * 
                 * @see android.view.View#onKeyDown(int, android.os.KeyEvent)
                 */
                 public boolean onKeyDown(int keyCode,KeyEvent msg){   //包括OK键按下,则提高龙的运行速度200。
                     if(keyCode==KeyEvent.KEYCODE_DPAD_UP){
                      if(mMode==READY|mMode==LOSE){
                      /*
                                 * At the beginning of the game, or the end of a previous one,
                                 * we should start a new game.
                                 */
                            initNewGame();
                            setMode(RUNNING);
                            update();
                            return(true);
                      }
                      if(mMode==PAUSE){
                       /*
                                 * If the game is merely paused, we should just continue where
                                 * we left off.
                                 */
                                 setMode(RUNNING);
                                 update();
                                 return(true);
                        }
                      if(mDirection!=SOUTH){
                      mNextDirection=NORTH;
                      }
                      return(true);
                     }
                     if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
                            if (mDirection != NORTH) {
                                mNextDirection = SOUTH;
                            }
                            return (true);
                        }                    if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
                            if (mDirection != EAST) {
                                mNextDirection = WEST;
                            }
                            return (true);
                        }                    if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
                            if (mDirection != WEST) {
                                mNextDirection = EAST;
                               }
                           return (true);
                        }
                        if(keyCode==KeyEvent.KEYCODE_DPAD_CENTER){
                         mMoveDelay=200;
                            return (true);
                        }
                              
                      return super.onKeyDown(keyCode, msg);
     
                 }
              public boolean onKeyUp(int keyCode,KeyEvent msg){  //为了OK键松开,而恢复龙的运行速度600。
                 if(keyCode==KeyEvent.KEYCODE_DPAD_CENTER){
                 mMoveDelay=600;
                 return true;  
                 }
               return super.onKeyUp(keyCode, msg);


               }
                 
                 void setMode(int newMode) {
    // TODO Auto-generated method stub
     int oldMode=mMode;
     mMode=newMode;
     if(newMode==RUNNING&oldMode!=RUNNING){
     mStatusText.setVisibility(View.INVISIBLE);
     update();
     return;
     
     }
     Resources res=getContext().getResources();
     CharSequence str="";
     if(newMode==PAUSE){
     str=res.getText(R.string.mode_pause);
     }
     if (newMode == READY) {
                str = res.getText(R.string.mode_ready);
            }
            if (newMode == LOSE) {
                str = res.getString(R.string.mode_lose_prefix) + mScore
                      + res.getString(R.string.mode_lose_suffix);
            }         mStatusText.setText(str);
            mStatusText.setVisibility(View.VISIBLE); }
    /**
         * Sets the TextView that will be used to give information (such as "Game
         * Over" to the user.
         * 
         * @param newView
         */
                 public void setTextView(TextView newView){
                     mStatusText=newView;
                 }
                 /**
                  * Updates the current mode of the application (RUNNING or PAUSED or the like)
                  * as well as sets the visibility of textview for notification
                  * 
                  * @param newMode
                  */
                
    private void addRandomZhubao() {
    // TODO Auto-generated method stub
    Coordinate newCoord = null;
            boolean found = false;
            while (!found) {
                // Choose a new location for our zhubao
                int newX = 1 + RNG.nextInt(mXTileCount - 2);
                int newY = 1 + RNG.nextInt(mYTileCount - 2);
                newCoord = new Coordinate(newX, newY);             // Make sure it's not already under the ylxz
                boolean collision = false;
                int ylxzlength = mYlxzTrail.size();
                for (int index = 0; index < ylxzlength; index++) {
                    if (mYlxzTrail.get(index).equals(newCoord)) {
                        collision = true;
                    }
                }
                // if we're here and there's been no collision, then we have
                // a good location for an zhubao. Otherwise, we'll circle back
                // and try again
                found = !collision;
            }
            if (newCoord == null) {
                Log.e(TAG, "Somehow ended up with a null newCoord!");
            }
            mZhubaolist.add(newCoord); } public void update() {
    // TODO Auto-generated method stub
     if (mMode == RUNNING) {
                long now = System.currentTimeMillis();             if (now - mLastMove > mMoveDelay) {
                    clearTiles();
                    updateWalls();
                    updateYlxz();
                    updateZhubaos();
                    mLastMove = now;
                }
                mRedrawHandler.sleep(mMoveDelay);
            }   }
     /**
         * Draws some walls.
         * 
         */
            private void updateWalls(){
             for (int x = 0; x < mXTileCount; x++) {
                    setTile(YUN_STAR, x, 0);
                    setTile(YUN_STAR, x, mYTileCount - 1);
                }
                for (int y = 1; y < mYTileCount - 1; y++) {
                    setTile(SHAN_STAR, 0, y);
                    setTile(YUN_STAR, mXTileCount - 1, y);
                }        }

            /**
             * Draws some zhubaos.
             * 
             */
           private void updateZhubaos(){
            for (Coordinate c : mZhubaolist) {
                   setTile(ZBAOZS_STAR, c.x, c.y);
               }        }
           /**
            * Figure out which way the ylxz is going, see if he's run into anything (the
            * walls, himself, or an zhubao). If he's not going to die, we then add to the
            * front and subtract from the rear in order to simulate motion. If we want to
            * grow him, we don't subtract from the rear.
            * 
            */
      

  11.   

     private void updateYlxz(){
           boolean growYlxz = false;          // grab the ylxz by the head
              Coordinate head = mYlxzTrail.get(0);
              Coordinate newHead = new Coordinate(1, 1);          mDirection = mNextDirection;          switch (mDirection) {
              case EAST: {
                  newHead = new Coordinate(head.x + 1, head.y);
                  break;
              }
              case WEST: {
                  newHead = new Coordinate(head.x - 1, head.y);
                  break;
              }
              case NORTH: {
                  newHead = new Coordinate(head.x, head.y - 1);
                  break;
              }
              case SOUTH: {
                  newHead = new Coordinate(head.x, head.y + 1);
                  break;
              }
              }          // Collision detection左撞墙会死;其他方向撞墙不会死亡了,只会向右转。
              // For now we have a 1-square wall around the entire arena
              if ((newHead.x < 1) || (newHead.y < 1) || (newHead.x > mXTileCount - 2)
                      || (newHead.y > mYTileCount - 2)) {
               if ((newHead.x < 1) ){
                  setMode(LOSE);
                     return;
                    }
                if (newHead.y < 1){
                     mDirection=WEST;
                     return;
                   }
                if (newHead.x > mXTileCount - 2){
                    mDirection=EAST;
                    return;
                   }
                 
                if (newHead.y > mYTileCount - 2) {
                     mDirection=SOUTH;
                     return;
                   }
                  return;          }          // Look for collisions with itself
                int ylxzlength=mYlxzTrail.size();
                for(int ylxzindex=0;ylxzindex<ylxzlength;ylxzindex++){
                   Coordinate c=mYlxzTrail.get(ylxzindex);
                   if(c.equals(newHead)){
                    setMode(LOSE);
                    return;
                     }
                   }
              // Look for zhubaos
              int zhubaocount = mZhubaolist.size();
              for (int zhubaoindex = 0; zhubaoindex < zhubaocount; zhubaoindex++) {
                  Coordinate c = mZhubaolist.get(zhubaoindex);
                  if (c.equals(newHead)) {
                      mZhubaolist.remove(c);
                      addRandomZhubao();
                      mScore++;
                      }
              }          // push a new head onto the ArrayList and pull off the tail
              mYlxzTrail.add(0, newHead);
              // except if we want the ylxz to grow
              if (!growYlxz) {
                  mYlxzTrail.remove(mYlxzTrail.size() - 1);
              }
             
              for(Coordinate c : mYlxzTrail){    //分龙头,龙身,龙尾。
                  for(int index=0;index<=6;index++)
                   switch(index){
                   case 0: 
                     setTile(LTOU_STAR, c.x, c.y);
                   case 1:
                     setTile(LSHE_STAR, c.x, c.y);
                   case 2:
                    setTile(LSHE_STAR, c.x, c.y);
                   case 3:
                    setTile(LSHE_STAR, c.x, c.y);
                   case 4:
                    setTile(LSHE_STAR, c.x, c.y);
                   case 5:
                    setTile(LSHE_STAR, c.x, c.y);
                   case 6:
                    setTile(LWEI_STAR, c.x, c.y);
                         }
                 
                    }
                  }
          /**
           * Simple class containing two integer values and a comparison function.
           * There's probably something I should use instead, but this was quick and
           * easy to build.
           * 
           */
          private class Coordinate{
           public int x;
              public int y;          public Coordinate(int newX, int newY) {
                  x = newX;
                  y = newY;
              }          public boolean equals(Coordinate other) {
                  if (x == other.x && y == other.y) {
                      return true;
                  }
                  return false;
              }          @Override
              public String toString() {
                  return "Coordinate: [" + x + "," + y + "]";
              }       }
           
           
        }
      

  12.   

    有那位高手,有空教教我。远程指点。我的QQ:448537528。报CSDN即可。