Skip to content

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain #14422

@Timmmm

Description

@Timmmm

Steps to Reproduce

  1. Create a project using the latest released Flutter.
  2. Upgrade it from Gradle as described here.
  3. Try and run the project.

Logs

I get this output from IntelliJ:

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Finished with error: Exit code 1 from: /Users/me/Tim/quicktimer/android/gradlew -v:
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

I've tried quite a lot to solve this. In fact opening the android subfolder in Android Studio works fine and builds the APK without errors, so I really have no idea why this is happening. All the solutions on Google involve running gradle wrapper to regenerate the wrapper that will download the correct version of Gradle or something like that, but I don't know how to run gradle. It isn't in my PATH. I assume it is embedded in IntelliJ somewhere. Bit of a catch-22.

Flutter Doctor

[✓] Flutter (on Mac OS X 10.13.2 17C88, locale en-GB, channel alpha)
    • Flutter at /Users/me/Tim/flutter
    • Framework revision 8f65fec5f5 (7 weeks ago), 2017-12-12 09:50:14 -0800
    • Engine revision edaecdc8b8
    • Tools Dart version 1.25.0-dev.11.0
    • Engine Dart version 2.0.0-edge.d8ae797298c3a6cf8dc9f4558707bd2672224d3e

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/me/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[-] iOS toolchain - develop for iOS devices
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    ✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To install:
        brew install cocoapods
        pod setup

[✓] Android Studio (version 3.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] IntelliJ IDEA Community Edition (version 2017.3.3)
    • Flutter plugin version 21.1.3
    • Dart plugin version 173.4301.22

[✓] Connected devices
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolet: gradle"flutter build" and "flutter run" on Android

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions