Update OpenTok SDK in Android Application
I have a currently running Android application which uses OpenTok SDK version 2.8. that is 'opentok-android-sdk-2.5.0.jar'
.
Due to some known issue, i have to update it to the latest version of OpenTok that is opentok-android-sdk-2.8.1
.
In the previous version of the OpenTok SDK, there used to be one *.jar
file and two *.so
files. However, in this version the *.jar
and *.so
files have been replaced by a single *.aar
file.
What i tried: I removed both *.so
files fron JNILibs
directory and the *.jar
file from the libs
directory of the project structure. Further i removed the below line from gradle.build of apps:
compile files('libs/opentok-android-sdk-2.5.0.jar')
As specified in the below link, under the read me section:
https://github.com/opentok/opentok-android-sdk-samples
I added the below two lines in my gradle.build under app in th respective positions: That is, under 'repositories' i added:
maven { url "http://tokbox.bintray.com/maven" }
And then under 'dependencies' i added:
compile 'com.opentok.android:opentok-android-sdk:2.8.+'
And then when i Sync
my project, i get the below error:
Error:(61, 13) Failed to resolve: com.opentok.android:opentok-android-sdk:2.8.+
Show in File
Show in Project Structure dialog
Further i also tried:
How to manually include external aar package using new Gradle Android Build System
But i was still getting errors like only jar files can be added like that.
I also tried: https://www.youtube.com/watch?v=dpuJPoXkFG4
If anyone has upgraded from any *.jar
library to *.aar
library, kindly specify the procedure here or send me a reference for the same. Thanks in advance.
I'm building an ionic app using the https://github.com/songz/cordova-plugin-opentok
I managed to upgrade the android sdk to 2.8.1 by creating the following build-extras.gradle
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "http://tokbox.bintray.com/maven"
}
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 8
versionName "2.7.0"
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.opentok.android:opentok-android-sdk:2.8.1+'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.0.0'
}
This might help you out. in my plugin.xml I also added this line in my android platform section
<framework src="build-extras.gradle" custom="true" type="gradleReference" />
as suggested by https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#extending-buildgradle
However this didn't seem to copy the file correctly, so I had to manually place build-extras.gradle in my ./platforms/android directly (same directory as my build.gradle)
Hope this helps.
链接地址: http://www.djcxy.com/p/66144.html