无法在模拟器上运行react-native android(Androidx问题)

发布于 2025-01-09 21:16:04 字数 5263 浏览 1 评论 0原文

我退出世博会后遇到了这个问题。我制作了一个新应用程序并正在移动数据。当我安装react-native-screen 和react-native-gesture-handler 时,问题就开始了。这是终端的结果:

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find androidx.cardview:cardview:1.0.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom     
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom
       - https://repo.maven.apache.org/maven2/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom
       - https://www.jitpack.io/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom
     Required by:
         project :app > project :react-native-screens > com.google.android.material:material:1.1.0
   > Could not find androidx.recyclerview:recyclerview:1.0.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
       - https://repo.maven.apache.org/maven2/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
       - https://www.jitpack.io/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
     Required by:
         project :app > project :react-native-screens > com.google.android.material:material:1.1.0
   > Could not find androidx.transition:transition:1.2.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/transition/transition/1.2.0/transition-1.2.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/transition/transition/1.2.0/transition-1.2.0.pom   
       - https://repo.maven.apache.org/maven2/androidx/transition/transition/1.2.0/transition-1.2.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/transition/transition/1.2.0/transition-1.2.0.pom
       - https://www.jitpack.io/androidx/transition/transition/1.2.0/transition-1.2.0.pom
     Required by:
         project :app > project :react-native-screens > com.google.android.material:material:1.1.0
   > Could not find androidx.viewpager2:viewpager2:1.0.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom   
       - https://repo.maven.apache.org/maven2/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom
       - https://www.jitpack.io/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom
     Required by:
         project :app > project :react-native-screens > com.google.android.material:material:1.1.0
   > Could not find androidx.annotation:annotation-experimental:1.1.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
       - https://repo.maven.apache.org/maven2/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom      
       - https://dl.google.com/dl/android/maven2/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom   
       - https://www.jitpack.io/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
     Required by:
         project :app > project :react-native-screens > androidx.fragment:fragment:1.3.4
   > Could not find androidx.annotation:annotation-experimental:1.1.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
       - https://repo.maven.apache.org/maven2/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom      
       - https://dl.google.com/dl/android/maven2/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom   
       - https://www.jitpack.io/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
     Required by:
         project :app > androidx.swiperefreshlayout:swiperefreshlayout:1.0.0 > androidx.core:core:1.6.0

我尝试下载其中一些文件,但他们不断要求提供更多文件。

I faced this issues after i ejected expo. i made a new app and im moving data. the problem starts when i install react-native-screen and react-native-gesture-handler. here is result of terminal :

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find androidx.cardview:cardview:1.0.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom     
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom
       - https://repo.maven.apache.org/maven2/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom
       - https://www.jitpack.io/androidx/cardview/cardview/1.0.0/cardview-1.0.0.pom
     Required by:
         project :app > project :react-native-screens > com.google.android.material:material:1.1.0
   > Could not find androidx.recyclerview:recyclerview:1.0.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
       - https://repo.maven.apache.org/maven2/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
       - https://www.jitpack.io/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.pom
     Required by:
         project :app > project :react-native-screens > com.google.android.material:material:1.1.0
   > Could not find androidx.transition:transition:1.2.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/transition/transition/1.2.0/transition-1.2.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/transition/transition/1.2.0/transition-1.2.0.pom   
       - https://repo.maven.apache.org/maven2/androidx/transition/transition/1.2.0/transition-1.2.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/transition/transition/1.2.0/transition-1.2.0.pom
       - https://www.jitpack.io/androidx/transition/transition/1.2.0/transition-1.2.0.pom
     Required by:
         project :app > project :react-native-screens > com.google.android.material:material:1.1.0
   > Could not find androidx.viewpager2:viewpager2:1.0.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom   
       - https://repo.maven.apache.org/maven2/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom
       - https://www.jitpack.io/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom
     Required by:
         project :app > project :react-native-screens > com.google.android.material:material:1.1.0
   > Could not find androidx.annotation:annotation-experimental:1.1.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
       - https://repo.maven.apache.org/maven2/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom      
       - https://dl.google.com/dl/android/maven2/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom   
       - https://www.jitpack.io/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
     Required by:
         project :app > project :react-native-screens > androidx.fragment:fragment:1.3.4
   > Could not find androidx.annotation:annotation-experimental:1.1.0.
     Searched in the following locations:
       - file:/D:/%projectpath%/node_modules/react-native/android/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
       - file:/D:/%projectpath%/node_modules/jsc-android/dist/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
       - https://repo.maven.apache.org/maven2/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom      
       - https://dl.google.com/dl/android/maven2/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom   
       - https://www.jitpack.io/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
     Required by:
         project :app > androidx.swiperefreshlayout:swiperefreshlayout:1.0.0 > androidx.core:core:1.6.0

i tried downloading some of them but they keep ask for more files.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘿哥们儿 2025-01-16 21:16:04

解决方案1:删除gradle中所有缓存的文件夹并构建新项目。

解决方案2:android/build.gradle

compileSdkVersion = 31

解决方案3:如果不想升级到sdk 31,请在android/app/build.gradle中添加

android {
    ...
    defaultConfig {
        ...
        configurations.all {
            resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }
        }
    }
}

solution 1: deleted all the cached folders in gradle and build new project.

solution 2: android/build.gradle

compileSdkVersion = 31

solution 3: If you don't want to upgrade to sdk 31, add in android/app/build.gradle

android {
    ...
    defaultConfig {
        ...
        configurations.all {
            resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文