【发布时间】:2022-12-20 22:13:03
【问题描述】:
我的应用程序运行良好,我只是在我的代码中添加了日历图标和日期选择器:
import React, {useState, useContext} from 'react';
import {View, Text,StyleSheet,ScrollView,TouchableOpacity,
Button,
Platform,
TextInput} from 'react-native';
import {AuthContext} from '../context/AuthContext';
import { BASE_URL } from '../utils/config';
import Ionicons from 'react-native-vector-icons/Ionicons';
import DatePicker from 'react-native-date-picker';
import Constants from "expo-constants";
import CustomButton from '../components/CustomButton'
import axios from "axios";
它工作正常,但后来我忘记了我做了什么,应用程序不再工作,模拟器也没有打开我的应用程序。 这是我运行应用程序时的响应:
>react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:10340) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 2800 file(s) to forward-jetify. Using 12 workers...
info JS server already running.
info Installing the app...
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'android29(AVD) - 10' for app:debug
Installed on 1 device.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 8s
154 actionable tasks: 4 executed, 150 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.reactnavigationv6/.MainActivity }
当我运行 react-native info 时,我有这样的回应:
System:
OS: Windows 10 10.0.19044
CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz
Memory: 1.91 GB / 15.71 GB
Binaries:
Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.12.2 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: AI-212.5712.43.2112.8609683
Languages:
Java: 11.0.15
Python: 3.9.11
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: ^0.63.2 => 0.63.2
npmGlobalPackages:
*react-native*: Not Found
当我尝试使用 npm 安装软件包时出现此错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: reactnavigationv6@0.0.1
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"16.13.1" from react-native@0.63.4
npm ERR! node_modules/react-native
npm ERR! react-native@"^0.63.2" from the root project
npm ERR! peer react-native@"*" from @react-native-community/cli@8.0.2
npm ERR! node_modules/@react-native-community/cli
npm ERR! @react-native-community/cli@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\ghars\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ghars\AppData\Local\npm-cache\_logs\2022-06-22T17_29_53_171Z-debug-0.log
有人可以帮我解决这个问题吗?
【问题讨论】:
-
您是否尝试过运行
npx react-native-clean-project并删除所有 Android 构建缓存?也可以尝试从设备上卸载该应用程序并重新构建。 -
它没有用,这是运行 android 后的输出:FAILURE: Build failed with an exception。 * 出了什么问题:任务 ':app:checkDebugAarMetadata' 执行失败。 > 执行 com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction 时发生故障 > 在依赖项的 AAR 元数据 (META-INF/com/android/build/gradle/aar-metadata.properties) 中指定的 minCompileSdk (31)大于此模块的 compileSdkVersion (android-30)。依赖项:androidx.appcompat:appcompat:1.4.1。
-
你以前保存过可以返回的版本吗(比如在 Git 或类似的东西上)?如果您可以返回到可用的版本,则可以检查当前版本中的差异。您的新错误消息看起来像您有一个需要更高 compileSdkVersion 的依赖项 - 您可以尝试在 build.gradle 中将其更改为错误提示的内容。
标签: android react-native npm ionicons