0

I have a kotlin file with a function that returns a list of strings with 10,000 elements, but when compiling it generates an error, saying that the .class file is too large. What I can do?

 return listOf( "string 1", "string 2", ... "string 10,000" )

each string is between 5 and 20 characters or so. The file has nothing but the function

error

 java.lang.RuntimeException: Error generating class file path/../LiveLiterals$FileName.cass (compile from [path..]) class to large
chrrissoft
  • 149
  • 1
  • 10
  • 3
    Source code really isn't the best place to put a list of 10K items. That should probably be a file or a database. – Gabe Sechan May 14 '22 at 04:00
  • A simple text list should be saved as asset into your app. You can then load and return it if needed. – Robert May 14 '22 at 13:23

0 Answers0