Как сделать релиз apk? - PullRequest
       3

Как сделать релиз apk?

0 голосов
/ 05 февраля 2019

У меня есть проект.Отладочная версия работает.Но не выпуск.

У меня есть проект с иконками wix-реагировать-родной-навигацией, реагировать-родной-svg и реагировать-нативный-вектор-иконки.Отладочная версия работает хорошо, но выпускная версия после запуска покажет мне эти ошибки.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'
}

1 Ответ

0 голосов
/ 06 февраля 2019

Я нахожу свою ошибку. В build.gradle должно быть:

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