error: cannot find symbol class StringJoiner in android

error: cannot find symbol class StringJoiner in android

当我使用此 gradle 依赖项时出现以下错误:

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

有什么方法可以解决这个问题,或者它与 android 不兼容。还有其他使用 StringJoiner 的方法吗?

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

构建项目时出现的错误

确保您的目标版本是 24。StringJoiner 是从 API 24.

开始引入的

如果您支持<= API 24,请考虑使用StringBuilder

区别请参考here