Build failure for fresh project
vaishnavmhetre opened this issue · 14 comments
Howdy mate! Love your awesome wrapper for open-source map implementation.
The build failed with following stacktrace. No idea of the fix! It is a fresh project created for flutter with latest version (both flutter and your plugin).
Launching lib\main.dart on Mi Max 2 in debug mode...
lib\main.dart:1
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\mhetr\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_osm_plugin-0.4.7+3\android\build.gradle' line: 47
* What went wrong:
A problem occurred evaluating project ':flutter_osm_plugin'.
> Could not find method buildFeatures() for arguments [build_8hixj53buk134vkzq4463b2ue$_run_closure2$_closure9@1de153b1] on object of type com.android.build.gradle.LibraryExtension.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Found a stackoverflow fix for the issue!! Maybe if it helps...
did you update gradle version to 4.1.1 of your app
Could you please suggest the process? I'm using vscode and tried opening the project in Android studio, but didn't get a pop-up!!
Will changing classpath 'com.android.tools.build:gradle:3.5.0'
to classpath 'com.android.tools.build:gradle:4.4.1
work in android/build.gradle?
OK, so you need to make several steps
1-remove flutter_osm_plugin from pubspec, after that pub get
2- open android module in android studio ( right click in name of project -> flutter-> open android module in android studio)
3- update gradle version to 4.1.1 ( IDE will show popup to make update)
4- update kotlin version to 1.4.21 & re-build the project
5- re-add flutter_osm_plugin in pubspec , pub get ( or flutter clean & pub get )
Yeah, tried opening, but never got update popup for gradle!!
ok change it manually
in build.gradle(project) change 3.5.0 to 4.1.1
in gradle/wrapper/gradle-wrapper.properties change distributionURL to this
https://services.gradle.org/distributions/gradle-6.5-bin.zip
and sync gradle
Okay, manual changes worked. Kotlin version upgrade required right?
yeah update it to 1.4.21
Okay. in progress. I would really suggest you to put these things in Installations docs. reason being that the default flutter app comes with low versioned packages by default, so almost every user faces this!
Got this error after updating both while Gradle Sync
This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.1 or newer.
Checked plugin updates, and IDE updates, no updates available.
what'sversion of android studio that you currently used !
Android Studio 4.0.2
Build #AI-193.6911.18.40.6821437, built on September 9, 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: 1246M
Cores: 4
Registry: ide.new.welcome.screen.force=true, ide.balloon.shadow.size=0
Non-Bundled Plugins: Dart, org.jetbrains.kotlin, com.chrisrm.idea.MaterialThemeUI, com.cjamcu.getx-snippets, com.google.services.firebase, io.flutter
Although I Run the app as is. and it built successfully.
you need AS 4.1.1
great, i will add those instruction in readme