benjamindean / flutter_vibration

Handle vibration on iOS and Android in Flutter apps
229 stars 69 forks source link

Face this error in android studio terminal #84

Closed 30eggis closed 1 year ago

30eggis commented 1 year ago

My flutter doctor information is ..

`[✓] Flutter (Channel stable, 3.10.0, on macOS 13.3.1 22E261 darwin-arm64 (Rosetta), locale ko-KR) • Flutter version 3.10.0 on channel stable at /Users/ted/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 84a1e904f4 (7 days ago), 2023-05-09 07:41:44 -0700 • Engine revision d44b5a94c9 • Dart version 3.0.0 • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/ted/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • ANDROID_HOME = /Users/ted/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/ted/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.11.3

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio • Android Studio at /Applications/Android Studio Preview.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart ✗ Unable to find bundled Java version. • Try updating or re-installing Android Studio.

[✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.78.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator) • iPhone SE (3rd generation) (mobile) • 98B320D4-E91C-4C52-95EB-EA4C62207BF5 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E261 darwin-arm64 (Rosetta) • Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92

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

and my android emulator is API 33 Fold-in Type,

i'd run 'flutter pub get' then run on my emulator,

i expect run on my emulator but i got this error

` Launching lib/main.dart on sdk gphone64 arm64 in debug mode... Running Gradle task 'assembleDebug'...

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

2: Task failed with an exception.

BUILD FAILED in 1s Exception: Gradle task assembleDebug failed with exit code 1 `

so, i removed this line

... 25 namespace 'com.benjaminabel.vibration' ...

it is work well build,

Is it okay for me to remove this line?

benjamindean commented 1 year ago

The project is on Android Gradle Plugin 8.0. You can either upgrade, or remove the namespace if it's not possible to upgrade.

shinayser commented 1 year ago

Are you sure @benjamindean ? because on the build.gradle file it is importing this version:

classpath 'com.android.tools.build:gradle:3.5.0'

I am also having the same problem of @30eggis and trying to find a solution

shinayser commented 1 year ago

I've fixed by upgrading my gradle to 7.2.2 on my app's build.gradle:

dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
}
30eggis commented 1 year ago

i solved this issue, it is my fault.

my problem occured after upgrade Flutter version ( to 3.10.0 )

if you face similar this issue, then check your android project

1st step : gradle.wrapper.properties. maybe you had older gradle version, (in my case -> distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip) you should match gradle version to support gradle version of flutter. (in my case -> distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip)

2nd step : app/build.gradle buildscript { ext.kotlin_version = $kotlin_version dependencies { classpath 'com.android.tools.build:gradle:$gradle_version' } } also $kotlin_version and $gradle_version fix to match from flutter version

happy coding,

Thank you for your response