Greetings,
I have been trying to update my very old Android App to use the latest SDK and the latest version of Android Studio. A lot has changed since the last time I tried to build my app. After some build failures I decided to start from scratch with a new project.
Unfortunately, this new app crashes early at ParticleCloudSDK.init(this) with the error:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/HttpUrl;
at io.particle.android.sdk.cloud.ParticleCloudSDK.initWithInstanceCheck(ParticleCloudSDK.java:48)
at io.particle.android.sdk.cloud.ParticleCloudSDK.init(ParticleCloudSDK.java:27)
To fix this, I tried adding: implementation ‘com.squareup.okhttp3:okhttp:4.1.0’ to the dependencies list of the project, but to no avail. If I open up ParticleCloudSDK.java I see this at line 48:
doInit(ctx, oauthProvider, HttpUrl.parse(asString));
It is unable to resolve the reference to HttpUrl().
Any help is appreciated.
Thanks,
Peter
This is still an issue for me. Is there any solution for this issue. As it is the ParticleCloudSDK does not appear to be compatible with the latest AndroidStudio? I’m pretty ignorant regarding Android apps so its possible I just need to make an adjustment somewhere to get this working. If anyone has an example project that is built from the latest version of AndroidStudio and can call ParticleCloudSDK.init(this) without crashing I would very much appreciate a view.
If you’re having the same issue as me, android studio was trying to use okhttp3 instead of 2. SDK on github hasn’t been updated in over 2 years.
I had to add these to build.gradle because of broken dependency resolution:
implementation 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'io.github.microutils:kotlin-logging:1.12.5'
implementation 'org.slf4j:slf4j-api:1.7.30'
Going through this myself. Getting this working is like pulling teeth. Thanks @jazzathoth for the list of deps. Unfortunately I am now getting issues with timestamps
Scheduling token expiration for Wed Nov 01 20:25:04 CDT 2023 (7776000000ms.
io.particle.android.sdk.cloud.exceptions.ParticleCloudException: retrofit.RetrofitError: com.google.gson.JsonSyntaxException: 2023-08-04T01:24:27.522Z
I suspect the JVM date precision has changed on one side or the other since 2020