Skip to content

[Bug] 1.7.0 fails to compile on AGP 8 / Kotlin 2.2.20 — WakelockPlusPlugin missing (default-package imports in generated code) #141

Description

@xShuusui

Version

wakelock_plus 1.7.0 (regression vs 1.6.1). Introduced by #135 / PR #136.

Environment

  • Flutter 3.44.6, Kotlin Gradle Plugin 2.2.20, AGP 8.11.1 (NOT on AGP 9 / built-in Kotlin)

Symptom

Android build fails in GeneratedPluginRegistrant.java:

error: cannot find symbol
  ...add(new dev.fluttercommunity.plus.wakelock.WakelockPlusPlugin());
symbol: class WakelockPlusPlugin

WakelockPlusPlugin.class is never produced. Wakelock.class compiles fine.

Root cause

android/.../WakelockPlusMessages.g.kt has no package declaration, so its Pigeon classes land in the default package. WakelockPlusPlugin.kt (package dev.fluttercommunity.plus.wakelock) then does:

import IsEnabledMessage
import ToggleMessage
import WakelockPlusApi

Importing from the default package into a named package is rejected by modern Kotlin, so only WakelockPlusPlugin.kt (the file with these imports) fails to compile — which is why the class disappears.

Before #136 this was masked: the plugin shipped its own buildscript pinning Kotlin 2.2.0, which tolerated the default-package import. #136 removed that buildscript so the plugin is now compiled by the app's KGP (2.2.20), which rejects it. On AGP < 9 (no built-in Kotlin) this breaks the build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions