简体   繁体   中英

How to fix the react native APK release build error

I have created the keystore file and configured the same in build.gradle file as well. When i tried to Build ./gradlew assembleRelease getting the below error.

  • What went wrong:

A problem occurred evaluating root project 'Esai_RB_Dashboard'. Could not find method android() for arguments [build_n0m7w8cs4bb2vu7aue618z0$_run_closure2@4740c012] on root project 'Esai_RB_Dashboard' of type org.gradle.api.Project.

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
        }
    }

Have you set your gradle.properties file?

# 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

Also, remember that your release keystore needs to be in the /android/app folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM