-
Notifications
You must be signed in to change notification settings - Fork 553
[Android gradle 8.x] Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. #993
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
Comments
Do you have any solution for this problem? I meet same problem when use flutter with unity. |
The relevant part of your error is
When using Gradle 8.x you are required to have a namespace definition in your build.gradle files to compile the project. Current status
Unity workaround
Use the new 2022.3.0 unitypackage, or use the latest build.cs script from the unity example in the master branch. Fluter workaround 1
So if you import the plugin in your pubspec.yaml from a git url instead of pub.dev, it should be fixed on the plugin side.
Another alternative would be to try the experimental Unity 6 support Flutter workaround 2Override the gradle setting of the plugin in your build.gradle to add the namespace property. //<flutter project>/android/build.gradle
// make sure this is above any use of "evaluationDependsOn"
subprojects {
afterEvaluate {
if (project.plugins.hasPlugin("com.android.application")
|| project.plugins.hasPlugin("com.android.library")) {
if (project.name == "flutter_unity_widget") {
// override settings in the plugin
project.android {
// add namespace if it is missing
if (namespace == null) {
namespace = project.group
}
}
}
}
}
} |
Thanks |
Launching lib\main.dart on moto g45 5G in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
A problem occurred configuring project ':flutter_unity_widget'.
BUILD FAILED in 3s
Error: Gradle task assembleDebug failed with exit code 1
The text was updated successfully, but these errors were encountered: