In my android studio project i have gradle.build file that looks exactly like
buildscript {
ext.kotlin_version = "1.3.72"
repositories {
google()
jcenter()
maven {
url "https://maven.mozilla.org/maven2/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
}
}
ext {
geckoviewChannel = "nightly"
geckoviewVersion = "85.0.20201121092754"
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
but on running ./gradlew
I got error that looks like
A problem occurred evaluating root project 'My Application'.
> Could not get unknown property 'geckoviewChannel' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
I see nothing missing or wrong here. What am I missing here.
Project properties
are not visible inside buildscript block which is evaluated first. A potential solution is to move ext block inside buildscript block.