good afternoon, trying to compile an application on react-native from a finished turnip
what i did:
installed java
installed sdk and deflate the components I think are needed enter image description here enter image description here

There is such a build

android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.reactnativeresponsive" 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" } } buildTypes { release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // applicationVariants are eg 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 } } } 

}

I registered JAVA_HOME and ANDROID_HOME in .bashrc (or the errors crashed)

run the build command
./gradlew assembleRelease
result -> failed to find target with hash string 'android-23' in: / home / igor / sdk / tools

enter image description here

Please tell me how to fix this error?

UPD tried to compile https://github.com/spencercarli/react-native-push-notification-how-to also the same error, I think that something from my SDK is not something “something”, I am looking for a reason.

1 answer 1

I'm doing this is crooked, but I have a ride

You come into AndroidStudio

1) Click to open the project and there you select the android folder in your project

2) Click the build-> Generate Signed APK tab

3) there in the window you press Create New

4) Fill everything in there (key alias I did my-key-alias and in save it in \ android \ app \ my-release-key.keystore);

5) then it seems necessary to add the following in android / app / build.gradle

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

 ...
 }

6) in the gradle.properties file in the android folder (if you drop it and in android / .gradle), add

 MYAPP_RELEASE_STORE_FILE = my-release-key.keystore 
 MYAPP_RELEASE_KEY_ALIAS = my-key-alias 
 MYAPP_RELEASE_STORE_PASSWORD = here is your pass 
 MYAPP_RELEASE_KEY_PASSWORD = here is your pass

7) you go through the console to the android folder of your project and write in the console "gradlew assembleRelease" and it will work. File budev in android / app / build / outputs / apk / app-release.apk

PS curve way, but it works for me

  • did about the same. It turned out there tutorial slightly skipped and did not finish reading it right away. there is clearly written facebook.imtqy.com/react-native/docs/signed-apk-android.html you just need to look. - Igor Kalamurda
  • Most importantly, I did not write something, in your case, it will help you to add the local.properties file to the project folder and add the path to the Android SDK in the form "sdk.dir = C: \\ AdnroidSDK \\ SDK" - Alex Kozlov
  • I've already generated everything ok) did on Linux - Igor Kalamurda