Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将一个 Android 应用程序下载到路径:/mnt/sdcard/download/App.apk使用DownloadManager类。如果 App.apk 已经存在,则下载失败。如何替换现有的apk?
/mnt/sdcard/download/App.apk
DownloadManager
DownloadManager不会让你这样做。您应该先删除或重命名现有文件。
File f = new File("/mnt/sdcard/download/App.apk"); if (f.exists()) { f.delete(); // or f.renameTo(...); }