Skip to content

On Android, flutter run throws "error: package androidx.multidex does not exist" #148368

@songyang-dev

Description

@songyang-dev

Steps to reproduce

  1. Take an existing Flutter project from Flutter 3.19. The existing project must be using multidex support.
  2. flutter upgrade to Flutter 3.22.
  3. flutter run on Android

Actual results

The app should launch in the Android emulator.

Logs

Logs
$ flutter run
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
C:\Users\songy\Documents\Projects\Music with Anna\quick_ear\android\app\src\main\java\io\flutter\app\FlutterMultiDexApplication.java:13: error: package androidx.multidex does not exist
import androidx.multidex.MultiDex;
                        ^
C:\Users\songy\Documents\Projects\Music with Anna\quick_ear\android\app\src\main\java\io\flutter\app\FlutterMultiDexApplication.java:23: error: cannot find symbol
    MultiDex.install(this);
    ^
  symbol:   variable MultiDex
  location: class FlutterMultiDexApplication
2 errors

FAILURE: Build failed with an exception.

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

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
Running Gradle task 'assembleDebug'...                              6.3s
Error: Gradle task assembleDebug failed with exit code 1
Error output and standard output:

error.log
run.log

Flutter Doctor output

Doctor output
$ flutter doctor 
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Version
    10.0.22631.3447], locale en-CA)
[√] Windows Version (Installed version of Windows is version 10 or
    higher)
[√] Android toolchain - develop for Android devices (Android SDK     
    version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community    
    2022 17.9.4)
[√] Android Studio (version 2023.3)
[√] VS Code (version 1.89.1)
[√] Connected device (4 available)
[√] Network resources

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform teamworkaround availableThere is a workaround available to overcome the issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions