I have a flutter project I have been working to upgrade using Windows 10 and vsCode. The project was using flutter sdk 2.2.3 when I began. I successfully got it migrated (used migration tool, a small chunk of dart files at a time) and it built/ran/tested successfully.
My next step was to slowly advance the flutter sdk version. I moved to 2.5.1, and then to 2.8.1 and now 2.10.5 (the last stable version before 3.0.0). All three version upgrades were debugged to be error free (inside vsCode, the analyser shows 0 errors, 0 warnings, lots of informational messages). Both of these upgrade steps net me a “won’t build” situation, all three versions produce the same error message when I try to run main.dart (start debugging and run without debug).
During one of the upgrades, I had to upgrade gradle (went to gradle 7.3.3; last successful build was flutter 2.2.3 with gradle 6.5).
The failing build log looks as follows:
Launching libmain.dart on SM G970W in debug mode...
main.dart:1
FAILURE: Build failed with an exception.
* Where:
Build file 'C:CodemyProjectandroidappbuild.gradle' line: 78
* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':path_provider' could not be found in project ':app'.
* 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
BUILD FAILED in 4s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I have tried clearing things out before each build attempt, including
- removing the .gradle folder
- removing my package cache folder (found at C:Users*{my username}*AppDataLocalPub)
- “flutter clean / flutter pub cache repair / flutter pub get”
I tried updated the versions on the various dependency versions inside the androidbuild.gradle file, but the same build error persists before and after these updates. Here’s how the androidbuild.gradle file looks now:
buildscript {
ext.kotlin_version = '1.5.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.google.firebase:perf-plugin:1.4.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I also made similar dependency version updates in the android/app/build.gradle (with the same build error before and after the updates. the android/app/build.gradle currently looks like this:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '2'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.shortpencil.paladin.lotoshield"
minSdkVersion 19
targetSdkVersion 30
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// Recommended: Add the Firebase SDK for Google Analytics.
implementation 'com.google.firebase:firebase-analytics:19.0.0'
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:18.0.0'
// Add the dependency for the Performance Monitoring library
implementation 'com.google.firebase:firebase-perf:20.0.0'
// Add Cloud Messaging
implementation 'com.google.firebase:firebase-messaging:22.0.0'
// Add Google Play Services
implementation 'com.google.android.gms:play-services-basement:18.0.0'
implementation project(path: ':path_provider')
implementation project(path: ':firebase_core')
}
Any help you can provide on resolving this ‘:path_provider not found’ blocker would be amazing. I’ve been spinning on it for days.
Thanks!
PTA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.