question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with API 32 or 33 with Coil

See original GitHub issue

Description

java.lang.NullPointerException
	at androidx.core.os.BuildCompat.isAtLeastPreReleaseCodename(BuildCompat.java:60)
	at androidx.core.os.BuildCompat.isAtLeastT(BuildCompat.java:211)
	at androidx.core.content.ContextCompat.checkSelfPermission(ContextCompat.java:595)
	at coil.util.-Contexts.isPermissionGranted(Contexts.kt:81)
	at coil.network.NetworkObserverKt.NetworkObserver(NetworkObserver.kt:27)
	at coil.util.SystemCallbacks.<init>(SystemCallbacks.kt:31)
	at coil.RealImageLoader.<init>(RealImageLoader.kt:79)
	at coil.ImageLoader$Builder.build(ImageLoader.kt:529)
	at coil.ImageLoaders.create(ImageLoaders.kt:16)
	at coil.Coil.newImageLoader(Coil.kt:64)
	at coil.Coil.imageLoader(Coil.kt:29)
	at coil.compose.ImageLoaderProvidableCompositionLocal.getCurrent(LocalImageLoader.kt:57)
	at coil.compose.SingletonAsyncImagePainterKt.rememberAsyncImagePainter-MqR-F_0(SingletonAsyncImagePainter.kt:57)
	at com.google.android.horologist.media.ui.components.MediaArtworkKt.MediaArtwork(MediaArtwork.kt:53)
	at com.google.android.horologist.media.ui.components.MediaChipKt$MediaChip$appIcon$1$1.invoke(MediaChip.kt:80)
	at com.google.android.horologist.media.ui.components.MediaChipKt$MediaChip$appIcon$1$1.invoke(MediaChip.kt:79)

Method is

    protected static boolean isAtLeastPreReleaseCodename(@NonNull String codename,
            @NonNull String buildCodename) {

        // Special case "REL", which means the build is not a pre-release build.
        if ("REL".equals(buildCodename)) {
            return false;
        }

        // Otherwise lexically compare them.  Return true if the build codename is equal to or
        // greater than the requested codename.
        final String buildCodenameUpper = buildCodename.toUpperCase(Locale.ROOT);
        final String codenameUpper = codename.toUpperCase(Locale.ROOT);
        return buildCodenameUpper.compareTo(codenameUpper) >= 0;
    }

Steps to Reproduce

Bump project compileSdk to 33 and configure SDK 32 in Paparazzi.

Expected behavior

Image loaders work, or at least don’t fail.

Workaround

I created a FakeImageLoader for tests. Coil also allows you to disable the network observer.

Additional information:

  • Paparazzi Version: 1.0
  • OS: github linux
  • Compile SDK: 33
  • Gradle Version: 7.5
  • Android Gradle Plugin Version: 7.3.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yschimkecommented, Oct 3, 2022

I think this fix from some of the other API 33 issues is relevant

        environment = detectEnvironment().copy(
            platformDir = "${androidHome()}/platforms/android-32",
            compileSdkVersion = 32
        )
0reactions
sergio-sastrecommented, Nov 22, 2022

Just in case somebody else is experiencing the same problem.

I also see this with any call to androidx.compose.ui.text.android.BoringLayoutFactory.measure, what some common Composables like Text call.

No issues with other composables though.

I am using

  1. compileSdkVersion 33 & targetSdkVersion 33
  2. kotlinCompilerExtensionVersion '1.3.2'
  3. 'androidx.compose:compose-bom:2022.10.00'
  4. No Coil or any other image loading library
 environment = detectEnvironment().copy(
            platformDir = "${androidHome()}/platforms/android-32",
            compileSdkVersion = 32
        ),

The error:

java.lang.NullPointerException: null
	at androidx.core.os.BuildCompat.isAtLeastPreReleaseCodename(BuildCompat.java:60)
	at androidx.core.os.BuildCompat.isAtLeastT(BuildCompat.java:211)
	at androidx.compose.ui.text.android.BoringLayoutFactory.measure(BoringLayoutFactory.kt:49)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Log - Coil
Fix: RoundedCornersTransformation now properly scales the input bitmap. Remove dependency on the kotlin-parcelize plugin. Update compile SDK to 33. Downgrade ...
Read more >
android:exported added but still getting error Apps targeting ...
I target to android SDK 33 now and it also works. The secret is the "androidx.test:core:1.4.0". It must be >= 1.4.0. Otherwise it...
Read more >
Fix incompatibility when used with compileSdk 33 projects by ...
This means that projects using compileSdkVersion 33 will work as normal, just running on an API 32 host.
Read more >
Refrigerator not cooling enough. Fridgidaire Gallery 2006-7?
Freezer is right at 32-33 degrees. I cleaned ice off the coils but still not working. The compressor seems to be running and...
Read more >
HPLC troubleshooting guide - CCC
32. Method Verification. 33. Double Peaks in Sugar Separations. 34. Method Control ... The source of your column problem could for example be....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found