我正在使用 Apache Commons-net-3.3 jar 并研究了以前的线程以确保它在构建路径中正确配置。
我的 Android 应用程序在多台平板电脑上的调试模式下运行良好,但是当我使用 Ant 发布代码并发布它时,代码在以下位置发生故障:-
FTPClient ftpClient = new FTPClient();
在相同的平板电脑上没有错误消息:
代码如下。
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
@Override
protected String doInBackground(Void... params) {
File file = new File(mDBPath);
try{
FTPClient ftpClient = new FTPClient();
InetAddress mHostName;
mHostName = InetAddress.getByName(mServerIP);
ftpClient.connect(mHostName, mPort);
ftpClient.login(mLogin, mPassword);
ftpClient.changeWorkingDirectory(mWorkingDir);
if (ftpClient.getReplyString().contains("250")) {
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
BufferedOutputStream buffOut = new BufferedOutputStream(new FileOutputStream(new File(file, mDBName)));
ftpClient.enterLocalPassiveMode();
boolean result = ftpClient.retrieveFile(mServerFileName, buffOut);
buffOut.close();
ftpClient.logout();
ftpClient.disconnect();
if (result == false){
return "False";
}
}
} catch (Exception e){
return e.getMessage().toString();
}
return "True";
}
我的问题是:-我不明白为什么它在同一台平板电脑上以调试模式工作?