user3672894
user3672894

Reputation: 1

Generate APK From Windows in React Native

i want to generate a Signed APK from Windows to test in a real phone. I'm finished the development of the App, but when i compile and try to install in my android phone it says "Can't install this application".

I'm a little confused following this: https://facebook.github.io/react-native/docs/signed-apk-android.html

i cant find ~/.gradle/gradle.properties

and my android/app/build.gradle doesnt have the android word like here:

android {
...
defaultConfig { ... }
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
        }
    }
}
buildTypes {
    release {
        ...
        signingConfig signingConfigs.release
    }
}

}

Can anyone help me please

Edit 1: My build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    mavenLocal()
    jcenter()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
}
   }

Upvotes: 0

Views: 1722

Answers (1)

Sathish Sundharam
Sathish Sundharam

Reputation: 1130

File -> android/gradle.properties

MYAPP_RELEASE_STORE_FILE=my-release-key.keystore MYAPP_RELEASE_KEY_ALIAS=my-key-alias MYAPP_RELEASE_STORE_PASSWORD=SAMPLE MYAPP_RELEASE_KEY_PASSWORD=SAMPLE android.useDeprecatedNdk=true

File -> android/app/build.gradle

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
        }
    }
}
buildTypes {
    release {

        signingConfig signingConfigs.release
    }
}

Place the my-release-key.keystore file under the android/app directory in your project folder.

Upvotes: 0

Related Questions