android - 如何在尝试使用 GeckoView 时修复此错误“错误:找不到方法 compileOptions()”?
问题描述
我正在尝试使用 GeckoView 创建一个 android 应用程序,我使用以下链接作为参考:
https://mozilla.github.io/geckoview/consumer/docs/geckoview-quick-start
我按照示例中的方式执行所有操作,但出现以下错误:
错误:在 org.gradle.api.Project 类型的项目“:app”上找不到参数 [build_5wez28ua38x3wb7sd9hq4qbni$_run_closure4@7323414] 的方法 compileOptions()。
构建.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.gc"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
}
解决方案
该compileOptions
部分应该在该android
部分中。
android {
compileOptions {
...
}
}
推荐阅读
- php - 在 Union 中结合 Distinct 和 TOP 1 | SQL 服务器 2012
- spring - 如何使用实体管理器在休眠 3 中实施命名策略?
- informatica - to pass data is more sequential way
- c# - 是否有任何已知的方法来更改命名空间但支持 API 中的旧方法
- javascript - node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10) 中的错误:
- zurb-foundation - 未定义所需 JS 文件中的函数
- reactjs - 闪存消息测试因 react-testing-library / material-ui 失败
- c++ - x86 opencv 中的 hresult 0x80070008 内存资源不足错误
- java - 返回 ArrayList 项而不是布尔值
- java - 如何将一列数据附加到文本文件的末尾