Qian Sijianhao Qian Sijianhao - 1 year ago 70
Android Question

Resource file in assets can not be found

I was developing a map based app and used a library named AMap.jar to initialize map. The library contains a file named

which will be placed in the assets folder during runtime. Mostly, my app went well. But occasionally,
just can't be found and result in an FileNotFoundException.

Plus, once the situation comes up, it can't be fixed even though I reinstall the app through Android Studio.

How can I fix this?

I have a suspicion that this have something to do with Instant Run of Android Studio.

Has anyone ever had similar situations?

Answer Source

First make your sure code is bug-free.

Second, observer behavior like as you said when your app runs successfully it should be keep on running without any problem until next build or till you go out of your app, if not then it means there is a problem in your code.

If your app keep on running without any problem util restart or till next build it mean you are suffering from instant-run bug and they are like

  • Inside Run TAB next to anroid-monitor, sometimes it shows, no changes to deploy mean changes in code has not added to your app
  • Sometimes it runs the new app and when you restart your app it shows the old one.

Solution :

Update to latest Build because this tends to happen more in older releases.

Disable instant run under your project settings.

Try to use the latest studio release which has totally improved instant-run .

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download