-2
它看起来好像在最新版本的Android中,来自Apache包的EncodingUtils已被弃用。我们在我们现在需要升级的代码中大量呼叫EncodingUtils.getBytes(postData, "base64")
。有什么方法可以用更现代的方式达到目的?EncodingUtils在最近版本的Android中不再可用
它看起来好像在最新版本的Android中,来自Apache包的EncodingUtils已被弃用。我们在我们现在需要升级的代码中大量呼叫EncodingUtils.getBytes(postData, "base64")
。有什么方法可以用更现代的方式达到目的?EncodingUtils在最近版本的Android中不再可用
如果你只想使用EncodingUtils
您可以添加传统的依赖于Apache
android {
useLibrary 'org.apache.http.legacy'
}
看一看Base64.encodeToString():https://developer.android.com/reference/android/util /Base64.html#encodeToString(byte [],int) –