Diego
Diego

Reputation: 649

Could not get unknown property 'geckoviewChannel' for object of type

I am following the GeckoView quick start guide : https://mozilla.github.io/geckoview/consumer/docs/geckoview-quick-start or https://wiki.mozilla.org/Mobile/GeckoView

So I created a new project in Android Studio, empty activity, API 18, and added these lines in build.gradle :

ext {
        geckoviewChannel = "nightly"
        geckoviewVersion = "70.0.20190712095934"
}

repositories {
        maven {
                url "https://maven.mozilla.org/maven2/"
        }
}

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
}

dependencies {
        // ...
    implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"   
}

this in the layout

<org.mozilla.geckoview.GeckoView
        android:id="@+id/geckoview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

and this in my activity :

import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;

in oncreate :
GeckoView view = findViewById(R.id.geckoview);
GeckoSession session = new GeckoSession();
GeckoRuntime runtime = GeckoRuntime.create(this);

session.open(runtime);
view.setSession(session);
session.loadUri("about:buildconfig"); // Or any other URL...

But I am getting this error :

ERROR: Could not get unknown property 'geckoviewChannel' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

and google has no result searching for it....

I feel stupid getting an error just copying a few lines from a guide, but anyway... What did I do wrong ?

Upvotes: 2

Views: 842

Answers (1)

Diego
Diego

Reputation: 649

It was a very stupid error, but instead of deleting my question I will answer it myself, because another beginner may do the same stupid error one day.

The problem was that I added

ext {
        geckoviewChannel = "nightly"
        geckoviewVersion = "70.0.20190712095934"
}

at the bottom of the graddle file, after the dependencies in which we use ${geckoviewChannel} and ${geckoviewVersion}, so these were undefined.

Upvotes: 3

Related Questions