react-native-screens:compileDebugKotlin 错误

Azh*_*ain 5 javascript node.js reactjs react-native

失败:构建失败并出现异常。

  • 出了什么问题:任务“:react-native-screens:compileDebugKotlin”执行失败。

评估任务“:react-native-screens:compileDebugKotlin”的属性“filteredArgumentsMap”时出错无法解析配置“:react-native-screens:debugCompileClasspath”的所有工件。> 无法转换 core-ktx-1.5.0.aar (androidx.core:core-ktx:1.5.0) 以匹配属性 {artifactType=android-classes-jar, org.gradle.category=library, org.gradle。 dependency.bundling=external、org.gradle.libraryelements=aar、org.gradle.status=release、org.gradle.usage=java-api}。> AarToClassTransform 执行失败:C:\Users\ABC.gradle\caches\transforms-3\186e662719f643b770233b2443ab0f39\transformed\jetified-core-ktx-1.5.0.aar。> 未找到 zip END 标头

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • 在https://help.gradle.org获取更多帮助

28 秒内构建失败

at makeError (D:\ReactNative\todo\node_modules\execa\index.js:174:9)
at D:\ReactNative\todo\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\ReactNative\todo\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)  
at async Command.handleAction (D:\ReactNative\todo\node_modules\@react-native-community\cli\build\index.js:192:9)
Run Code Online (Sandbox Code Playgroud)

info 使用 --verbose 标志运行 CLI 以获取更多详细信息。这个你能帮我吗

小智 9

在这里找到了正确的解决方案。这对我有用。 https://github.com/software-mansion/react-native-screens/issues/1369#issuecomment-1105152720

在我的 android/build.gradle 文件中我更改了这一点:

buildscript {
    ext {
        // ...
        kotlin_version = '1.6.10' // <- add this line
    }

    dependencies {
        // ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // <- add this line
        // ...
    }
}
Run Code Online (Sandbox Code Playgroud)

我还在 android/gradle.properties 中添加了增加的内存:org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m


小智 0

我上周遇到了同样的问题,但在网上没有找到解决方案。我创建了新项目,并将旧项目的 App.js 和其他 JS 文件(包含开发代码)复制到新项目文件夹中。通过这种方式我解决了这个问题。