SORU
13 Ocak 2012, Cuma


'açık, başarısız bir özel durum:' EACCES (İzin verilmedi) Android

Alıyorum

açma başarısız oldu: EACCES (Permission denied)

satırında OutputStream myOutput = new FileOutputStream(outFileName);

Kök kontrol ettim, ve android.permission.WRITE_EXTERNAL_STORAGE çalıştım.

Bu sorunu nasıl düzeltebilirim?

try {
    InputStream myInput;

    myInput = getAssets().open("XXX.db");

    // Path to the just created empty db
    String outFileName = "/data/data/XX/databases/"
              "XXX.db";

    // Open the empty db as the output stream
    OutputStream myOutput = new FileOutputStream(outFileName);

    // Transfer bytes from the inputfile to the outputfile
    byte[] buffer = new byte[1024];
    int length;
    while ((length = myInput.read(buffer)) > 0) {
        myOutput.write(buffer, 0, length);
    }

    // Close the streams
    myOutput.flush();
    myOutput.close();
    myInput.close();
    buffer = null;
    outFileName = null;
}
catch (IOException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

CEVAP
28 Mart 2012, ÇARŞAMBA


Aynı sorun... <uses-permission yanlış yerde idi. Bu doğru

    <application>
        ...

    </application>

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest> 

uses-permission etiketi application etiketi dışında olması gerekir.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • jbignacio

    jbignacio

    13 Mart 2006
  • Orson Wang

    Orson Wang

    28 EKİM 2006
  • Tomas N

    Tomas N

    14 Kasım 2010