Open boskicaruso opened 1 month ago
Heyy @boskicaruso Thanks for raising this. This seems to be a strict mode violation and was already detected in our internal audit.
As documented by android But don't feel compelled to fix everything that StrictMode finds
here , this isn't extremely critical and hence we have added this to our roadmap
Describe the bug An
IllegalAccessException
occurred while initialising CleverTap withapplicationContext
(following documentation)To Reproduce
Screenshots/Logs Tried to access visual service WindowManager from a non-visual Context:com.example.app.App@fbbaf9c WindowManager should be accessed from Activity or other visual Context. Use an Activity or a Context created with Context#createWindowContext(int, Bundle), which are adjusted to the configuration and visual bounds of an area on screen. java.lang.IllegalAccessException: Tried to access visual service WindowManager from a non-visual Context::com.example.app.App@fbbaf9c at android.app.ContextImpl.getSystemService(ContextImpl.java:2235) at android.content.ContextWrapper.getSystemService(ContextWrapper.java:936) at com.clevertap.android.sdk.DeviceInfo$DeviceCachedInfo.getWidth(DeviceInfo.java:311) at com.clevertap.android.sdk.DeviceInfo$DeviceCachedInfo.(DeviceInfo.java:110)
at com.clevertap.android.sdk.DeviceInfo.getDeviceCachedInfo(DeviceInfo.java:894)
at com.clevertap.android.sdk.DeviceInfo.getSdkVersion(DeviceInfo.java:633)
at com.clevertap.android.sdk.validation.ManifestValidator.checkSDKVersion(ManifestValidator.java:112)
at com.clevertap.android.sdk.validation.ManifestValidator.validate(ManifestValidator.java:33)
at com.clevertap.android.sdk.CleverTapAPI.lambda$manifestAsyncValidation$15$com-clevertap-android-sdk-CleverTapAPI(CleverTapAPI.java:2889)
at com.clevertap.android.sdk.CleverTapAPI$$ExternalSyntheticLambda5.call(D8$$SyntheticClass:0)
at com.clevertap.android.sdk.task.Task$1.run(Task.java:234)
at com.clevertap.android.sdk.task.PostAsyncSafelyExecutor.execute(PostAsyncSafelyExecutor.java:39)
at com.clevertap.android.sdk.task.Task.execute(Task.java:107)
at com.clevertap.android.sdk.CleverTapAPI.manifestAsyncValidation(CleverTapAPI.java:2887)
at com.clevertap.android.sdk.CleverTapAPI.lambda$new$9$com-clevertap-android-sdk-CleverTapAPI(CleverTapAPI.java:1171)
at com.clevertap.android.sdk.CleverTapAPI$$ExternalSyntheticLambda2.call(D8$$SyntheticClass:0)
at com.clevertap.android.sdk.task.Task$1.run(Task.java:234)
at com.clevertap.android.sdk.task.PostAsyncSafelyExecutor$1.run(PostAsyncSafelyExecutor.java:45)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Environment (please complete the following information):
CleverTap SDK Version 7.0.1
Workaround Use Activity Context instead