2011-09-13 15 views
1

Androidでアプリケーションを作成し、このアプリケーションはアクティビティをファイルに記録します。ファイルをエクスポートして.zipファイルを保存するオプションがあります。 .zipに追加するファイルが2つ以上ある場合、次のエラーが表示されます。Android 2.3一般的なフラグに関するZIPの問題

(汎用フラグ - ローカル:808 16進中央:8hex)。 ローカルおよび中央のGPフラグ値が一致しません。

これは、Android 2.3およびwinzipまたは7zipを使用している場合にのみ発生します。私はWindowsエクスプローラまたはWinrarを使用してこの問題を回避することができますが、私は問題を解決し、回避したくありません。

Android 2.2デバイスで同じアプリケーションを使用することはありません。

私は周りを検索し、暗号化に関するいくつかのコメントを見つけましたが、何も暗号化していません。私はまた、特定のライブラリなどの更新に関するいくつかのコメントを発見しましたが、私はAndroid SDK 11とJava JDK 1.6.0_25を使用しています。

は、私は同じ結果

int count = log_.getLogFileList(files_); 
if (count > 0) 
{      
String inFileName; 
File inFile; 
String phoneNumLast =OsmoService.getAccountString(OsmoService.context).substring(6); 
long date = files_.get(count - 1).lastModified(); 
SimpleDateFormat formatter = new SimpleDateFormat("MMddHHmmss");      
String outdt = new String(formatter.format(new Date(date))); 
String outFileName = new String("Dir Name" + "//" + "PREFIX" + "_" + outdt + ZIP_SUFFIX); 

File outFile = new File(outFileName);     
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outFile)); 
BufferedOutputStream outBS = new BufferedOutputStream(zos, 8192); 

for (int idx = (count - 1); (idx >= 0) && !isCancelled(); idx--) 
{ 
inFile = files_.get(idx); 
BufferedReader inBR = new BufferedReader(new FileReader(inFile), 8192);      
inFileName = inFile.getName(); 
Log.v(LOG_TAG, "MailLogFiles - Zipping " + inFileName); 

zos.putNextEntry(new ZipEntry(inFileName)); 
int zix; 
while ((zix = inBR.read()) != -1) 
outBS.write(zix); 
outBS.flush();  
zos.closeEntry();  
inBR.close(); 
} 
outBS.close(); 

で2つの異なるコードを試してみましたが、この

public static void compressFileList(String[] inFiles, String outFile) 
throws IOException 
{ 
ZipOutputStream zos = new ZipOutputStream(
new BufferedOutputStream(new FileOutputStream(outFile))); 
byte data[] = new byte[2048]; 

    for (int i = 0; i < inFiles.length; i++) 
    { 
    BufferedInputStream in = new BufferedInputStream(new FileInputStream(inFiles[i])); 
    zos.putNextEntry(new ZipEntry(inFiles[i])); 
    int count; 
    while((count = in.read(data, 0, data.length)) != -1) 
     zos.write(data, 0, count); 
    zos.closeEntry(); 
    in.close(); 
    } 
    zos.close(); 
} 

答えて

関連する問題