Search code examples
androidapache-commons

error: cannot find symbol class StringJoiner in android


I am getting the below error when I use this gradle dependency:

 compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'

is any way to fix this or it is incompatible with android. Is any others ways to use StringJoiner?

error: cannot find symbol class StringJoiner
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

The error created when I build the project.


Solution

  • Make sure that your target version is 24. StringJoiner was introduced starting API 24.

    If you support <= API 24, consider using StringBuilder.

    To know the difference, please refer here.