teads / TeadsSDK-android

Teads SDK for Android - Premium branded "outstream" ads
13 stars 6 forks source link

internal crash related to some coroutines issues on version 5.0.13 #182

Closed ibelhouchet closed 2 years ago

ibelhouchet commented 2 years ago

Hello, I'm trying to load ads with the last version of the SDK 5.0.13 but it's not working. this is how I'm doing it

  fun initTeadsHelper(context: Context) {
        val placementSettings = (if (BuildConfig.DEBUG)
            AdPlacementSettings.Builder().enableDebug().build()
        else
            AdPlacementSettings.Builder().build())

        val pid = (if (BuildConfig.DEBUG)
            context.resources.getInteger(R.integer.teads_identifier_test)
        else
            context.resources.getInteger(R.integer.teads_identifier))

        adPlacement = TeadsSDK.createInReadPlacement(context, pid, placementSettings)
    }

and to load the ads I use this:

fun loadAd(
    adView: View,
    pageUrl: String
) {

    try {
        // for desktop evaluation you can add enableValidationMode
        requestSettings = if (FeatureDecisions.isTeadsValidationModeEnabled()) {
            AdRequestSettings.Builder()
                .pageSlotUrl(pageUrl)
                .enableValidationMode().build()
        } else {
            AdRequestSettings.Builder()
                .pageSlotUrl(pageUrl)
                .build()
        }

        adPlacement.requestAd(requestSettings, object : InReadAdListener {
            override fun adOpportunityTrackerView(trackerView: AdOpportunityTrackerView) {
                (adView as FrameLayout).addView(trackerView)
            }

            override fun onAdReceived(
                inReadAdView: InReadAdView,
                adRatio: AdRatio
            ) {
                (adView as FrameLayout).addView(inReadAdView, 0)
            }

            override fun onAdClicked() {
                Timber.i("clickOnAd()")
            }

            override fun onAdClosed() {
                Timber.i("closeAd()")
            }

            override fun onAdError(
                code: Int,
                description: String
            ) {
                Timber.e("onAdError(): teads error description: $description , with code: $code")
            }

            override fun onAdImpression() {
                Timber.i("onAdImpression()")
            }

            override fun onAdExpandedToFullscreen() {
                Timber.i("onAdExpandedToFullscreen()")
            }

            override fun onAdCollapsedFromFullscreen() {
                Timber.i("onAdCollapsedFromFullscreen()")
            }

            override fun onAdRatioUpdate(adRatio: AdRatio) {
                Timber.i("onAdRatioUpdate() adRatio: $adRatio")
            }

            override fun onFailToReceiveAd(failReason: String) {
                Timber.e("onFailToReceiveAd() $failReason")
        }
        })
    } catch (e: Exception) {
        Timber.e( "failed to launch InReadAdPlacement error : $e")
    }
}

this is the log

2022-04-14 11:54:18.624 28568-12852/XXXXXXXXXX: E/teads#IoUtils: Could not read file: /data/user/0/XXXXXXXXXX.debug/files/teads/72/adloader.min.js
    java.io.FileNotFoundException: /data/user/0/XXXXXXXXXX/files/teads/72/adloader.min.js: open failed: ENOENT (No such file or directory)
        at libcore.io.IoBridge.open(IoBridge.java:492)
        at java.io.FileInputStream.<init>(FileInputStream.java:160)
        at tv.teads.sdk.utils.IoUtils.b(IoUtils.kt:2)
        at tv.teads.sdk.utils.assets.AssetsStorage.a(AssetsStorage.kt:2)
        at tv.teads.sdk.utils.assets.AssetsStorage.a(AssetsStorage.kt:17)
        at tv.teads.sdk.utils.assets.GetAsset$getAdLoaderWithVersion$2.invokeSuspend(GetAsset.kt:2)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
     Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
        at libcore.io.Linux.open(Native Method)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
        at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7871)
        at libcore.io.IoBridge.open(IoBridge.java:478)
        at java.io.FileInputStream.<init>(FileInputStream.java:160) 
        at tv.teads.sdk.utils.IoUtils.b(IoUtils.kt:2) 
        at tv.teads.sdk.utils.assets.AssetsStorage.a(AssetsStorage.kt:2) 
        at tv.teads.sdk.utils.assets.AssetsStorage.a(AssetsStorage.kt:17) 
        at tv.teads.sdk.utils.assets.GetAsset$getAdLoaderWithVersion$2.invokeSuspend(GetAsset.kt:2) 
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39) 
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) 
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) 
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) 
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 
2022-04-14 11:54:18.624 28568-12852/XXXXXXXXXX D/teads#PerfTeads: p11: 2
2022-04-14 11:54:18.625 28568-12852/XXXXXXXXXX D/teads#AdPlacement: Init - AdLoader OK
2022-04-14 11:54:18.630 28568-28568/XXXXXXXXXX D/teads#AdPlacement: Init advertising ids and adLoader...
2022-04-14 11:54:18.630 28568-28568/XXXXXXXXXX D/teads#AdPlacement: Init - Advertising ids OK
2022-04-14 11:54:18.632 28568-12853/XXXXXXXXXX E/teads#IoUtils: Could not read file: /data/user/0/XXXXXXXXXX/files/teads/72/adloader.min.js
    java.io.FileNotFoundException: /data/user/0/XXXXXXXXXX/files/teads/72/adloader.min.js: open failed: ENOENT (No such file or directory)
        at libcore.io.IoBridge.open(IoBridge.java:492)
        at java.io.FileInputStream.<init>(FileInputStream.java:160)
        at tv.teads.sdk.utils.IoUtils.b(IoUtils.kt:2)
        at tv.teads.sdk.utils.assets.AssetsStorage.a(AssetsStorage.kt:2)
        at tv.teads.sdk.utils.assets.AssetsStorage.a(AssetsStorage.kt:17)
        at tv.teads.sdk.utils.assets.GetAsset$getAdLoaderWithVersion$2.invokeSuspend(GetAsset.kt:2)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
     Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
        at libcore.io.Linux.open(Native Method)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
        at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7871)
        at libcore.io.IoBridge.open(IoBridge.java:478)
        at java.io.FileInputStream.<init>(FileInputStream.java:160) 
        at tv.teads.sdk.utils.IoUtils.b(IoUtils.kt:2) 
        at tv.teads.sdk.utils.assets.AssetsStorage.a(AssetsStorage.kt:2) 
        at tv.teads.sdk.utils.assets.AssetsStorage.a(AssetsStorage.kt:17) 
        at tv.teads.sdk.utils.assets.GetAsset$getAdLoaderWithVersion$2.invokeSuspend(GetAsset.kt:2) 
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39) 
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) 
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) 
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) 
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 
github-maxime-liege commented 2 years ago

Hi @ibelhouchet

Thanks for your feedbacks and your complete informations.

if you updated your app recently from 5.0.10 or below, i would suggest to do a full clean gradle and build cache because we changed totally how we handle assets, and this may cause failure artifacts.

Let me know if this is not the case, we will check on our side

Thanks,

ibelhouchet commented 2 years ago

sorry, it's still not working