首页 > 解决方案 > 运行项目时出错:找不到 swiperefreshlayout.jar (androidx.swiperefreshlayout:swiperefreshlayout:1.0.0)

问题描述

我正在尝试在我的项目中安装 react-native-screens。我安装它没有任何问题,但是当我想运行该应用程序时,会出现以下问题:

Executing tasks: [:app:assembleDebug] in project D:\Programming\Projects\Sharmarket\mobile app\v1.0.0\Sharmarket\android

Gradle Daemon started in 3 s 898 ms

    Task :app:generatePackageList
    Task :app:preBuild
    Task :react-native-screens:preBuild UP-TO-DATE
    Task :react-native-screens:preDebugBuild UP-TO-DATE
    Task :react-native-screens:checkDebugManifest UP-TO-DATE
    Task :react-native-screens:processDebugManifest UP-TO-DATE
    Task :app:preDebugBuild
    Task :react-native-screens:compileDebugAidl NO-SOURCE
    Task :app:compileDebugAidl NO-SOURCE
    Task :react-native-screens:packageDebugRenderscript NO-SOURCE
    Task :app:checkDebugManifest
    Task :app:compileDebugRenderscript NO-SOURCE
    Task :app:generateDebugBuildConfig
    Task :app:bundleDebugJsAndAssets SKIPPED
    Task :app:prepareLintJar UP-TO-DATE
    Task :app:generateDebugSources
    Task :react-native-screens:generateDebugBuildConfig UP-TO-DATE
    Task :react-native-screens:compileDebugRenderscript NO-SOURCE
    Task :react-native-screens:generateDebugResValues UP-TO-DATE
    Task :react-native-screens:generateDebugResources UP-TO-DATE
    Task :react-native-screens:packageDebugResources UP-TO-DATE
    Task :react-native-screens:generateDebugRFile UP-TO-DATE
    Task :react-native-screens:prepareLintJar UP-TO-DATE
    Task :react-native-screens:generateDebugSources UP-TO-DATE
    Task :react-native-screens:javaPreCompileDebug FAILED

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':react-native-screens:javaPreCompileDebug'.

    Could not resolve all files for configuration ':react-native-screens:debugCompileClasspath'.
    Could not find swiperefreshlayout.jar (androidx.swiperefreshlayout:swiperefreshlayout:1.0.0).
    Searched in the following locations:
    https://dl.google.com/dl/android/maven2/androidx/swiperefreshlayout/swiperefreshlayout/1.0.0/swiperefreshlayout-1.0.0.jar

    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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 23s
13 actionable tasks: 5 executed, 8 up-to-date

包.json:

{ "name": "Sharmarket", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "react": "16.9.0", "react-native": "0.61.5", "react-native-screens": "^2.2.0" }, "devDependencies": { "@babel/core": "^7.8.7", "@babel/runtime": "^7.8.7", "@react-native-community/eslint-config": "^0.0.7", "babel-jest": "^25.1.0", "eslint": "^6.8.0", "jest": "^25.1.0", "metro-react-native-babel-preset": "^0.58.0", "react-test-renderer": "16.9.0" }, "jest": { "preset": "react-native" } }

app/build.gradle 中的依赖

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'

if (enableHermes) {
    def hermesPath = "../../node_modules/hermes-engine/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
    implementation jscFlavor
}

}

我已经根据需要 react-native-screens 的 reactnavigation.org 尝试了所有步骤。

标签: androidreact-nativegradle

解决方案


只需在受限制的国家/地区打开您的 VPN !!!就这样


推荐阅读