Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!