React - Native does not install .apk

1

Good evening I have a problem,

I'm doing a test application on react-native, something very basic, running it in the GENYMOTION emulator, it works perfectly.

The problem arises when I generate the apk, cd android && gradlew assembleRelease , and I try to install it on the device.

Well, it will not let me, since the option to install does not respond at all, just to cancel someone knows why.

I leave the code of my app.js and build.properties (in case it was a problem with the certificate)

App.js:

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';

export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <Icon name="favorite-border" size={30} color="ligthgrey" />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

gradle.poperties

PLATZI_RELEASE_STORE_FILE=p1.keystore
PLATZI_RELEASE_KEY_ALIAS=prueba1
PLATZI_RELEASE_STORE_PASSWORD=123456
PLATZI_RELEASE_KEY_PASSWORD=123456

android.useDeprecatedNdk=true

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"

/**
 * 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.platzi"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('PLATZI_RELEASE_STORE_FILE')) {
                storeFile file(PLATZI_RELEASE_STORE_FILE)
                storePassword PLATZI_RELEASE_STORE_PASSWORD
                keyAlias PLATZI_RELEASE_KEY_ALIAS
                keyPassword PLATZI_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-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

// 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'
}
    
asked by Revsky01 06.04.2018 в 07:36
source

1 answer

1

The solution to this problem that I clarify was not due to some problem of being caught or configured.

The problem is a bug, because you have the ScreenFiler.apk application enabled on your device.

Turning it off or uninstalling solves the installation problem

I hope it works for you

    
answered by 06.04.2018 / 08:16
source