我试图在android应用中实现geckoview。我的项目只是android studio菜单中的空活动。
build.gradle(:app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.vast.myapplication34"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
ext {
geckoviewChannel = "nightly"
geckoviewVersion = "100.0.20220308100756"
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
}Settings.gradle(我的Application34):
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven {
url "https://maven.mozilla.org/maven2/"
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "My Application34"
include ':app'我得到了一个错误:Failed to resolve: org.mozilla.geckoview:geckoview-nightly:100.0.20220308100756 Show in Project Structure dialog Affected Modules: app
发布于 2022-09-26 21:00:41
解决了- maven url应该在dependencyResolutionManagement而不是pluginManagement下。
就像这样:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven {
url "https://maven.mozilla.org/maven2/"
}
google()
mavenCentral()
}
}https://stackoverflow.com/questions/73858178
复制相似问题