简体   繁体   English

运行项目时出错:找不到 swiperrefreshlayout.jar (androidx.swiperrefreshlayout:swiperrefreshlayout:1.0.0)

[英]error in running project: Could not find swiperefreshlayout.jar (androidx.swiperefreshlayout:swiperefreshlayout:1.0.0)

I am trying to install react-native-screens in my project.我正在尝试在我的项目中安装 react-native-screens。 I installed it without any problem but when i want to run the app, the following problem will occur:我安装它没有任何问题,但是当我想运行该应用程序时,会出现以下问题:

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

package.json:包.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" } }

Dependencies in app/build.gradle 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
}

}

I have tried all the steps according to reactnavigation.org which requires react-native-screens.我已经根据需要 react-native-screens 的 reactnavigation.org 尝试了所有步骤。

If your Gradle version is lower than 4.1 for getting google's maven repositories you should use如果您的 Gradle 版本低于 4.1 以获取 google 的 maven 存储库,您应该使用

maven {
    url 'https://maven.google.com'
}

instead of google() in top-level build.gradle而不是顶级 build.gradle 中的google()

you could check the version of your Gradle in classpath dependencies in your top-level build.gradle您可以在顶级 build.gradle 的类路径依赖项中检查您的 Gradle 版本

from developers.android.com's google maven :来自developers.android.com的谷歌maven

 // If you're using a version of Gradle lower than 4.1, you must instead use: // maven { // url 'https://maven.google.com' // } // An alternative URL is 'https://dl.google.com/dl/android/maven2/'

just turn on your VPN in restricted countries !!!只需在受限制的国家/地区打开您的 VPN 即可!!! thats all就这样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM