Closed Nevaehy closed 3 years ago
The code is:
private fun initHydraSdk() {
val notificationConfig = NotificationConfig.newBuilder()
.disabled()
.build()
UnifiedSDK.update(notificationConfig) <-- Error occurs there
val clientInfo = ClientInfo.newBuilder()
.baseUrl(resources.getString(R.string.host_url_key))
.carrierId(resources.getString(R.string.carrier_id_key))
.build()
val transportConfigList: MutableList<TransportConfig> = ArrayList()
transportConfigList.add(HydraTransportConfig.create())
transportConfigList.add(OpenVpnTransportConfig.tcp())
transportConfigList.add(OpenVpnTransportConfig.udp())
UnifiedSDK.update(transportConfigList, CompletableCallback.EMPTY)
val config = UnifiedSDKConfig.newBuilder().idfaEnabled(false).build()
UnifiedSDK.getInstance(clientInfo, config)
UnifiedSDK.setLoggingLevel(Log.VERBOSE)
UnifiedSDK.addVpnStateListener(this)
}
Any ideas what could be the source of the problem?
no idea, method is there. Maybe its due to kotlin issue to call static methods on java interfaces. Try to add kotlinOptions { jvmTarget = '1.8' }
no idea, method is there. Maybe its due to kotlin issue to call static methods on java interfaces. Try to add kotlinOptions { jvmTarget = '1.8' }
This code is already present. On other devices and APIs everything works as intended.
we've checked the sdk on devices with api levels you've mentioned. no issue exits. Maybe you have some custom proguard settings?
we've checked the sdk on devices with api levels you've mentioned. no issue exits. Maybe you have some custom proguard settings?
Proguard is empty. Also I tried settings that you specified in Readme. Had the same outcome.
from where do you have this stacktrace? just in logs? or in some crash logging system like firebase?
Just in logs when I'm trying to launch app on AVD in Android Studio
ah, you can just skip it. it's just system logs, it still should work
No, it doesn't. App crashes.
@timoshenkoav could you please reopen issue?
At first, I've created an app that uses your SDK. Everything worked fine. Then, I've created a module (.aar) from this app and implemented it in absolutely clean, new project. And in this new project I've got this error on specified above devices.
just tried the app from this repo on AVD 22 - no crashes. Please check your app settings - dont think its sdk issue
if you made a lib check if you have runtime dependencies specified
if you made a lib check if you have runtime dependencies specified
other APIs work fine, then all lib dependencies are fine too?
UnifiedSDK.update(notificationConfig) is the first api you call. what api do you call before?
try to build and run the app from this repo on the same device/avd
UnifiedSDK.update(notificationConfig) is the first api you call. what api do you call before?
Nothing. I've tried .init() and others, but any api call results in crash and the same stacktrace error
so i suggest its dependency error. how do you specify the sdk dependency in aar library module? as 'implementation'? try the 'api'
so i suggest its dependency error. how do you specify the sdk dependency in aar library module? as 'implementation'? try the 'api'
implementation 'com.github.AnchorFreePartner.hydra-sdk-android:sdk:3.3.3'
implementation 'com.github.AnchorFreePartner.hydra-sdk-android:openvpn:3.3.3'
try to change implementation to api
try to change implementation to api
Just tried. Nothing has changed :(
hard to tell, try to build the app from this repo and run on the same avd/device - it should work
Yep, I also tried it. It worked as a separate app, but not as an implemented module.
so you implemented it wrong
can you share your complete project sources that reproduce the issue?
may I send link to repo via email?
sure - a.timoshenko@anchorfree.com
sure - a.timoshenko@anchorfree.com
Great, thanks! Just sent you a message.
Do you have a requirement to make it as aar? Why not just do a library module in app module and add it as dependency
yep, it's a requirement
ok, move vpn.aar to app/libs folder
and add
implementation fileTree(dir: 'libs', include: ['*.aar'])
to app build.gradle
Now I cannot go to VPNMainActivity because it's as unresolved reference now
you did something wrong
i'm sending working project to you
Should I keep this?
I removed both and now it's unresolved reference for VPNMainActivity.. :)
check your email
It works now, thank you!
But may I know the reason? Why didn't implementation project() work?
not sure, maybe its something with classloader
@timoshenkoav I am getting this error when build aar file and use it. What is the solution?
Got this error on some real devices (API 24, 28, 30) and some AVD (API 22, 19)
java.lang.NoSuchMethodError: No static method update(Lcom/anchorfree/sdk/NotificationConfig;)V in class Lcom/anchorfree/sdk/UnifiedSDK; or its super classes (declaration of 'com.anchorfree.sdk.UnifiedSDK' appears in /data/app/com.blazing.fast.vpn-1/base.apk)