gradle - React Native 项目 Android Gradle Fail (Reac

我正在使用 VS Code 和 react-native 编写应用程序,在尝试安装 react-native-material-ripple 之后,我在尝试构建我的应用程序时遇到了以下错误:

////////////////////////////////////////////////////////////////////////////////////////// 失败:构建失败,出现异常。

  • 地点: 构建文件 'C:\Users\D'errah\Documents\Code\React\dowProjectMatcher\node_modules\react-native-reanimated\android\build.gradle' 行:89

  • 出了什么问题: 配置项目“:react-native-reanimated”时出现问题。

java.io.IOException: The filename, directory name, or volume label syntax is incorrect //////////////////////////////////////////////////////////////////////////////////////////////

该应用在此之前运行良好。我转到有问题的文件并查看了提到的错误行:

提到的行:

classpath += files(android.bootClasspath)

完整文件:

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

buildscript {
    if (project == rootProject) {
        // The Android Gradle plugin is only required when opening the android folder stand-alone.
        // This avoids unnecessary downloads and potential conflicts when the library is included as a
        // module dependency in an application project.
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.2'
        }
    }
}

apply plugin: 'com.android.library'
apply plugin: 'maven'

android {
    compileSdkVersion safeExtGet('compileSdkVersion', 28)
    buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 16)
        targetSdkVersion safeExtGet('targetSdkVersion', 28)
        versionCode 1
        versionName "1.0"
    }
    lintOptions {
        abortOnError false
    }
}

repositories {
    mavenLocal()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
    maven {
        // Android JSC is installed from npm
        url "$rootDir/../node_modules/jsc-android/dist"
    }
    google()
    jcenter()
}

dependencies {
    //noinspection GradleDynamicVersion
    implementation 'com.facebook.react:react-native:+'  // From node_modules
    implementation "androidx.transition:transition:1.1.0"
}

def configureReactNativePom(def pom) {
    def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)

    pom.project {
        name packageJson.title
        artifactId packageJson.name
        version = packageJson.version
        group = "com.swmansion.reanimated"
        description packageJson.description
        url packageJson.repository.baseUrl

        licenses {
            license {
                name packageJson.license
                url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
                distribution 'repo'
            }
        }

        developers {
            developer {
                id packageJson.author.username
                name packageJson.author.name
            }
        }
    }
}

afterEvaluate { project ->

    task androidJavadoc(type: Javadoc) {
        source = android.sourceSets.main.java.srcDirs
        classpath += files(android.bootClasspath)
        classpath += files(project.getConfigurations().getByName('compile').asList())
        include '**/*.java'
    }

    task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
        classifier = 'javadoc'
        from androidJavadoc.destinationDir
    }

    task androidSourcesJar(type: Jar) {
        classifier = 'sources'
        from android.sourceSets.main.java.srcDirs
        include '**/*.java'
    }

    android.libraryVariants.all { variant ->
        def compileTask
        if (variant.hasProperty('javaCompileProvider')){
            compileTask = variant.javaCompileProvider.get()
        }else{
            compileTask = variant.javaCompile
        }

        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: compileTask) {
            from compileTask.destinationDir
        }
    }

    artifacts {
        archives androidSourcesJar
        archives androidJavadocJar
    }

    task installArchives(type: Upload) {
        configuration = configurations.archives
        repositories.mavenDeployer {
            // Deploy to react-native-event-bridge/maven, ready to publish to npm
            repository url: "file://${projectDir}/../android/maven"

            configureReactNativePom pom
        }
    }
}

问题是,我非常确定即使在应用程序运行时该行也已经存在。因此,我花了最后几个小时在谷歌上搜索,但一直无法找出导致问题的原因/如何解决它。

如有任何帮助,我们将不胜感激!

注意事项:

-使用 VS 代码

-在安装 react-native-material-ripple 之前工作(尝试卸载、测试、重新安装、测试)

最佳答案

我也发生了同样的错误,请阅读本文档以正确安装 react-native-reanimate。

安装最新

yarn add react-native-reanimated@next

npm i react-native-reanimated@next

现在转到 android 目录和 gradlew clean,有关更多详细信息,请访问以下链接

https://docs.swmansion.com/react-native-reanimated/docs/installation

关于gradle - React Native 项目 Android Gradle Fail (React-Native-Reanimated Fail),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63964406/

相关文章:

python-3.x - 如何创建 swagger :response that produces

python - 如何使用 python 编辑相机帧?

angular - 如何避免@types 包引入的补丁级别增加带来重大变化的问题?

postgresql - Cloud SQL (postgres) 外部数据包装器连接超时到副本实例

tensorflow - Keras SavedModel 与 Tensorflow SavedMo

javascript - 如何在 react 中的不同组件库之间共享上下文?

python - 有没有办法在 python 中抓取没有 Selenium 的 JavaScript

python - 如何在 Kotlin 中正确反转链表?

python - 为什么 Keras 不返回 lstm 层中细胞状态的完整序列?

linux - 是否可以为 `git clone` 操作指定超时?