Reputation: 1
I need help with this, the problem is that the project i'm working needs a custom tile map provider for maps, the project usually takes no longer than 30 seconds to build, with online gradle and all that.
The problems begin when I add the images with the custom tiles to the assets folder, the build times can take up to 3 hrs. or as little as 10 minutes then I get this error.
java.lang.OutOfMemoryError: GC overhead limit exceeded
I've found that with this setting added to the gradle settings the error should go away, but it doesn't work.
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
I've been thinkering with this option and increasing it to even 8g but it does nothing.
When i try to build the app the cpu goes to 100% and 7.9Gb out of 8Gb ussage until the build crashes and I get the previous error.
the app needs to work offline so i cant download the tiles and the size of the app isnt important as it wont be released through any app store, and will be installed directly by us to some devices.
The tiles folder is about 250Mb in size and has about 30000 files, 7000 files but I keep having the same results.
Is it because of the files size, ammount of files?, maybe both?
Any help will be appreciated, I'm "new" to android development, I leanrt some basics in 2011, but hadn't done or learnt anything until about 4 months ago, so I'm kinda lost.
Also sorry if there is something misspelled or is worded in a weird way, I'm not a native english speaker.
Edit:
Extra details as Morrishon Chang asked
OS: window 10
Memmory: 8Gb
JDK: 1.8.0_144
average tile image size: 13kb
image tile format: png
image tiles ammount: about 32000 images
Upvotes: 0
Views: 129
Reputation: 76
First, I would recommend to use Android Drawable Importer plugin. You can access it from Android Studio -> Preferences -> Plugins, I usually import assets using that plugin and everything works fine.
Second, I would suggest you to use image processing library, such as Glide, which is really powerful in my opinion.
Third, try to optimize the loading of your tile, maybe use RecyclerView?
Good luck!
Upvotes: 1