gradle 无法从现有项目运行Android Studio模拟器

8dtrkrch  于 2023-04-30  发布在  Android
关注(0)|答案(1)|浏览(268)

我是应用程序开发的新手,不久前才开始实习,我目前正在做一个现有的项目,我一直在尝试在android studio上构建和运行它,但它一直给我错误信息。已经好几天了,我不知道还能做什么,
下面是我键入的错误信息
在Android上运行

info Opening the app on Android...
info JS server already running.
info Launching emulator...
info Installing the app...

> Configure project :app
##############################

Using react.gradle in your project is deprecated! You should move to "apply plugin: com.facebook.react"
react.gradle is going to be removed in a future React Native project and your project will not build anymore.
You can use the template as a reference:
https://github.com/facebook/react-native/blob/main/template/android/app/build.gradle

##############################
WARNING:DSL element 'dexOptions' is obsolete and should be removed.
It will be removed in version 8.0 of the Android Gradle plugin.
Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :libs:SalesforceReact.
     Required by:
         project :app
      > No matching configuration of project :libs:SalesforceReact was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:react-native-camera' with value 'general', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.4.0' but:
          - None of the consumable configurations have attributes.

* 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 10s

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :libs:SalesforceReact.
     Required by:
         project :app
      > No matching configuration of project :libs:SalesforceReact was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:react-native-camera' with value 'general', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.4.0' but:
          - None of the consumable configurations have attributes.

* 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 10s

    at makeError (C:\Users\...\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
    at C:\Users\...\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (C:\Users\...\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
    at async Command.handleAction (C:\Users\...\node_modules\@react-native-community\cli\build\index.js:108:9)
info Run CLI with --verbose flag for more details.

下面是构建的代码。grad勒
enter image description hereenter image description here
我已经更新了所有依赖的版本,以及改变

配置。compile =〉configurations.实现我存在IDE窗口。从androidStudio和所选设置打开项目。Gradle

它仍然给我相同的错误消息当我做npm启动
我不知道发生了什么事,如果有人能帮忙,我将不胜感激!谢谢大家!

axzmvihb

axzmvihb1#

只需从android/App/build中注解掉或删除这一行。gradle // apply from:“../../node_modules/react-native/react.Gradle”

相关问题