Flutter Unsupported class file major version 63 Android studio - android

I'm getting error after update the Android version and flutter version. Right now I want add the "file_picker: ^5.2.5", and "cached_network_image: ^3.2.3" plugin so getting "General error during conversion: Unsupported class file major version 63" error.
I have checked many solution but nothing one to help me.
Please help me for fix this issue.
Flutter version:-
Flutter 3.3.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18a827f393 (4 months ago) • 2022-09-28 10:03:14 -0700
Engine • revision 5c984c26eb
Tools • Dart 2.18.2 • DevTools 2.15.0
Android Studio version:-
Android Studio Electric Eel | 2022.1.1
Build #AI-221.6008.13.2211.9477386, built on January 11, 2023
Runtime version: 11.0.15+0-b2043.56-8887301 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.1
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
Non-Bundled Plugins:
com.github.dhaval2404.material_icon_generator (1.3)
Dart (221.6091)
pl.pszklarska.pubversionchecker (1.3.5)
io.flutter (71.2.4)

Go to this location(C:\Program Files\Android\Android Studio\jbr)
Copy all the files from here
paste all the copied files in (jre) folder
Open your cmd and run flutter doctor again.

I finally found the solution of this problem :-
soo just go at your project folder and then
open android/gradle/wrapper/gradle-wrapper-properties then change this :-
distributionUrl=https://services.gradle.org/distributions/gradle-7.4-all.zip
To This :-
distributionUrl=https://services.gradle.org/distributions/gradle-7.6-all.zip
and then your issue get solved 😁

Check flutter doctor status. The issue likely is in the java bundle.

tl;dr Update Android Studio and Gradle Versions
I encountered this error while trying to run Flutter integration tests on Firebase Test Lab. I was able to solve this by updating a few things in Android Studio.
Update the Project's JDK
Open the Android Studio Project Structure page (File -> Project Structure)
Click the "SDKs" tab
Download the newest JDK version and add it to the list
Click the "Project" tab
Update the SDK field to the new JDK
Update com.android.tools.build:gradle
In android/build.gradle, update the com.android.tools.build:gradle value to the latest version found here.
dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
...
}
Update the gradle distributionUrl
In android/gradle/wrapper/gradle-wrapper.properties, update the distributionUrl property to use the latest Gradle version.
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

Related

Flutter Android gradle plugin to version 3.2.0 or higher

I have already update the latest Android Gradle version but still showing the error when generating the signed bundle.
generating signed bundle requires you to update the android gradle plugin to version 3.2.0 or higher
Below i have share the version details.
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
Android studio version
Android Studio Bumblebee | 2021.1.1 Patch 3
Build #AI-211.7628.21.2111.8309675, built on March 16, 2022
Runtime version: 11.0.11+0-b60-7772763 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.4
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: Dart (211.7817), org.jetbrains.kotlin (211-1.6.21-release-334-AS7442.40), io.flutter (66.0.1)
Flutter version
Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5f105a6ca7 (3 months ago) • 2022-02-01 14:15:42 -0800
Engine • revision 776efd2034
Tools • Dart 2.16.0 • DevTools 2.9.2
Flutter editor in Android Studio doesn't have proper lint check for Android project code. You might need to access the gradle settings using Android editor for the changes to be indexed and rebuilt. To access the Android project with proper lint check, it's better to open it via Tools > Flutter > Open Android module in Android Studio

Flutter and Android Studio installation broken by recent update

I recently updated my Flutter installation because there's was a little notification in Android Studio. Now it's broken.
Whenever I try to run my app I get this error message;
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
When I check the versions of everything I get;
Flutter 2.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 02c026b03c (2 weeks ago) • 2021-05-27 12:24:44 -0700
Engine • revision 0fdb562ac8
Tools • Dart 2.13.1
Gradle is version 7.0.2 and the flutter, dart and gradle plugins all seem to be installed and updated in Android Studio.
I have Java 16.0.1 and JAVA_HOME seems to be set correctly in the system variables. And the path to Flutter seems to be correct as well.
Inside the directory for my app, I also have android\build.gradle and android\settings.gradle
What am I missing?
Unfortunately, the solution to this was to completely remove any trace of flutter, android studio, java and gradle, and to reinstall everything from scratch. Just be aware that if you do this you may run into to problems with your code if you copy / paste it from your old app.

Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-6.7.1-all.zip'

I have just installed Android Studio. And I have this problem. Here is the screenshot.
then I clicked the link and downloaded the zip file manually. Then I installed it. Now, when I type Gradle -v on Command-Line, it shows that everything is fine with Gradle. Here it is.
Android Gradle Plugin version is 3.6.3 Here is Android Gradle Plugin Version
This is the information about the Android Studio that I am using: Android Studio 4.1.1
Build #AI-201.8743.12.41.6953283, built on November 4, 2020
Runtime version: 1.8.0_242-release-1644-b01 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1237M
Cores: 8
Registry: ide.new.welcome.screen.force=true,
external.system.auto.import.disabled=true
Probably a Compatibility issue because you are using a old plugin version with latest Gradle version .
Change plugin version in Project level gradle .
classpath 'com.android.tools.build:gradle:4.1.0'
Then try to build your project . Check the Compatible version in the documentation

Flutter run release fails: Minimum supported Gradle version is 5.6.4. Current version is 5.6.2

When trying to run my app with flutter run --release it throws an error:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Chris\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info-0.4.2+1\android\build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'device_info'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 5.6.4. Current version is 5.6.2. If using the gradle wrapper, try editing the distributionUrl in C:\Users\Chris\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\device_info-0.4.2+1\android\gradle\wrapper\gradle-wrapper.properties to gradle-5.6.4-all.zip
If I remove this device_info plugin, I get the same error just pointing to Gradle current version to be 4.10.2 due to another plugin flutter_plugin_android_lifecycle.
I don't understand. I tried updating my gradle-wrapper.properties to
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Previously it was set to 5.6.2, but this changed nothing. Also tried with 4.10.2, but it equally just get's ignored.
I updated the gradle version in my build.gradle to
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
I created a new flutter project, just copied my pages and the pubspec... I tried in console, I tried with android studio. flutter clean, flutter build appBundle, deleting gradle versions, I tried everything I could think of or that I have read somewhere...
Nothing could help to get rid of this error, gradle insists that its current version is 5.6.2.
A new "virgin" flutter project however, I can run in release mode, without problems.
It appears these plugins will download their own gradle version. I could see it in Android Studio how an old gradle version is downloaded in contrary to the actual gradle version stated in my settings. Either way after 3 days with this, I'm running out of options and ideas.
Does anyone know how to solve this or to narrow the problem down? I also would be glad for an explanation on what's going on here.
My flutter doctor output:
[√] Flutter (Channel master, v1.17.1-pre.23, on Microsoft Windows [Version 10.0.18362.720], locale de-DE)
• Flutter version 1.17.1-pre.23 at C:\flutter
• Framework revision a2e6c30b44 (12 hours ago), 2020-04-03 20:26:01 -0700
• Engine revision 09bc1fc45e
• Dart version 2.8.0 (build 2.8.0-dev.19.0 e736495eb7)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\Chris\AppData\Local\Android\sdk
• Platform android-R, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.0.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.43.2)
• VS Code at C:\Users\Chris\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.9.0
[√] Connected device (1 available)
• Lenovo A6020l36 • 32aac289 • android-arm64 • Android 5.1.1 (API 22)
• No issues found!
I found the problem.
It was a totally different plugin unique_identifier 0.0.3 that caused the error. After removing it, the app compiles dine again.
If you have a similar case: I had to test for every single package installed until I found it.

Adding Cloud Firestore & Firebase to Flutter project (Android)

This is going to be a fairly long question, so I'll include a TL;DR at the end.
For days now, I've been trying to find a way to make my setup work, but to no avail. Now to make it complete and of aid to others, I'll be recording my steps here:
Steps to reproduce
Create a new Flutter project (compiles and runs without any warnings)
Create a new Firebase console project
Follow these instructions to add Firebase to android (also included below in case of version changes).
Add Cloud Firestore to the project in the pubspec.yaml
Encounter this error:
What went wrong:
Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.
Firebase instructions (as of now)
Install Google Repository (revision 58 currently) (not necessary anymore according to this issue, but done for verification).
Copy the package name found in android/app/src/main/AndroidManifest.xml. In my case this was com.omnisciamus.fire. Use it to create a new android app in the Firebase project along with a debug key.
Drop the created google-services.json in android/app
Modify the android/build.gradle and android/app/build.gradle. I've changed this to using the latest versions (modifications included below).
At this point I reran the compilation to see if any issues popped up already, and we have 3 of these warnings, which is most likely the google services plugin, not something I can change anything about:
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
Now we add the dependencies in the pubspec.yaml, also included below.
Now there are several possible versions we can use, but I first tried the latest versions (by including a ^ in front of the versions).
Gradles
Changes to the android/build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0' // upgraded from 3.0.1
classpath 'com.google.gms:google-services:3.2.0' // added & upgraded from 3.1.1
}
}
And then we have the android/app/build.gradle:
//bottom of file
apply plugin: 'com.google.gms.google-services'
Pubspec
The dependencies structure of my pubspec looks like this:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.0
firebase_analytics: 0.3.0
cloud_firestore: 0.3.1
Setup details
For additional details I've included my flutter doctor -v output:
[√] Flutter (Channel beta, v0.1.5, on Microsoft Windows [Version 10.0.16299.309], locale en-GB)
• Flutter version 0.1.5 at C:\Developer\Flutter\flutter
• Framework revision 3ea4d06340 (5 weeks ago), 2018-02-22 11:12:39 -0800
• Engine revision ead227f118
• Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
[√] Android toolchain - develop for Android devices (Android SDK 27.0.0)
• Android SDK at C:\Android
• Android NDK at C:\Android\ndk-bundle
• Platform android-P, build-tools 27.0.0
• ANDROID_HOME = C:\Android
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[√] Android Studio (version 3.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[√] IntelliJ IDEA Ultimate Edition (version 2017.3)
• Flutter plugin version 22.2.2
• Dart plugin version 173.4548.30
[√] VS Code (version 1.21.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Dart Code extension version 2.10.0
[√] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 6.0 (API 23) (emulator)
• No issues found!
Debug key
As this may become a tutorial I'll include a simple command to obtain the debug key (on Windows):
cd %JAVA_HOME%\bin & keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
TL;DR
Cloud_firestore crashes with a version of 0.3.x, how do you fix this?
As I discussed this with a few co-developers, I discovered that one had found a working setup: changing the version of cloud_firestore to be below 0.3.0, 0.2.9 for instance. According to this recently published issue, the issue is that the 'stable' version of flutter doesn't have certain features that cloud_firestore uses, which causes the errors you see when compiling. I'll update the question in a while to reflect this answer if requested.
I solved my current Cloud_Firestore problems by:
Changing the flutter channel from beta to master. Just run in the terminal flutter channel master. As proposed here Cloud Firestore 0.3.2 - Execution failed for task ...
worked with flutter dependencies: cloud_firestore: "^0.4.0" even cloud_firestore: "^0.3.2".
Hope this would help. I spent hours trying to figure it out why I could not compile my flutter app with cloud_firestore. I knew that the issue was around the flutter SDK versions, but I did not wanted to go for alpha. But the solution turned out to be as simple as using the master channel. Although, not sure yet what other issues may arise in the near future. However now, I can happily start testing with cloud firestore. ;)
For the Firebase plugins to work with Swift you need to use newer versions: But I am having android problems as well. I also tried switching flutter channel from beta to dev.
dependencies:
flutter:
sdk: flutter
cloud_firestore: "^0.4.0"
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.0
dev_dependencies:
flutter_test:
sdk: flutter
image_picker: 0.4.1
#google_sign_in: '>=2.1.0 '
google_sign_in: '3.0.0'
#firebase_analytics: '>=0.2.3'
firebase_auth: '>=0.4.5'
#firebase_auth: '>=0.5.3' #not working on android
#firebase_database: '>=0.3.5' #works on android
firebase_database: '0.4.2' #works on android
#firebase_storage: '>=0.1.4' #not Working on android
#firebase_storage: '0.2.0' #not working on android
I also had similar issues while using firebase in flutter. I solved it by using this dependencies in my android/build.gradle file and remove any other existing dependencies.
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.1'
and used this version for firestore and google in pubspec.yaml
cloud_firestore: 0.7.3
And if you have version related issues with any other firebase product then refer this link

Categories

Resources