javascript - 如何制作发布apk?

标签 javascript node.js react-native wix-react-native-navigation

我有项目。调试版本有效。但不释放。

我有一个带有 wix-react-native-navigation、react-native-svg 和 react-native-vector-icons 的项目。调试版本运行良好,但运行后的发布版本向我显示此错误。 https://pp.userapi.com/c845016/v845016142/19d693/rHQyJ1_rgy4.jpg

这是我的 build.gradle 文件:

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.mobilessu"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
             }
         }
     }
    lintOptions{
        abortOnError false
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
       }
    }
    buildTypes {
       release {
        // minifyEnabled enableProguardInReleaseBuilds
        //proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
       }
   }
//applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants    
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:25.0.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-navigation')
    implementation project(':react-native-svg')
    implementation project(':react-native-vector-icons')
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

最佳答案

我发现我的错误。在 build.gradle 中必须是:

project.ext.react = [
    bundleAssetName: "index.android.bundle",
    entryFile: "index.android.js",
    bundleInRelease: true
]

关于javascript - 如何制作发布apk?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54540471/

相关文章:

javascript - Node : undefined is not a new function 'new'

javascript - 从 Jquery ajax 中仅获取文件的一部分

node.js - 使用 React-Router browserHistory、Webpack 2 HistoryApiFallback 和 Node

javascript - React Native - ListView,CloneWithRow,对象不是数组

react-native - React Native 组件之间的通信?

javascript - 我的 xhr.onreadystatechange 函数在运行 if 代码之前运行 else 代码两次

javascript - 需要像 Firefox 的调试器一样获取 HTML Element 的 Layout 信息

javascript - Momentjs 不打印格式化日期中的秒

node.js - 使用 socket.io 在其他客户端计算机中显示鼠标指针移动

reactjs - React-Native - TypeError : undefined is not an object evaluating useContext