I'm developing video conference app, so i need to create a independent rooms for users for conference. so i'm using opentok (tokbox) sdk for android. below are my gradle compile files for opentok :
compile 'com.opentok.android:opentok-android-sdk:2.12.0'
compile 'com.tokbox:opentok-server-sdk:2.3.2'
Now i am genereate session id and token id with the help of opentok server sdk (java). this is the code for generating session id and token id.
//java code
OpenTok openTok = new OpenTok(Integer.parseInt(OpenTokConfig.API_KEY), OpenTokConfig.SECRET_KEY);
try {
SessionProperties sessionProperties = new SessionProperties.Builder().mediaMode(MediaMode.ROUTED).build();
Session session = openTok.createSession(sessionProperties);
sessionId = session.getSessionId();
//successfully we got the session id here
tokenId = openTok.generateToken(sessionId); //app crashed here
} catch (OpenTokException e) {
e.printStackTrace();
}
After debugging this code, we got the session id successfully, but i have facing the problem in generating tokenid.App is crashed suddenly at this point, it returns
`Caused by: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.decodeBase64
at com.opentok.util.Crypto.decodeSessionId(Crypto.java:47)
at com.opentok.OpenTok.generateToken(OpenTok.java:131)
at com.opentok.OpenTok.generateToken(OpenTok.java:181)`
I had going in depth debugging into opentok sdk the app crashed in this method
//class name is : Crypto
public static List<String> decodeSessionId(String sessionId) throws UnsupportedEncodingException {
sessionId = sessionId.substring(2);
sessionId = sessionId.replaceAll("-", "+").replaceAll("_", "/");
byte[] buffer = Base64.decodeBase64(sessionId); //app crashed in this line
sessionId = new String(buffer, "UTF-8");
return new ArrayList<String>(Arrays.asList(sessionId.split("~")));
}
I know the problem is related to decode issue.I had searched about this issue in so many places, but i had not getting any related answers about this issue.Opentok team simply says upgrade your sdk's. Please give the right direction.