android Base64.decode 报错

android 解码 Base64 图片数据时报错

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAkACQAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAK2AyADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8

Base64.decode(data, Base64.DEFAULT)

java.lang.IllegalArgumentException: bad base-64

经过测试把开头的 data:image/jpeg;base64, 去掉就好了

你可能感兴趣的:(android Base64.decode 报错)