首页 > 解决方案 > 如何解决创建签名 APK 文件的问题?

问题描述

我想在 Google Play 商店中发布我的应用程序,但我未能创建所需的“app-release.apk”。我得到的错误如下:

找不到 org.jetbrains.trove4j:trove4j:20160824。在以下位置搜索:

    file:/C:/Users/Albrecht/AppData/Local/Android/Sdk/extras/m2repository/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    file:/C:/Users/Albrecht/AppData/Local/Android/Sdk/extras/m2repository/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
    file:/C:/Users/Albrecht/AppData/Local/Android/Sdk/extras/google/m2repository/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    file:/C:/Users/Albrecht/AppData/Local/Android/Sdk/extras/google/m2repository/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
    file:/C:/Users/Albrecht/AppData/Local/Android/Sdk/extras/android/m2repository/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    file:/C:/Users/Albrecht/AppData/Local/Android/Sdk/extras/android/m2repository/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
    file:/C:/Users/Albrecht/.m2/repository/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    file:/C:/Users/Albrecht/.m2/repository/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
    https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
    https://oss.sonatype.org/content/repositories/snapshots/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    https://oss.sonatype.org/content/repositories/snapshots/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
    https://oss.sonatype.org/content/repositories/releases/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    https://oss.sonatype.org/content/repositories/releases/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
    https://maven.google.com/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    https://maven.google.com/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
Required by:
    project :android > com.android.tools.lint:lint-gradle:26.1.4 > com.android.tools.external.com-intellij:intellij-core:26.1.4

我的 build.gradle 文件:

buildscript {


    repositories {
        mavenLocal()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://maven.google.com" }
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:3.2.1'

    }
}

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

    version = '1.0'
    ext {
        appName = "ShapeRecognisingGame"
        gdxVersion = '1.9.8'
        roboVMVersion = '2.3.3'
        box2DLightsVersion = '1.4'
        ashleyVersion = '1.7.3'
        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.google.com" }
    }
}

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


    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"

    }
}

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

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        compile "com.google.android.gms:play-services-ads:15.0.1"

        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.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
    }
}

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


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"

    }
}

我已经检查了这个错误的其他几个解决方案。但是,它们都不适合我。

标签: androidpublish

解决方案


我也遇到了错误,LibGDX 也是如此。使用 LibGDX 签名的 Android Studio APK 似乎依赖于这个库,并且无法使用默认设置解决它。经过一番努力,似乎有帮助的是文件 - 设置 - 构建、执行、部署 - Gradle - Android Studio - 启用嵌入式 Maven 存储库。

在此处输入图像描述

顺便说一句,创建新的“捆绑包”而不是 APK 开箱即用,没有问题。


推荐阅读