Environment:
Packages: (wanted => installed)
react-native: ^0.55.4 => 0.55.4
Obs.: At this moment, below I'm trying to apply the last version of React Native
Dependencies version:
"dependencies": {
"axios": "^0.18.0",
"moment": "^2.22.1",
"moment-timezone": "^0.5.17",
"prop-types": "^15.6.1",
"react": "^16.3.2",
"react-native": "^0.55.4",
"react-native-calendars": "^1.19.3",
"react-native-config": "^0.11.5",
"react-native-device-info": "^0.21.5",
"react-native-elements": "^0.19.1",
"react-native-fbsdk": "^0.7.0",
"react-native-intl": "^1.0.0",
"react-native-storage": "^0.2.2",
"react-native-vector-icons": "^4.6.0",
"react-navigation": "^2.0.1",
"react-navigation-redux-helpers": "^1.0.7",
"react-promise": "^2.0.2",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-saga": "^0.16.0",
"redux-saga-testing": "^1.0.5"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-jest": "^23.0.1",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react-native": "^4.0.0",
"jest": "^23.0.1",
"react-native-git-upgrade": "^0.2.7",
"react-test-renderer": "^16.3.2",
"regenerator-runtime": "^0.11.1",
"transform-runtime": "^0.0.0"
}
The android/app/build.gradle configuration:
...
project.ext.react = [...]
...
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
ext {
supportLibVersion = '27.0.3'
}
android {
compileSdkVersion 27
buildToolsVersion "${supportLibVersion}"
defaultConfig {
applicationId "com.adm.panel"
minSdkVersion 16
targetSdkVersion 27
versionCode 4
versionName "0.0.4"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
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-config')
compile project(':react-native-device-info')
compile project(':react-native-fbsdk')
compile project(':react-native-intl')
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:27.0.2"
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'
}
The android/build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
The gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
A console to run the Metro bundler:
~$ yarn start
BUNDLE [android, dev] ./index.js 鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔鈻撯枔 100.0% (1/1), done.
Launching Dev Tools...
Another console to run the app:
~$ react-native run android
Compile and work fine
Chrome Dev Tools from http://<local-IP>:8081/debugger-ui/ has a CORS errorSdkVersion: 23SdkVersion: 26So...
<local-IP> is my local IP at this moment.See below the Chrome Dev Tools output:
Failed to load http://localhost:8081/index.delta?platform=android&dev=true&minify=false: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://<local-IP>:8081' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
(index):186 Uncaught (in promise) TypeError: Failed to fetch
Here I'm using the SdkVersion: 23

More details here:
https://github.com/facebook/react-native/issues/16906#issuecomment-392356227
Here I'm using the SdkVersion: 26
Executing task ':react-native-config:processReleaseResources' (up-to-date check took 0.012 secs) due to:
Output file /home/paneladm/projects/my-react-native-app/node_modules/react-native-config/android/build/generated/source/r/release/com has been removed.
Output file /home/paneladm/projects/my-react-native-app/node_modules/react-native-config/android/build/generated/source/r/release/com/facebook/fbui has been removed.
Output file /home/paneladm/projects/my-react-native-app/node_modules/react-native-config/android/build/generated/source/r/release/com/facebook/drawee/backends has been removed.
All input files are considered out-of-date for incremental task ':react-native-config:processReleaseResources'.
Starting process 'command '/home/paneladm/Android-sdk/build-tools/23.0.1/aapt''. Working directory: /home/paneladm/projects/my-react-native-app/node_modules/react-native-config/android Command: /home/paneladm/Android-sdk/build-tools/23.0.1/aapt package -f --no-crunch -I /home/paneladm/Android-sdk/platforms/android-23/android.jar -M /home/paneladm/projects/my-react-native-app/node_modules/react-native-config/android/build/intermediates/manifests/aapt/release/AndroidManifest.xml -S /home/paneladm/projects/my-react-native-app/node_modules/react-native-config/android/build/intermediates/res/merged/release -m -J /home/paneladm/projects/my-react-native-app/node_modules/react-native-config/android/build/generated/source/r/release --custom-package com.lugg.ReactNativeConfig --non-constant-id -0 apk --output-text-symbols /home/paneladm/projects/my-react-native-app/node_modules/react-native-config/android/build/intermediates/bundles/release --no-version-vectors
:react-native-config:processReleaseResources FAILED
:react-native-config:processReleaseResources (Thread[Daemon worker Thread 3,5,main]) completed. Took 0.023 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-config:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 2.478 secs
Stopped 0 compiler daemon(s).
Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':react-native-config:processReleaseResources'.] from daemon DaemonInfo{pid=16452, address=[92dc3c4a-b654-48d2-ba9d-9340a238bb3e port:44114, addresses:[/0:0:0:0:0:0:0:1%lo, /127.0.0.1]], idle=true, lastBusy=1527447310867, context=DefaultDaemonContext[uid=718563ec-a930-43ea-afad-de04432fc821,javaHome=/usr/lib/jvm/jdk1.8.0_172,daemonRegistryDir=/home/paneladm/.gradle/daemon,pid=16452,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
paneladm@debian:~/projects/my-react-native-app/android$
It looks like your issue may be missing some necessary information. Can you run react-native info and edit your issue to include these results under the Environment section?
Looks like duplicate of https://github.com/facebook/react-native/issues/16906 , can you try workaround in that issue.
I don't know if it's a duplicate.
I'll close it for now, because I don't have free time this month.