Error:(30, 17) error: code too large solutions?

I am making a simple database of medical components. I made a simple ListView in android studio that contains names of drugs approximately 9000 names. Names are located in an array(string[]) so I can search inside them but when I compile it, it says:

Error:(30, 17) error: code too large    
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details. 
Error:Execution failed for task ':app:compileDebugJava'.
Compilation failed; see the compiler error output for details.  

Is there a solution for this problem?

Jon Skeet
people
quotationmark

Yes - don't put large amounts of data in source code, basically. Just include a text file with all the names, and load that at execution time instead. (In normal Java I'd use Class.getResourceAsStream; in Android you should probably be using the Android resource mechanisms, and you should consider localization too.)

That will also make it a lot easier to read and edit the data.

people

See more on this question at Stackoverflow