当前位置: 首页 > 知识库问答 >
问题:

错误:无法在libgdx build.gradle上解析:com . firebase ui:firebase-ui-auth:1 . 2 . 0

燕涵容
2023-03-14

我正试图在我的游戏上添加一个谷歌登录。为此,我决定使用firebase ui(https://github . com/firebase/firebase ui-Android)。但是我无法同步我的毕业档案。我正在接收错误:错误:无法解析:com . firebase ui:firebase-ui-auth:1 . 2 . 0

这是我的build.gradle(项目)

 buildscript {
        repositories {
            mavenLocal()
            mavenCentral()
            maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
            maven { url 'https://maven.fabric.io/public'}
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.2'
            classpath 'com.google.gms:google-services:3.1.0'
        }
    }

    allprojects {
        apply plugin: "eclipse"
        apply plugin: "idea"

        version = '1.0'
        ext {
            appName = "mystore"
            gdxVersion = '1.9.6'
            roboVMVersion = '2.3.1'
            box2DLightsVersion = '1.4'
            ashleyVersion = '1.7.0'
            aiVersion = '1.8.0'
        }

        repositories {
            mavenLocal()
            mavenCentral()
            maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
            maven { url "https://oss.sonatype.org/content/repositories/releases/" }
            maven { url 'https://maven.fabric.io/public'}
        }
    }

    project(":android") {
        apply plugin: "android"

        configurations { natives }

        dependencies {
            compile project(":core")
            compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
            compile "com.firebaseui:firebase-ui-auth:1.2.0" // Failed to resolve
        }
    }

    project(":core") {
        apply plugin: "java"


        dependencies {
            compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        }
    }

    tasks.eclipse.doLast {
        delete ".project"
    }

这是我的身材。grade(模块:android)

android {
    buildToolsVersion "25.0.3"
    compileSdkVersion 25
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        instrumentTest.setRoot('tests')
    }
    packagingOptions {
        exclude 'META-INF/robovm/ios/robovm.xml'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
    defaultConfig {
        applicationId "br.com.edney.mystore"
        minSdkVersion 16
        targetSdkVersion 25
    }
}


// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
task copyAndroidNatives() { 
    file("libs/armeabi/").mkdirs();
    file("libs/armeabi-v7a/").mkdirs();
    file("libs/arm64-v8a/").mkdirs();
    file("libs/x86_64/").mkdirs();
    file("libs/x86/").mkdirs();

    configurations.natives.files.each { jar ->
        def outputDir = null
        if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
        if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")        
        if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
        if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
        if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
        if(outputDir != null) {
            copy {
                from zipTree(jar)
                into outputDir
                include "*.so"
            }
        }
    }
}

task run(type: Exec) {
    def path
    def localProperties = project.file("../local.properties")
    if (localProperties.exists()) {
        Properties properties = new Properties()
        localProperties.withInputStream { instr ->
            properties.load(instr)
        }
        def sdkDir = properties.getProperty('sdk.dir')
        if (sdkDir) {
            path = sdkDir
        } else {
            path = "$System.env.ANDROID_HOME"
        }
    } else {
        path = "$System.env.ANDROID_HOME"
    }

    def adb = path + "/platform-tools/adb"
    commandLine "$adb", 'shell', 'am', 'start', '-n', 'br.com.mystore/br.com.mystore.AndroidLauncher'
}

// sets up the Android Eclipse project, using the old Ant based build.
eclipse {
    // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
    // ignores any nodes added in classpath.file.withXml
    sourceSets {
        main {
            java.srcDirs "src", 'gen'
        }
    }

    jdt {
        sourceCompatibility = 1.6
        targetCompatibility = 1.6
    }

    classpath {
        plusConfigurations += [ project.configurations.compile ]        
        containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'       
    }

    project {
        name = appName + "-android"
        natures 'com.android.ide.eclipse.adt.AndroidNature'
        buildCommands.clear();
        buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
        buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
        buildCommand "org.eclipse.jdt.core.javabuilder"
        buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
    }
}

// sets up the Android Idea project, using the old Ant based build.
idea {
    module {
        sourceDirs += file("src");
        scopes = [ COMPILE: [plus:[project.configurations.compile]]]        

        iml {
            withXml {
                def node = it.asNode()
                def builder = NodeBuilder.newInstance();
                builder.current = node;
                builder.component(name: "FacetManager") {
                    facet(type: "android", name: "Android") {
                        configuration {
                            option(name: "UPDATE_PROPERTY_FILES", value:"true")
                        }
                    }
                }
            }
        }
    }
}
apply plugin: "com.google.gms.google-services"

共有3个答案

楚博雅
2023-03-14

通过用依赖项中的编译替换实现,解决了我的问题

之前:实现“com . firebase ui:firebase-ui-auth:1 . 2 . 0”

之后:编译'com.firebaseui:firebase ui auth:1.2.0'

司寇祖鹤
2023-03-14

在您的< code>app/build.gradle文件中添加对其中一个库的依赖项。

dependencies {
    // FirebaseUI Database only
    compile 'com.firebaseui:firebase-ui-database:1.2.0'

    // FirebaseUI Auth only
    compile 'com.firebaseui:firebase-ui-auth:1.2.0'

    // FirebaseUI Storage only
    compile 'com.firebaseui:firebase-ui-storage:1.2.0'

    // Single target that includes all FirebaseUI libraries above
    compile 'com.firebaseui:firebase-ui:1.2.0'
}

您需要在项目级别梯度上配置firebase。

buildscript {

    dependencies {
        // Add Classpath here..
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

还在最后一行(gradle代码底部)的应用程序模块gradle中添加插件。

apply plugin: 'com.google.gms.google-services'

别忘了添加<code>谷歌服务。json</code>文件位于app文件夹中。你可以从https://console.firebase.google.com

彭弘方
2023-03-14

通过root build.gradle将< code>firebase-ui-auth工件注入android模块没有问题。

将< code>jcenter()添加到所有项目的存储库中

repositories {
     mavenLocal()
     mavenCentral()
     maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
     maven { url "https://oss.sonatype.org/content/repositories/releases/" }
     maven { url 'https://maven.fabric.io/public'}
     jcenter()
}

同步

 类似资料:
  • 我第一次尝试使用podman(在Mac操作系统下使用,但这可能无关紧要)。当我尝试将busybox映像作为测试启动时,如引言中所述: 我得到以下错误: (podman版本3.3.1)

  • 我是JSF和PrimeFaces的新手(也是stackoverflow的新手),遇到了一个配置/部署问题。我使用的是PrimeFaces 5.0、Tomcat 7.0.55和JSF2.2。JSF标记可以解析并工作,但PrimeFaces标记没有解析并产生此错误。 以下是网页: 错误消息为:org.apache.jasper.jasperException:绝对URI:http://primefac

  • 我试图使用Jenkins构建一个maven项目,结果出现了以下错误,整个构建失败了。Maven成功地从GIT中提取代码并进行处理。但POM误差无法纠正。请帮帮我.

  • 同步项目在开始时失败,我无法修复它。错误是gradle无法解析此依赖项。 知道怎么修好它吗?

  • 我对Android的Gradle构建有问题。我尝试了很多方法来解决这个问题,但没有什么不起作用。我需要帮助。 Gradle版本:4.4 Gradle插件:3.0.1 错误:无法解析app@serverDebug /compileClasspath的依赖关系:无法解析项目:vksdk_library。 错误:无法解析“”的依存关系:app@mockDebugAndroidTest/compileCl

  • 问题内容: 我正在尝试部署一个曾经可以运行的运行时,但是最近我遇到了:错误。 我的内容什么都没有改变,并且错误消息也无法帮助您理解问题所在。我与运行它并得到: 任何建议都是有用的,我也尝试过,我轮换了凭据,没有用。我的用户具有角色,但我单独添加了所有可能需要的角色 问题答案: 尝试在项目中禁用和启用Cloud Build API,以便创建一个新的服务帐户,然后尝试再次进行部署。 这样可以确保Clo