Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compile]: Android build fails with Flutter 3.29.0 stable release, FlutterNativeView.java not found #3476

Open
8 tasks done
komaxx opened this issue Feb 14, 2025 · 1 comment · May be fixed by #3477
Open
8 tasks done
Labels
compile Compilation error triage

Comments

@komaxx
Copy link

komaxx commented Feb 14, 2025

Operating System

macOS 15.3.1

Plugin

alarm_manager_plus

Version

4.0.6

Flutter SDK

3.29.0

Compilation command

flutter run / flutter build apk

Dart Dependencies

name: tmp
description: "A new Flutter project."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: ^3.7.0

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.8
  android_alarm_manager_plus: ^4.0.6


dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^5.0.0

flutter:
  uses-material-design: true

Native dependencies

plugins {
    id("com.android.application")
    id("kotlin-android")
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id("dev.flutter.flutter-gradle-plugin")
}

android {
    namespace = "com.example.tmp"
    compileSdk = flutter.compileSdkVersion
    ndkVersion = "27.0.12077973"

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId = "com.example.tmp"
        // You can update the following values to match your application needs.
        // For more information, see: https://flutter.dev/to/review-gradle-config.
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    buildTypes {
        release {
            signingConfig = signingConfigs.getByName("debug")
        }
    }
}

flutter {
    source = "../.."
}

Compilation Error

❯ flutter build apk

/Users/matthiasschicker/.pub-cache/hosted/pub.dev/android_alarm_manager_plus-4.0.6/android/src/main/java/dev/fluttercommunity/plus/androidalarmmanager/AndroidAlarmManagerPlugin.java:16: error: cannot find symbol
import io.flutter.view.FlutterNativeView;
                      ^
  symbol:   class FlutterNativeView
  location: package io.flutter.view
Note: /Users/matthiasschicker/.pub-cache/hosted/pub.dev/android_alarm_manager_plus-4.0.6/android/src/main/java/dev/fluttercommunity/plus/androidalarmmanager/AlarmService.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':android_alarm_manager_plus:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.

BUILD FAILED in 1s
Running Gradle task 'assembleRelease'...                         1,806ms
Gradle task assembleRelease failed with exit code 1

Flutter Doctor

❯ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.1 24D70 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.97.0)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@komaxx komaxx added compile Compilation error triage labels Feb 14, 2025
@komaxx
Copy link
Author

komaxx commented Feb 14, 2025

Please note that while I found the issue with my main project, I could reproduce it with a minimal project as well:

I just created a new Flutter project and added the dependency to android_alarm_manager_plus: ^4.0.6, no code changes.

The compilation error only happens with Flutter 3.29.0 (the current stable version) and later (e.g., master channel version 3.30.0-1.0.pre.150). When I downgrade Flutter to 3.27.4 via git checkout 3.27.4, I do not see build issues.

Also, when checking the javadoc for the Android code at https://api.flutter.dev/javadoc/io/flutter/view/package-summary.html, FlutterNativeView indeed seems to no longer exist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile Compilation error triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant