Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native v.0.42.3 - AssembleRelease dosen't generate apk file. #13157

Closed
agerro opened this issue Mar 27, 2017 · 5 comments
Closed

React Native v.0.42.3 - AssembleRelease dosen't generate apk file. #13157

agerro opened this issue Mar 27, 2017 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@agerro
Copy link

agerro commented Mar 27, 2017

Description

I was trying to generate a release apk of my react native application, with the "cd android && gradlew assembleRelease". In the terminal, it shows success, but there is no apk file in the folder suggested by React Native ("/outputs/apk...").

I've followed the guide https://facebook.github.io/react-native/docs/signed-apk-android.html with no luck.

Reproduction Steps and Sample Code

  1. cd myProject
  2. cd android
  3. gradlew assembleRelease

Output:
C:\Users\makar4\Documents\BitBucket\sf\android>gradlew assembleRelease
Incremental java compilation is an incubating feature.
:react-native-localization:preBuild UP-TO-DATE
:react-native-localization:preReleaseBuild UP-TO-DATE
:react-native-localization:checkReleaseManifest
:react-native-localization:preDebugAndroidTestBuild UP-TO-DATE
:react-native-localization:preDebugBuild UP-TO-DATE
:react-native-localization:preDebugUnitTestBuild UP-TO-DATE
:react-native-localization:preReleaseUnitTestBuild UP-TO-DATE
:react-native-localization:prepareComAndroidSupportAppcompatV72220Library
:react-native-localization:prepareComAndroidSupportSupportV42220Library
:react-native-localization:prepareComFacebookFrescoDrawee061Library
:react-native-localization:prepareComFacebookFrescoFbcore061Library
:react-native-localization:prepareComFacebookFrescoFresco061Library
:react-native-localization:prepareComFacebookFrescoImagepipeline061Library
:react-native-localization:prepareComFacebookFrescoImagepipelineOkhttp061Library
:react-native-localization:prepareComFacebookReactReactNative0110Library
:react-native-localization:prepareOrgWebkitAndroidJscR174650Library
:react-native-localization:prepareReleaseDependencies
:react-native-localization:compileReleaseAidl
:react-native-localization:compileReleaseNdk UP-TO-DATE
:react-native-localization:compileLint
:react-native-localization:copyReleaseLint UP-TO-DATE
:react-native-localization:compileReleaseRenderscript
:react-native-localization:generateReleaseBuildConfig
:react-native-localization:generateReleaseResValues
:react-native-localization:generateReleaseResources
:react-native-localization:mergeReleaseResources
:react-native-localization:processReleaseManifest
:react-native-localization:processReleaseResources
:react-native-localization:generateReleaseSources
:react-native-localization:incrementalReleaseJavaCompilationSafeguard
:react-native-localization:compileReleaseJavaWithJavac
:react-native-localization:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:react-native-localization:extractReleaseAnnotations
:react-native-localization:mergeReleaseShaders
:react-native-localization:compileReleaseShaders
:react-native-localization:generateReleaseAssets
:react-native-localization:mergeReleaseAssets
:react-native-localization:mergeReleaseProguardFiles UP-TO-DATE
:react-native-localization:packageReleaseRenderscript UP-TO-DATE
:react-native-localization:packageReleaseResources
:react-native-localization:processReleaseJavaRes UP-TO-DATE
:react-native-localization:transformResourcesWithMergeJavaResForRelease
:react-native-localization:transformClassesAndResourcesWithSyncLibJarsForRelease
:react-native-localization:mergeReleaseJniLibFolders
:react-native-localization:transformNative_libsWithMergeJniLibsForRelease
:react-native-localization:transformNative_libsWithSyncJniLibsForRelease
:react-native-localization:bundleRelease
:react-native-localization:compileReleaseSources
:react-native-localization:assembleRelease
:react-native-vector-icons:preBuild UP-TO-DATE
:react-native-vector-icons:preReleaseBuild UP-TO-DATE
:react-native-vector-icons:checkReleaseManifest
:react-native-vector-icons:preDebugAndroidTestBuild UP-TO-DATE
:react-native-vector-icons:preDebugBuild UP-TO-DATE
:react-native-vector-icons:preDebugUnitTestBuild UP-TO-DATE
:react-native-vector-icons:preReleaseUnitTestBuild UP-TO-DATE
:react-native-vector-icons:prepareComAndroidSupportAppcompatV72301Library
:react-native-vector-icons:prepareComAndroidSupportRecyclerviewV72340Library
:react-native-vector-icons:prepareComAndroidSupportSupportV42340Library
:react-native-vector-icons:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:react-native-vector-icons:prepareComFacebookFrescoDrawee0110Library
:react-native-vector-icons:prepareComFacebookFrescoFbcore0110Library
:react-native-vector-icons:prepareComFacebookFrescoFresco0110Library
:react-native-vector-icons:prepareComFacebookFrescoImagepipeline0110Library
:react-native-vector-icons:prepareComFacebookFrescoImagepipelineBase0110Library
:react-native-vector-icons:prepareComFacebookFrescoImagepipelineOkhttp30110Library
:react-native-vector-icons:prepareComFacebookReactReactNative0412Library
:react-native-vector-icons:prepareComFacebookSoloaderSoloader010Library
:react-native-vector-icons:prepareOrgWebkitAndroidJscR174650Library
:react-native-vector-icons:prepareReleaseDependencies
:react-native-vector-icons:compileReleaseAidl
:react-native-vector-icons:compileReleaseNdk UP-TO-DATE
:react-native-vector-icons:compileLint
:react-native-vector-icons:copyReleaseLint UP-TO-DATE
:react-native-vector-icons:compileReleaseRenderscript
:react-native-vector-icons:generateReleaseBuildConfig
:react-native-vector-icons:generateReleaseResValues
:react-native-vector-icons:generateReleaseResources
:react-native-vector-icons:mergeReleaseResources
:react-native-vector-icons:processReleaseManifest
:react-native-vector-icons:processReleaseResources
:react-native-vector-icons:generateReleaseSources
:react-native-vector-icons:incrementalReleaseJavaCompilationSafeguard
:react-native-vector-icons:compileReleaseJavaWithJavac
:react-native-vector-icons:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:react-native-vector-icons:extractReleaseAnnotations
:react-native-vector-icons:mergeReleaseShaders
:react-native-vector-icons:compileReleaseShaders
:react-native-vector-icons:generateReleaseAssets
:react-native-vector-icons:mergeReleaseAssets
:react-native-vector-icons:mergeReleaseProguardFiles UP-TO-DATE
:react-native-vector-icons:packageReleaseRenderscript UP-TO-DATE
:react-native-vector-icons:packageReleaseResources
:react-native-vector-icons:processReleaseJavaRes UP-TO-DATE
:react-native-vector-icons:transformResourcesWithMergeJavaResForRelease
:react-native-vector-icons:transformClassesAndResourcesWithSyncLibJarsForRelease
:react-native-vector-icons:mergeReleaseJniLibFolders
:react-native-vector-icons:transformNative_libsWithMergeJniLibsForRelease
:react-native-vector-icons:transformNative_libsWithSyncJniLibsForRelease
:react-native-vector-icons:bundleRelease
:react-native-vector-icons:compileReleaseSources
:react-native-vector-icons:assembleRelease

BUILD SUCCESSFUL

Total time: 18.431 secs

////////////android/app/src/build.gradle///////////////
apply from: "../../node_modules/react-native/react.gradle"

/**

  • Set this to true to create two separate APKs instead of one:
    • An APK that only works on ARM devices
    • An APK that only works on x86 devices
  • The advantage is the size of the APK is reduced by about 4MB.
  • Upload all the APKs to the Play Store and people will download
  • the correct one based on the CPU architecture of their device.
    */
    def enableSeparateBuildPerCPUArchitecture = false

/**

  • Run Proguard to shrink the Java bytecode in release builds.
    */
    def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.smartafabriker"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86"
    }
}
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 {
        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 {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-vector-icons')
compile project(':react-native-localization')
}

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

Solution

There might be a problem with this version of react-native or on my part.

Additional Information

  • React Native version: [0.42.3]
  • Platform: [built for both Android and iOS, but the problem is only considering Android release apk]
  • Development Operating System: [Windows and Mac]
  • Dev tools: [Brackets, Android studio, XCode, Android SDK , Node.js CLI/React native CLI]
@agerro agerro closed this as completed Mar 27, 2017
@victorpluna
Copy link

@agerro, i have the same problem. How did you fix it?

@jtl3d
Copy link

jtl3d commented Jul 5, 2017

@agerro, I am having this issue as well. Please update with how you fixed it!

@victorpluna did you every figure it out??

@jtl3d
Copy link

jtl3d commented Jul 5, 2017

@agerro @victorpluna Nevermind - one of my developers added the following which trolled me for a good while until I spotted it:

buildDir = "C:/tmp/${rootProject.name}/${project.name}"

@agerro
Copy link
Author

agerro commented Jul 5, 2017

@jtl3d Sorry, I must have missed answering you. Nice to hear that you figured it out. BEST WAY TO LEARN ;)
I cant remember how we solved it, I got on another assignment before I could see how we solved it. So in a way, you helped me :)

@victorpluna
Copy link

Solution of my case:
In the file 'settings.gradle', was missing the line:
include ':app'

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants