我是一个UI开发人员,并且是android的新手,gradle并试图弄清为什么调试版本运行良好而发布版本却没有。另外,如何解决这个问题。 我升级了旧版android应用,其中包括将反应性原生版本从v0.36.0升级到0.58.0,并尝试构建相同版本
但是当我尝试运行./gradlew bundleReleaseJsAndAssets --debug 它运行了无限的时间。 我正在使用MAC,gradle 4.7
尝试过project.ext.react = [extraPackagerArgs:[“ --max-workers = 1”]] 尝试使用org.gradle.configureondemand = true,因为我可以手动捆绑。 从以下链接尝试解决方案
https://proandroiddev.com/bundling-react-native-during-android-release-builds-ec52c24e200d
https://github.com/facebook/react-native/issues/11696
https://github.com/facebook/react-native/issues/10078
[org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
21:25:28.941 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
21:25:28.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
21:25:28.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
21:25:28.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
21:25:28.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
21:25:29.241 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 17179869184, Free: 6562177024}
21:25:29.242 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 17179869184, Free: 6562177024}
21:25:29.242 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 954728448, Committed: 671088640}
21:25:34.240 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 17179869184, Free: 6569676800}
21:25:34.240 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 17179869184, Free: 6569676800}
21:25:34.240 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 954728448, Committed: 681574400}
21:25:38.941 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
21:25:38.941 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
21:25:38.941 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
21:25:38.941 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
21:25:38.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
21:25:38.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
21:25:38.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
如果有帮助,则以下是ps -ef的结果| grep“ gradle”
-Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant -cp /Users/x.y/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd/gradle-4.10.1/lib/gradle-launcher-4.10.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.10.1
2029432261 16668 16658 0 9:24PM ?? 3:48.65 /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /Users/x.y/.gradle/wrapper/dists/gradle-4.10.1-all/25vec0eimrsoqjasnun8prrj45/gradle-4.10.1/lib/gradle-launcher-4.10.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.10.1
2029432261 16658 1910 0 9:24PM ttys001 0:14.87 /usr/bin/java -Xdock:name=Gradle -Xdock:icon=/Users/x.y/Dev/Mobile/myapp-android/media/gradle.icns -Dorg.gradle.appname=gradlew -classpath /Users/x.y/Dev/Mobile/myapp-android/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain clean assembleRelease --debug
答案 0 :(得分:0)
如果首先手动弹出我的gradle-wrapper.properties,我将首先尝试对其进行更新/升级:
distributionUrl = https://services.gradle.org/distributions/gradle-4.10.2-all.zip
或 如果您不想手动执行,则在dir android运行中
$ .\gradlew wrapper --gradle-version 5.4.1 --distribution-type all
它在gradle.properties中显示现在应该是:
distributionUrl = https://services.gradle.org/distributions/gradle-5.4.1-all.zip
https://gradle.org/install/#manually
如果所有其他方法都失败了,我将尝试在shell中运行它以查看它是否是我的计算机,或者我的项目是否有其他问题。
答案 1 :(得分:0)
最终得以通过。 react.gradle文件设置输入以缓存结果 inputs.files fileTree(dir:reactRoot,排除:inputExcludes)
这是原因
答案 2 :(得分:0)
我遇到了完全相同的问题。
原因:
解决方案:
node_modules
和yarn.lock
yarn