从Firebase获取文件的代码:
for (int i = 1; i < 10000; i++) {
StorageReference ref = storageRef.child("FirstTimeForms/" + i + ".pdf");
File localFile = File.createTempFile("Form", ".pdf");
FileDownloadTask dm = ref.getFile(localFile);
int fileSize = Integer.parseInt(String.valueOf(localFile.length()/1024));
if(fileSize > 0){
fileManager.copyFile(localFile, new File("/sdcard/Download/Forms/" + i + ".pdf"));
}else{
return;
}
}
将从缓存下载的文件复制到SD的代码
FileChannel inChannel = new FileInputStream(src).getChannel(); FileChannel outChannel = new FileOutputStream(dst).getChannel(); try { inChannel.transferTo(0, inChannel.size(), outChannel); } finally { if (inChannel != null) inChannel.close(); if (outChannel != null) outChannel.close(); }
我正在尝试将所有文件下载到名为1.pdf,2.pdf的Firebase存储目录中。该代码在调试模式下有效,但是在发行版中无效。我整天都被困住了。我认为是...
-keep class com.firebase.** { *; }
-keepattributes *Annotation*
-keepattributes Signature
-keep class YOUR_PACKAGE_NAME.YourActivity { *; }