如何修复React Native APK版本构建错误

时间:2019-08-28 17:02:53

标签: android react-native

我已经创建了keystore文件,并在build.gradle文件中也进行了配置。当我尝试构建./gradlew assembleRelease时遇到以下错误。

  • 出了什么问题:
  

评估根项目'Esai_RB_Dashboard'时发生问题。可以   找不到方法android()作为参数   根项目上的[build_n0m7w8cs4bb2vu7aue618z0 $ _run_closure2 @ 4740c012]   类型为org.gradle.api.Project的“ Esai_RB_Dashboard”。

build.gradle

signingConfigs {
        release {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

1 个答案:

答案 0 :(得分:1)

您设置了gradle.properties文件吗?

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

#also remember to set your JDK path accordingly, if it isn't set.
# org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_201

MYAPP_RELEASE_STORE_FILE=yourapp.keystore
MYAPP_RELEASE_KEY_ALIAS=yourapp-app
MYAPP_RELEASE_STORE_PASSWORD=yourstorepassword
MYAPP_RELEASE_KEY_PASSWORD=yourkeypassword

此外,请记住,发布密钥库必须位于/ android / app文件夹中。