Skip to content

Cannot use applicationIdSuffix in the profile mode (Flutter 3.50) #196412

Closed

Description

@deckerst

Steps to reproduce

This is exactly the same issue as #169215, which resurfaced in Flutter v3.50, so I'll copy/paste the steps, etc. as they are the same.

After installing Flutter 3.50, we cannot use a custom Android app suffix id for the profile mode. We use <app_id>.profile as the app id on Android to be able to install different flavors in parallel.
It seems to happen only when a native plugin is installed, like shared_preferences.

To reproduce

  1. flutter create counter
  2. flutter pub add shared_preferences
  3. Add the suffix configuration to android/app/build.gradle.kts in the buildTypes section
android {
   buildTypes {
        getByName("profile") {
            applicationIdSuffix = ".profile"
            versionNameSuffix = "-PROFILE"
            signingConfig = signingConfigs.getByName("debug")
        }
   }
}
  1. flutter run (running on debug mode triggers the issue. No need to run in profile mode)

Expected results

Run successfully

Actual results

It doesn't run

Code sample

Demo app with minor tweaks described above are enough

Screenshots or Video

No response

Logs

Logs
$ flutter run
Launching lib/main.dart on XQ DE72 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':jni'.
> com.android.builder.errors.EvalIssueException: Library projects cannot set applicationIdSuffix. applicationIdSuffix is set to '.profile' in build type 'profile'.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
Running Gradle task 'assembleDebug'...                           1,757ms
Error: Gradle task assembleDebug failed with exit code 1

Flutter Doctor output

Doctor output
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.50.0, on Ubuntu 26.04.1 LTS 7.0.0-43-generic, locale en_GB.UTF-8) [67ms]
    • Flutter version 3.50.0 on channel stable at /home/tibo/code/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ab2912035e (2 days ago), 2026-11-09 08:50:21 -0800
    • Engine revision 371f77202a
    • Dart version 3.14.0
    • DevTools version 2.61.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager,
      omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [561ms]
    • Android SDK at /home/tibo/Android/Sdk
    • Emulator version 37.2.13.0 (build_id 16740729) (CL:N/A)
    • Platform android-37.0, build-tools 37.0.0
    ! Multiple adb binaries found. This can cause conflicts and device detection issues:
        - /home/tibo/Android/Sdk/platform-tools/adb
        - /usr/lib/android-sdk/platform-tools/adb
    • Java binary at: /home/tibo/android-studio/jbr/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 25.0.4+-16339643-b508.27)
    • All Android licenses accepted.

[✓] Chrome - develop for the web [15ms]
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop [891ms]
    • Ubuntu clang version 21.1.8 (6ubuntu1)
    • cmake version 4.2.3
    • ninja version 1.13.2
    • pkg-config version 2.5.1
    • OpenGL core renderer: AMD Radeon Graphics (radeonsi, renoir, ACO, DRM 3.64, 7.0.0-43-generic)
    • OpenGL core version: 4.6 (Core Profile) Mesa 26.0.8-1ubuntu0.3
    • OpenGL core shading language version: 4.60
    • OpenGL ES renderer: AMD Radeon Graphics (radeonsi, renoir, ACO, DRM 3.64, 7.0.0-43-generic)
    • OpenGL ES version: OpenGL ES 3.2 Mesa 26.0.8-1ubuntu0.3
    • OpenGL ES shading language version: OpenGL ES GLSL ES 3.20
    • GL_EXT_framebuffer_blit: yes
    • GL_EXT_texture_format_BGRA8888: yes

[✓] Connected device (3 available) [649ms]
    • XQ DE72 (mobile) • 192.168.0.162:40291 • android-arm64  • Android 15 (API 35)
    • Linux (desktop)  • linux               • linux-x64      • Ubuntu 26.04.1 LTS 7.0.0-43-generic
    • Chrome (web)     • chrome              • web-javascript • Google Chrome 141.0.7390.107

[✓] Network resources [343ms]
    • All expected network resources are available.

• No issues found!

Activity

  1. added
    in triage
    on Nov 12, 2026
  2. puneetkukreja98 commented on Nov 12, 2026

    @puneetkukreja98
    Contributor

    @deckerst Thanks for reporting the issue. I was able to reproduce it on the latest stable version—this is a regression. I am routing it to the Android team now. A similar issue occurred previously, where it was concluded that this is not related to shared_preferences.
    Console logs- 3.47.9

    puneetkukreja@Puneets-MacBook-Air-2 test_p_app % flutter run
    Launching lib/main.dart on Pixel 10 in debug mode...
    Running Gradle task 'assembleDebug'...                            101.5s
    ✓ Built build/app/outputs/flutter-apk/app-debug.apk
    Installing build/app/outputs/flutter-apk/app-debug.apk...           6.0s
    I/FlutterActivityAndFragmentDelegate(11380): If you are attempting to set --enable-dart-profiling via Intent extras to launch a Flutter component outside of using the Flutter CLI, note that support for setting engine flags on Android via Intent will soon be dropped; see https://github.com/flutter/flutter/issues/180686 for more information on this breaking change. To migrate, set --enable-dart-profiling or any other flags specified via Intent extras on the command line instead or see https://github.com/flutter/flutter/blob/main/docs/engine/Flutter-Android-Engine-Flags.md for alternative methods.
    D/FlutterJNI(11380): Beginning load of flutter...
    D/FlutterJNI(11380): flutter (null) was loaded normally!
    I/flutter (11380): [IMPORTANT:flutter/shell/platform/android/android_context_vk_impeller.cc(62)] Using the Impeller rendering backend (Vulkan).
    D/FlutterRenderer(11380): Width is zero. 0,0
    D/FlutterRenderer(11380): Width is zero. 0,0
    D/FlutterJNI(11380): Sending viewport metrics to the engine.
    D/FlutterJNI(11380): Sending viewport metrics to the engine.
    D/FlutterJNI(11380): Sending viewport metrics to the engine.
    Syncing files to device Pixel 10...                                363ms
    
    Flutter run key commands.
    r Hot reload. 🔥🔥🔥
    R Hot restart.
    h List all available interactive commands.
    d Detach (terminate "flutter run" but leave application running).
    c Clear the screen
    q Quit (terminate the application on the device).
    
    A Dart VM Service on Pixel 10 is available at: http://127.0.0.1:52355/COsxRnbk1UU=/
    The Flutter DevTools debugger and profiler on Pixel 10 is available at: http://127.0.0.1:52355/COsxRnbk1UU=/devtools/?uri=ws://127.0.0.1:52355/COsxRnbk1UU=/ws
    D/ProfileInstaller(11380): Installing profile for com.example.test_p_app

    Console logs- 3.50.0

    puneetkukreja@Puneets-MacBook-Air-2 t_latest_app % flutter run
    Launching lib/main.dart on Pixel 10 in debug mode...
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    A problem occurred configuring project ':jni'.
    > com.android.builder.errors.EvalIssueException: Library projects cannot set applicationIdSuffix. applicationIdSuffix is set to '.profile' in build type 'profile'.
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights from a Build Scan (powered by Develocity).
    > Get more help at https://help.gradle.org.
    
    BUILD FAILED in 27s
    Running Gradle task 'assembleDebug'...                             27.8s
    Error: Gradle task assembleDebug failed with exit code 1
  3. puneetkukreja98 commented on Nov 12, 2026

    @puneetkukreja98
    Contributor

    flutter doctor -v:

    [✓] Flutter (Channel stable, 3.50.0, on macOS 26.4.1 25E253 darwin-arm64, locale en-US) [529ms]
        • Flutter version 3.50.0 on channel stable at /Users/puneetkukreja/Developer/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ab2912035e (2 days ago), 2026-11-09 08:50:21 -0800
        • Engine revision 371f77202a
        • Dart version 3.14.0
        • DevTools version 2.61.0
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use,
          enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 37.0.0-rc1) [1,676ms]
        • Android SDK at /Users/puneetkukreja/Library/Android/sdk
        • Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
        • Platform android-37.1, build-tools 37.0.0-rc1
        • Java binary at: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/java
          This JDK is specified in your Flutter configuration.
          To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 26.6) [1,144ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 17F113
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [7ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (4 available) [6.7s]
        • Pixel 10 (mobile)                   • 61221VDCR000D5            • android-arm64  • Android 17 (API 37)
        • Puneet’s iPhone (wireless) (mobile) • 00008110-00167CEE0C46401E • ios            • iOS 18.0.1 22A3370
        • macOS (desktop)                     • macos                     • darwin-arm64   • macOS 26.4.1 25E253 darwin-arm64
        • Chrome (web)                        • chrome                    • web-javascript • Google Chrome 157.0.8103.51
    
    [✓] Network resources [722ms]
        • All expected network resources are available.
    
    • No issues found!
  4. added
    c: regression
    platform-android
    team-android
    has reproducible steps
    tool
    t: gradle
    found in release: 3.50
    and removed
    in triage
    on Nov 12, 2026
  5. reidbaker-agent commented on Nov 16, 2026

    @reidbaker-agent
    Contributor

    Thanks for the clear repro. I reproduced this on 3.50.0. 3.47.9 builds fine.

    Cause: in 3.50, the Flutter Gradle Plugin copies each app build type that a plugin doesn't define (here profile) onto that plugin with AGP's initWith. initWith also copies applicationIdSuffix, and AGP doesn't allow that in library modules. The same thing happens with isShrinkResources, buildConfigField and resValue on a build type. The fix is in #196692.

    Workarounds until the fix ships. I tested both on 3.50.0: debug and profile builds succeed, and the profile APK has the .profile package name.

    1. Set the suffix with the variant API instead of on the build type. In android/app/build.gradle.kts, remove applicationIdSuffix from the profile block (you can keep versionNameSuffix), and add:

      androidComponents {
          onVariants(selector().withBuildType("profile")) { variant ->
              variant.applicationId.set(variant.applicationId.get() + ".profile")
          }
      }
    2. Give each plugin its own profile build type, so Flutter doesn't copy the app's one. Add this at the end of android/build.gradle.kts:

      subprojects {
          pluginManager.withPlugin("com.android.library") {
              extensions.configure<com.android.build.api.dsl.LibraryExtension>("android") {
                  buildTypes.maybeCreate("profile")
              }
          }
      }
  6. added a commit that references this issue on Nov 17, 2026
    534fb4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: regressionfound in release: 3.50has reproducible stepsplatform-androidt: gradleteam-androidtool

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions