Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
No such file or directory for zip file - kotlin android

I am trying to read zip from zip file programitically.

 val f = File("src/main/files/zipfile.zip")
 val zis = ZipInputStream(FileInputStream(f))

but i got error.

Caused by: java.io.FileNotFoundException: src/main/files/zipfile.zip (No such file or directory)

Why it doesn't see this file if it is on this path?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It's not on this path in your compiled app. That's not a valid asset directory, and the files there will not be in your compiled app.

If you want to include a raw file in your app, put it in src/main/assets. And to read it, you need to get it via context.assets

For example, in a Fragment:

val zipFileStream = requireContext().assets.open("zipfile.zip")
val zis = ZipInputStream(zipFileStream)

although you most likely should be reading files in a ViewModel so the contents can persist through a screen rotation.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda