(威尼斯人线上娱乐官网) java的base64在安卓解码不了,怎么回事
威尼斯人娱乐城
威尼斯人娱乐城
当前位置 : 威尼斯人娱乐城 > 威尼斯人线上娱乐官网

(威尼斯人线上娱乐官网) java的base64在安卓解码不了,怎么回事

在那些解码网站上是解码出来的,但是在安卓解不出来,不知道为什么??

求熟悉的帮破一下,这个东西搞了一个多少时....搞不懂,都同样的代码,怎么就不行呢?

提示错误:是不是在java有什么特殊情况解码呢?这乱码在网站都是可以解出来

java.lang.IllegalArgumentException: bad base-64

package china.testfour;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;

public class MainActivity extends AppCompatActivity {

    String context = "WzAwOjAxLjQ2XeS9nOivjTrpu4TlrrbpqbkNClswMDowMi41MV3kvZzmm7I66buE5a626am5DQpbMDA6MzYuODVd5LuN5piv6Zuo5aScDQpbMDA6MzguODZd5Yed5pyb56qX5aSW5rKJ6buY55qE5aSp6ZmFDQpbMDA6NDMuMjZd6Zeu6IuN5aSp5Y+v5Lya55+l5b+D6YeM55qE5oSf6KeJDQpbMDA6NTIuOTZd6ZqP552A5bKB5pyIDQpbMDA6NTQuNjdd5peg5bC954ix5b+16JeP5Zyo5LqO5b+D6YeMDQpbMDA6NTkuMDNd6LGh5Yaw5bCB55qE55y85YWJ5aSx5Y675LqG5pa55ZCRDQpbMDE6MDguNDRd6K6p6Zuo54K56L276L2755qE5rSS6L+HDQpbMDE6MTEuOTdd5by65oqK5b+n6YOB5YaN5o6p55uWDQpbMDE6MTUuMzFd5YOP56KO5pif6Zeq6Zeq5LqO5aSp56m65Y+r5ZSk5L2gDQpbMDE6MjYuNzBd6YGl5pyb55u85pybDQpbMDE6MjguMjBd6IO95YOP5riF6aOO6Zmq5Ly05aW56aOY5Y67DQpbMDE6MzIuNjNd6K6p5a2k5Y2V55qE6IeC5byv5LiA5YaN5oqx57Sn5L2gDQpbMDE6NDIuNDNd5Zue5pyb5b6A5pel5aaC6Zu+5Ly85qKmDQp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6MTQuMDZd5Lmf5Lya5ZCs5Yiw5L2g5ZG85ZSkDQpbMDQ6MTcuNjJd5pyf5b6F5oiR6L+Z5LiA55Sf5YaN5Lya5L2gDQpbMDQ6MjguMjFd5LuN5piv6Zuo5aScDQpbMDQ6MjkuOTZd5Yed5pyb56qX5aSW5rKJ6buY55qE5aSp6ZmFDQpbMDQ6MzQuMzNd6Zeu6IuN5aSp5Y+v5Lya55+l5b+D6YeM55qE5oSf6KeJDQpbMDQ6NDcuODJd6ZqP552A5bKB5pyIDQpbMDQ6NDkuMzdd5peg5bC954ix5b+16JeP5Zyo5LqO5b+D6YeMDQpbMDQ6NTMuNjNd6LGh5Yaw5bCB55qE55y85YWJ5aSx5Y675LqG5pa55ZCRDQo=";


    @Override
    protected void onCreateBundle savedInstanceState {
        super.onCreatesavedInstanceState;
        setContentViewR.layout.activity_main;

        byte[] result = Base64.decodecontext.toString, Base64.DEFAULT;

        String ss = new Stringresult;
        Log.d"ddd", ss;
    }
}

Android端:
编码:

String oneBaseEncoder = Base64.encodemsg.getBytes;

解码:

String oneBaseDecoder = new StringBase64.decodemsg;

JAVA WEB端:
编码:

String oneBaseEncoder = new BASE64Encoder.encodejsonString.getBytes"utf-8";

解码:

String oneBaseDecoder = new Stringnew BASE64Decoder.decodeBufferjsonString;

Base64.decode的flags的参数不对:

 byte[] result = Base64.decodecontext.toString, Base64.NO_PADDING;

真解不了,log一点内容也没有.....有谁能帮帮吗?

你删掉等号。或者加上一个等号
好像android这里解码 要么不要等号 要么两个等号 ,我换了 no PADDING 不行

该答案已被忽略,原因:

广告位

威尼斯人娱乐城