Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include a java too new path in android-java-gradle-migration #11708

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

reidbaker
Copy link
Contributor

Follow up on after some pairing with @anderdobo and @kenzieschmoll covering android agp updates.

Presubmit checklist

  • This PR is marked as draft with an explanation if not meant to land until a future stable release.
  • This PR doesn’t contain automatically generated corrections (Grammarly or similar).
  • This PR follows the Google Developer Documentation Style Guidelines — for example, it doesn’t use i.e. or e.g., and it avoids I and we (first person).
  • This PR uses semantic line breaks of 80 characters or fewer.

@flutter-website-bot
Copy link
Collaborator

Visit the preview URL for this PR (updated for commit ec8f316):

https://flutter-docs-prod--pr11708-r-java-version-confustion-t-zsnn5gkp.web.app

@@ -83,6 +83,27 @@ Do the following from the top of your Flutter project.
$ ./gradlew wrapper --gradle-version=7.6.1
```

## You didnt update android studio and still have a java error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: missing apostrophe in "didn't"
r/android studio/Android Studio
r/java/Java

@@ -83,6 +83,27 @@ Do the following from the top of your Flutter project.
$ ./gradlew wrapper --gradle-version=7.6.1
```

## You didnt update android studio and still have a java error
The error appears similar to `Unsupported class file major version 65`.
This is an indication that your java version is newer than the version of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r/java/Java everywhere

Copy link
Member

@kenzieschmoll kenzieschmoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content LGTM, I'll let our tech writers review for style, format, etc.

Copy link
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nitpicky comments.


### Solution 1: Use Android Studio
The easiest way to resolve this issue is to use Android Studio AGP upgrade assistant.
To use select your top level build.gradle file in Android Studio then select
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To use select your top level build.gradle file in Android Studio then select
To use select your top-level `build.gradle` file in Android Studio then select

gradle you are running can handle. There is a non obvious set of dependencies
surrounding AGP, java, and gradle.

### Solution 1: Use Android Studio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Solution 1: Use Android Studio
### Solution 1: Android Studio

Tools -> AGP Upgrade Assistant.

### Solution 2: Command line
Run `flutter analyze --suggestion` to see if your AGP, Java and gradle versions are compatible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Run `flutter analyze --suggestion` to see if your AGP, Java and gradle versions are compatible.
Run `flutter analyze --suggestion` to see if your AGP, Java, and gradle versions are compatible.

### Solution 2: Command line
Run `flutter analyze --suggestion` to see if your AGP, Java and gradle versions are compatible.
If Gradle needs to be updated you can update it with `./gradlew wrapper --gradle-version=SOMEGRADLEVERSION`
where SOMEGRADLEVERSION is the version suggested by flutter analyze or newer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
where SOMEGRADLEVERSION is the version suggested by flutter analyze or newer.
where SOMEGRADLEVERSION is the version (you can use a newer version)
suggested by `flutter analyze`.

Comment on lines +102 to +105
To find the java version being used run `flutter doctor`
On a mac you can find the versions of java the OS knows about with `/usr/libexec/java_home -V`
To set the version of java that all flutter projects use run `flutter config --jdk-dir=SOMEJAVAPATH`
where SOMEJAVAPATH is a path to a java version like `/opt/homebrew/Cellar/openjdk@17/17.0.13/libexec/openjdk.jdk/Contents/Home`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To find the java version being used run `flutter doctor`
On a mac you can find the versions of java the OS knows about with `/usr/libexec/java_home -V`
To set the version of java that all flutter projects use run `flutter config --jdk-dir=SOMEJAVAPATH`
where SOMEJAVAPATH is a path to a java version like `/opt/homebrew/Cellar/openjdk@17/17.0.13/libexec/openjdk.jdk/Contents/Home`
To find the Java version being used run `flutter doctor`.
On a mac, you can find the Java versions that the OS knows about with `/usr/libexec/java_home -V`.
To set the version of Java that all flutter projects use run `flutter config --jdk-dir=SOMEJAVAPATH`
where SOMEJAVAPATH is a path to a Java version like `/opt/homebrew/Cellar/openjdk@17/17.0.13/libexec/openjdk.jdk/Contents/Home`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants