我正在尝试按照以下步骤编译应用->
https://github.com/wlvpn/ConsumerVPN-Android/blob/master/VPN%20SDK%20-%20documentation/SETUP.md
但是,当我在应用程序文件中复制该代码时,在显示“库初始化”的最后一步中,“ SdkConfig”说不能那样调用。我使用的是Kotlin方法。
在Application.kt:
import com.gentlebreeze.vpn.sdk.IVpnSdk
import com.gentlebreeze.vpn.sdk.VpnSdk
import com.gentlebreeze.vpn.sdk.config.SdkConfig
override fun onCreate() {
super.onCreate()
vpnSdk = VpnSdk.init(this, SdkConfig(
BuildConfig.ACCOUNT_NAME,
BuildConfig.API_KEY,
BuildConfig.AUTH_SUFFIX,
BuildConfig.CLIENT,
BuildConfig.BASE_HOSTNAME,
BuildConfig.IP_GEO,
BuildConfig.LOGIN_API,
BuildConfig.REFRESH_API,
BuildConfig.PROTOCOL_LIST_API,
BuildConfig.SERVER_LIST_API
))
}
companion object {
var vpnSdk: IVpnSdk? = null
}
}
在build.gradle:
android {
compileSdkVersion 28
defaultConfig {
buildConfigField 'String', 'ACCOUNT_NAME', '"xxxxx"'
buildConfigField 'String', 'AUTH_SUFFIX', '"xxxxx"'
buildConfigField 'String', 'API_KEY', '"xxxxxx"'
buildConfigField 'String', 'CLIENT', "\"Android-${versionName}b${versionCode}\""
buildConfigField 'String', 'BASE_HOSTNAME', '"https://api.colomovers.com/wlapi/%s"'
buildConfigField 'String', 'PROTOCOL_LIST_API', '"protocols"'
buildConfigField 'String', 'LOGIN_API', '"login"'
buildConfigField 'String', 'REFRESH_API', '"refresh"'
buildConfigField 'String', 'SERVER_LIST_API', '"servers"'
buildConfigField 'String', 'IP_GEO', '"https://ipgeo.wlvpn.com/v2?apikey=xxxxxx"'
}
def versions = [
os : [
support : "1.0.0",
lifecycle : "2.0.0",
constraintLayout: "1.1.3",
material : "1.1.0-alpha05",
appCompat : "1.1.0-alpha04"
],
rxJava : "2.2.5",
rxAndroid : "2.1.1",
rxKotlin : "2.3.0",
rxBinding : "3.0.0-alpha2",
gson : "2.8.5",
dagger : "2.21",
retrofit : "2.5.0",
leakCanary : "1.6.3",
fresco : "1.13.0",
vpnSdk : "1.5.3.39705@aar",
nativeEncrypt: "1.0.036399@aar",
timber : "4.7.1",
autoValue : "1.6.2",
loganSquare : "1.3.7",
evernoteJobs : "1.2.6",
test : [
junit : "4.12",
mockito: "2.24.0"
]
]
dependencies{
implementation("com.gentlebreeze.vpn.sdk:sdk:$versions.vpnSdk") {
transitive = true
}
出现的错误:
它是唯一缺少尝试编译的步骤。正如链接所描述的那样,添加了所有其他步骤。
感谢您的帮助。