Skip to content

[ERROR] Cannot create release APK #26535

Description

@olympikesoft

Hi
I have followed all the steps from https://facebook.github.io/react-native/docs/signed-apk-android to generate apk for react native without EXPO and i when i check on /android/app/build/outputs/apk i only see this folder => "/android/app/build/outputs/apk/debug"
Inside debug i can check debug apk that it's an older version of the app and the output.json .
The output.json content:
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}]

This is my android/app/build.gradle:

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

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 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.bookingmadeira"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        multiDexEnabled true

    }
    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
            }
        }
    }
    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 {
    compile project(':react-native-paypal-android')
    compile project(':react-native-maps')
    compile project(':react-native-vector-icons')
    compile project(':react-native-fbsdk')
    compile fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleCompatible
    compile "com.android.support:appcompat-v7:27.1.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile "com.google.android.gms:play-services-base:15.0.1"
    compile "com.google.android.gms:play-services-location:15.0.1"
    compile "com.google.android.gms:play-services-maps:15.0.1"
}

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


repositories {
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}

This is my package.json:

"dependencies": {
    "@mapbox/react-native-mapbox-gl": "^6.1.3",
    "axios": "^0.18.0",
    "babel-preset-react-native": "^4.0.1",
    "core-js": "^2.5.7",
    "moment": "^2.22.2",
    "native-base": "^2.8.0",
    "prop-types": "^15.6.2",
    "react": "16.3.1",
    "react-native": "~0.55.2",
    "react-native-animatable": "^1.3.0",
    "react-native-awesome-alert": "^0.4.0",
    "react-native-awesome-alerts": "^1.1.1",
    "react-native-calendar-picker": "^5.22.0",
    "react-native-calendars": "^1.22.0",
    "react-native-credit-card-input": "^0.4.1",
    "react-native-datepicker": "^1.7.2",
    "react-native-elements": "^0.19.1",
    "react-native-fbsdk": "^0.8.0",
    "react-native-image-slider": "^2.0.3",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-maps": "^0.21.0",
    "react-native-modal": "^6.5.0",
    "react-native-paypal-android": "0.0.4",
    "react-native-range-datepicker": "^1.9.1",
    "react-native-share": "^2.0.0",
    "react-native-simple-dialogs": "^1.0.0",
    "react-native-slideshow": "^1.0.1",
    "react-native-snap-carousel": "^3.7.4",
    "react-native-star-rating": "^1.1.0",
    "react-native-step-indicator": "0.0.9",
    "react-native-stripe-api": "^0.1.0",
    "react-native-timeline-listview": "^0.2.3",
    "react-native-vector-icons": "^5.0.0",
    "react-navigation": "^2.16.0",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-promise": "^0.6.0",
    "redux-thunk": "^2.3.0",
    "styled-components": "^4.3.2",
    "tipsi-stripe": "^5.6.0"
  }

When i execute ./gradlew bundleRelease
Comes with success after that i execute react-native run-android --variant=release
This said me an error:
Task 'installReleaseDebug' not found in root project 'mysupercoolapp'.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.Type: QuestionIssues that are actually questions and not bug reports.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions