我正在关注 GeckoView 快速入门指南:https ://mozilla.github.io/geckoview/consumer/docs/geckoview-quick-start或https://wiki.mozilla.org/Mobile/GeckoView
所以我在 Android Studio 中创建了一个新项目,空活动,API 18,并在 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}"
}
这在布局中
<org.mozilla.geckoview.GeckoView
android:id="@+id/geckoview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
这在我的活动中:
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...
但我收到此错误:
错误:无法为 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象获取未知属性“geckoviewChannel”。
并且谷歌没有搜索它的结果....
只是从指南中复制几行,我觉得很愚蠢,但无论如何......我做错了什么?