android studio gradle中的实现错误

pinkon5k  于 2023-01-31  发布在  Android
关注(0)|答案(1)|浏览(235)

我是安卓初学者,我想在'top.fighter-lee:mqttlibs:1.0.1'(github)中实现文件,但我得到了错误。
有什么解决办法吗?我想知道错误的原因。它说它找不到这个文件。那么,这是顶部。finghter-lee:mqttlibs:1.0.1不再服务?
我为我缺乏英语能力提前道歉。
构建输出监视器

> Task :app:clean
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :app:javaPreCompileDebug
> Task :app:checkDebugAarMetadata FAILED
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:mergeDebugResources FAILED
> Task :app:packageDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:parseDebugLocalResources
> Task :app:extractDeepLinksDebug
> Task :app:processDebugMainManifest FAILED
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets FAILED
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:mergeDebugJavaResource FAILED
> Task :app:checkDebugDuplicateClasses FAILED
> Task :app:desugarDebugFileDependencies FAILED
> Task :app:mergeDebugJniLibFolders
> Task :app:mergeDebugNativeLibs FAILED
> Task :app:validateSigningDebug
> Task :app:writeDebugAppMetadata
> Task :app:writeDebugSigningConfigVersions

FAILURE: Build completed with 8 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find top.fighter-lee:mqttlibs:1.0.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/top/fighter-lee/mqttlibs/1.0.1/mqttlibs-1.0.1.pom
       - https://repo.maven.apache.org/maven2/top/fighter-lee/mqttlibs/1.0.1/mqttlibs-1.0.1.pom
     Required by:
         project :app

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 31s
21 actionable tasks: 21 executed

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
}

建筑坡度

plugins {
    id 'com.android.application'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.mqtttest01"
        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
    }
}

dependencies {
    implementation **'top.fighter-lee:mqttlibs:1.0.1'**
    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'
}

我想在top中使用API。fighter-lee:mqttlibs:1.0.1 '(github)

mzillmmw

mzillmmw1#

根据MVN repository站点,您所引用的库存储在Spring Plugins存储库https://repo.spring.io/plugins-release/中。
这意味着您必须在根项目的build.gradle文件中添加以下部分:

buildscript {
    repositories {
        maven { url 'https://repo.spring.io/plugins-release/' }
    }
}

如果现在重新生成项目,则可以成功下载库。
根据您的项目结构,您甚至可以在settings.gradle文件中添加maven语句:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
        maven { url 'https://repo.spring.io/plugins-release/' }
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://repo.spring.io/plugins-release/' }
    }
}

希望这能帮上忙

相关问题