Environment.getExternalStorageDirectory()获得的路径后面要加一个"/",再加文件名。
估计是你组装的全路径里少了一个"/"分隔符。

解决方案 »

  1.   

    SDpath = Environment.getExternalStorageDirectory().getAbsolutePath().toString()+"/";
    String targetPath = SDpath + "hello.txt";
    public static void deleteFile(String targetPath) throws IOException { 
              File targetFile = new File(targetPath); 
              if(targetFile.exists()){
               targetFile.delete();
              }
    }
    大概就是上面这样的。
      

  2.   

    找到问题了 自己犯傻了  忘记加入<uses-permission>读写SD卡的权限了