Search code examples
androidgradlegeckoview

Failed to resolve: org.mozilla.geckoview


Im trying to implement geckoview into android app. My project is just empty activiy from android studio menu

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(My 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'

im trying to implement https://maven.mozilla.org/?prefix=maven2/org/mozilla/geckoview/geckoview-nightly/100.0.20220308100756/

And i get this error: Failed to resolve: org.mozilla.geckoview:geckoview-nightly:100.0.20220308100756 Show in Project Structure dialog Affected Modules: app


Solution

  • SOLVED- maven url should be under dependencyResolutionManagement not pluginManagement

    like this:

    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            maven {
                url "https://maven.mozilla.org/maven2/"
            }
            google()
            mavenCentral()
        }
    }