website icon indicating copy to clipboard operation
website copied to clipboard

Set Android settings.gradle migration doc references to acceptable values

Open dnfield opened this issue 1 year ago • 9 comments

https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply

Specficially https://github.com/flutter/website/blob/b9d43e2d0c5d6fb0b16e65112cd41acc4f9c58e1/src/release/breaking-changes/flutter-gradle-plugin-apply.md?plain=1#L36

The project I'm working on has no previous values for these. I've tried copying the values from another project that does work and it seems to work, although now I get Java heap space errors from Gradle .... which I know how to fix or did at one point :)

@reidbaker fyi, since this applies to Android and Gradle.

dnfield avatar Jan 09 '24 20:01 dnfield

@bartekpacia fyi

reidbaker avatar Jan 09 '24 20:01 reidbaker

My guess is heap errors are either that your Java and gradle versions are not compatible or are because you need to increase your grade heap size. I think most of our flutter projects set it to 4g.

reidbaker avatar Jan 09 '24 20:01 reidbaker

My guess is heap errors are either that your Java and gradle versions are not compatible or are because you need to increase your grade heap size. I think most of our flutter projects set it to 4g.

Yes, I'm on an old project where the default was 1536mb, putting it to 4g worked.

dnfield avatar Jan 09 '24 20:01 dnfield

The project I'm working on has no previous values for these.

I understand missing dependency on Kotlin (project was Java-only), but missing dependency on AGP? How did it work?

of course I'm happy to update the migration docs but I'd like to know more

Re heap errors: I'll update migration guide with this info as well, thanks

bartekpacia avatar Jan 09 '24 22:01 bartekpacia

I don't know where an AGP version was defined at all in the project. What string should I be looking for?

dnfield avatar Jan 09 '24 23:01 dnfield

android/build.gradle > buildscript {} block > look for classpath 'com.android.tools.build:gradle.

For example in the following android/build.gradle:

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

// omitted more code

the AGP (Android Gradle Plugin) version is 7.3.0

In this issue I gathered how Gradle buildscripts look like in all recent Flutter versions. You probably want to migrate from the "Flutter 3.10" to "Flutter 3.16/Flutter master".

bartekpacia avatar Jan 10 '24 12:01 bartekpacia

We could also link to this

bartekpacia avatar Jan 13 '24 20:01 bartekpacia

@dnfield : What change do you want made to the docs? That is unclear from this thread. Can you summarize?

atsansone avatar Jan 16 '24 16:01 atsansone

@dnfield : What change do you want made to the docs? That is unclear from this thread. Can you summarize?

How to determine the value to put in {agpVersion}. I think what @bartekpacia wrote is probably the right way.

dnfield avatar Jan 17 '24 20:01 dnfield