I have upgraded my android studio version to
Android Studio Iguana | 2023.2.1 Canary 6
Build #AI-232.9921.47.2321.10875067, built on September 28, 2023
Runtime version: 17.0.8+0-17.0.8b1000.22-10799086 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.6.1
GC: G1 Young Generation, G1 Old Generation
Memory: 5120M
Cores: 12
Metal Rendering is ON
Registry:
external.system.auto.import.disabled=true
debugger.new.tool.window.layout=true
ide.text.editor.with.preview.show.floating.toolbar=false
ide.instant.shutdown=false
ide.experimental.ui=true
ide.images.show.chessboard=true
Non-Bundled Plugins:
com.github.rmehri01.onenord (0.0.7)
com.arcticicestudio.nord.jetbrains (0.13.0)
and the AGP to version 8.3.0-alpha06
now my build fails on these two lines
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
val googleApiKey: String = gradleLocalProperties(rootDir).getProperty("GOOGLE_API_KEY")
val googleCrashReportingApiKey: String = gradleLocalProperties(rootDir).getProperty("GOOGLE_CRASH_REPORTING_API_KEY")
* What went wrong:
Script compilation errors:
Line 16: val googleApiKey: String = gradleLocalProperties(rootDir).getProperty("GOOGLE_API_KEY")
^ No value passed for parameter 'providers'
Line 17: val googleCrashReportingApiKey: String = gradleLocalProperties(rootDir).getProperty("GOOGLE_CRASH_REPORTING_API_KEY")
^ No value passed for parameter 'providers'
2 errors
Im guessing rootDir is null, however how do I resolve this issue?
What is the root cause?
I have now upgraded to Canary 7 and i get this issue when attempting to upgrade the AGP

I fixed this issue by replacing with
val properties = Properties().apply { load(FileInputStream(File(rootProject.rootDir, "local.properties"))) }
val googleApiKey: String = properties.getProperty("GOOGLE_API_KEY")
val googleCrashReportingApiKey: String = properties.getProperty("GOOGLE_CRASH_REPORTING_API_KEY")
I fixed the problem by replacing this:
gradleLocalProperties(rootDir).getProperty("GOOGLE_API_KEY")
By adding the providers parameter like this:
gradleLocalProperties(rootDir, providers).getProperty("GOOGLE_API_KEY")
starting with com.android.application 8.3.0 we need to add providers field
gradleLocalProperties(rootDir, providers).apply {
storePassword = getProperty("storePwd")
keyAlias = getProperty("keyAlias")
keyPassword = getProperty("keyPwd")
}
and resync your project (don't need to create this filed)
p.s. NEED TO IGNORE THE ERROR BEFORE THE RESYNC
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With