提问人:Flacype 提问时间:11/7/2023 更新时间:11/7/2023 访问量:43
React-native更新项目给我错误:找不到com.swmansion:react-native-reanimated:3.5.4
React-native updating project gives me error : Could not find com.swmansion:react-native-reanimated:3.5.4
问:
我需要更新一个 2019 年编译的应用程序,以便使其在最后一个 Android 版本上运行。
我在 Windows 上使用 npm 和 react-native。你可以认为我是 react-native / gradle 的初学者。
我更新了所有的 npm 包。
我更新了 SDK 和 gradle / gradle 包装器版本。
当我尝试./gradlew bundleRelease时,我收到以下错误:
* What went wrong:
Could not determine the dependencies of task ':app:buildReleasePreBundle'.
> Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
> Could not find com.swmansion:react-native-reanimated:3.5.4.
Searched in the following locations:
- https://www.jitpack.io/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
- file:/********/android/node_modules/jsc-android/dist/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
- file:/*******/android/node_modules/react-native/android/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
- file:/*********/.m2/repository/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
- https://repo.maven.apache.org/maven2/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
- https://maven.google.com/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
- https://dl.google.com/dl/android/maven2/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
- https://oss.sonatype.org/content/repositories/snapshots/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
- file:/********/node_modules/jsc-android/dist/com/swmansion/react-native-reanimated/3.5.4/react-native-reanimated-3.5.4.pom
Required by:
project :app
* 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
(当然******是正确的文件路径)
我抬头一看,发现我必须在我的app/build.gradle中声明:
implementation "com.swmansion:react-native-reanimated:3.5.4"
所以我添加了它,但它没有改变任何东西。
这是我的android / build.gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 28
compileSdkVersion = 33
targetSdkVersion = 33
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "16.+"
androidMapsUtilsVersion = "0.5+"
// agp_version = '7.2.0'
agp_version = '8.1.1'
androidxAppcompatVersion = "1.3.0"
androidxAnnotationVersion = "1.3.0"
androidxCoreVersion = "1.7.0"
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath('com.google.gms:google-services:4.3.3')
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}
allprojects {
repositories {
maven { url 'https://www.jitpack.io' }
maven {
url("$rootDir/node_modules/jsc-android/dist")
}
maven {
url "$rootDir/node_modules/react-native/android"
}
mavenLocal()
mavenCentral()
maven { url "https://maven.google.com" }
google()
}
}
这是我的app/build.gradle:
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
project.ext.react = [
entryFile: "index.js",
enableHermes: true, // clean and rebuild if changing
]
react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
// root = file("../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
// codegenDir = file("../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "prodDebug"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
//
// The path to the CLI configuration file. Default is empty.
// bundleConfig = file(../rn-cli.config.js)
//
// The name of the generated asset file containing your JS bundle
// bundleAssetName = "MyApplication.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
// entryFile = file("../js/MyApplication.android.js")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
}
/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
android {
ndkVersion '21.3.6528147'
compileSdkVersion rootProject.ext.compileSdkVersion
compileSdk 33
namespace "*redacted*"
defaultConfig {
applicationId "*redacted*"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 109
versionName "1.0.9"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
missingDimensionStrategy 'react-native-camera', 'general'
}
buildFeatures {
viewBinding true
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
lintOptions {
abortOnError false
}
packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
configurations.all {
resolutionStrategy {
force 'androidx.annotation:annotation:1.3.0'
force 'androidx.appcompat:appcompat:1.3.0'
force 'androidx.core:core:1.7.0'
// force 'com.facebook.react:react-native:0.72.5'
}
// eachDependency { details ->
// if (details.requested.group == 'com.facebook.react' &&
// details.requested.name == 'hermes-android') {
// details.useVersion '0.2.1'
// }
// }
}
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
testImplementation 'junit:junit:4.+'
// implementation 'androidx.appcompat:appcompat:1.3.0' // Update to a suitable version.
// implementation 'androidx.annotation:annotation:1.3.0' // Update to a suitable version.
// implementation 'androidx.core:core:1.7.0' // Update to a suitable version.
// implementation group: 'org.codehaus.groovy', name: 'groovy', version: '3.0.9'
implementation project(':react-native-blob-util')
implementation project(':react-native-location')
implementation project(':react-native-permissions')
implementation project(':react-native-fs')
implementation project(':react-native-push-notification')
implementation "com.swmansion:react-native-reanimated:3.5.4"
implementation 'com.facebook.react:hermes-android'
implementation project(':react-native-orientation')
implementation project(':react-native-keychain')
implementation project(':rn-fetch-blob')
implementation project(':react-native-pdf')
implementation project(':react-native-background-timer')
implementation project(':react-native-camera')
implementation project(':react-native-ble-plx')
implementation project(':react-native-vector-icons')
// implementation 'com.airbnb.android:react-native-maps:1.8.0'
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:18.2.0'
implementation 'com.google.android.gms:play-services-maps:18.2.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation "androidx.appcompat:appcompat:$androidxAppcompatVersion"
implementation "androidx.annotation:annotation:$androidxAnnotationVersion"
implementation "androidx.core:core:$androidxCoreVersion"
implementation project(':react-native-localization')
implementation project(':react-native-gesture-handler')
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
// implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'org.webkit:android-jsc:+'
implementation project(':react-native-safe-area-context')
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-analytics:21.3.0'
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:+'
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
这是我的gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
我已经为更新工作了几个星期,但我一直卡在这个错误上,如果您能为我提供一些关于该怎么做的帮助/文档,将非常受欢迎!
答: 暂无答案
评论