首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >heap本机: Java堆空间

heap本机: Java堆空间
EN

Stack Overflow用户
提问于 2021-09-18 21:11:10
回答 1查看 3.6K关注 0票数 3

我目前正在构建我的android,并在遵循文档的基础上使用react本机。

我发现了一个错误:

代码语言:javascript
复制
./gradlew bundleRelease
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: project ':react-native-async-storage_async-storage', project ':react-native-camera', project ':react-native-pager-view', ...
> Task :app:signReleaseBundle FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
   > Java heap space

* 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

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 FAILED in 15s
213 actionable tasks: 15 executed, 198 up-to-date

当我运行./gradlew signingReport时,一切都很好:

代码语言:javascript
复制
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: project ':react-native-async-storage_async-storage', project ':react-native-camera', project ':react-native-pager-view', ...

> Task :app:signingReport
Variant: debug
Config: debug
Store: /home/alexandre/Documents/project/iWaiterApp/android/app/debug.keystore
Alias: AndroidDebugKey
MD5: 20:F4:61:48:B7:2D:8E:5E:5C:A2:3D:37:A4:F4:14:90
SHA1: 5E:8F:16:06:2E:A3:CD:2C:4A:0D:54:78:76:BA:A6:F3:8C:AB:F6:25
SHA-256: FA:C6:17:45:DC:09:03:78:6F:B9:ED:E6:2A:96:2B:39:9F:73:48:F0:BB:6F:89:9B:83:32:66:75:91:03:3B:9C
Valid until: Tuesday, April 30, 2052
----------
Variant: release
Config: release
Store: /home/alexandre/Documents/project/iWaiterApp/android/app/my-upload-key.keystore
Alias: my-key-alias
MD5: 86:65:36:56:D2:FE:31:9A:5D:B1:2B:67:B2:0E:57:C4
SHA1: 25:90:1A:0B:0C:4E:95:CE:CE:E2:40:5F:B9:0E:D6:46:0D:41:F9:45
SHA-256: BC:82:0F:E2:FC:24:52:DB:14:95:CD:D7:06:9B:D6:CB:50:F1:44:85:FC:EC:4C:65:CD:CB:10:8B:E8:00:04:9C
Valid until: Wednesday, February 3, 2049
----------
// ...
----------
Variant: releaseUnitTest
Config: debug
Store: /home/alexandre/.android/debug.keystore
Alias: AndroidDebugKey
MD5: 20:F4:61:48:B7:2D:8E:5E:5C:A2:3D:37:A4:F4:14:90
SHA1: 5E:8F:16:06:2E:A3:CD:2C:4A:0D:54:78:76:BA:A6:F3:8C:AB:F6:25
SHA-256: FA:C6:17:45:DC:09:03:78:6F:B9:ED:E6:2A:96:2B:39:9F:73:48:F0:BB:6F:89:9B:83:32:66:75:91:03:3B:9C
Valid until: Tuesday, April 30, 2052
----------

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 5s
11 actionable tasks: 11 executed

这是我的android/app/build.gradle

代码语言:javascript
复制
// ...
android {
    // ...
    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
            }
        }
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'AndroidDebugKey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }

    // ...
}

dependencies {
    // ...
}

// ...

这是我的android/gradle.properties

代码语言:javascript
复制
android.useAndroidX=true

android.enableJetifier=true

FLIPPER_VERSION=0.93.0

MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=computer
MYAPP_UPLOAD_KEY_PASSWORD=computer

我可以在这篇文章中找到解决这个问题的方法:

我还为我的debug.keystorehttps://raw.githubusercontent.com/facebook/react-native/master/template/android/app/debug.keystore使用了正式模板

如何解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-19 00:25:19

即使您在签名步骤中得到一个错误,但它似乎与它无关,而只是java内存不足。

尝试将下面的行添加到您的gradle.properties中,以增加Java堆大小。

代码语言:javascript
复制
org.gradle.jvmargs=-Xmx2g -XX\:MaxHeapSize\=4g
票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69238461

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档