Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN 0.55.4 android build error #19467

Closed
3 tasks done
francisrod01 opened this issue May 27, 2018 · 3 comments
Closed
3 tasks done

RN 0.55.4 android build error #19467

francisrod01 opened this issue May 27, 2018 · 3 comments
Labels
Platform: Android Android applications. Platform: Linux Building on Linux. Resolution: Locked This issue was locked by the bot.

Comments

@francisrod01
Copy link

francisrod01 commented May 27, 2018

Environment

Environment:

  • OS: Linux 3.16
  • Node: v8.11.2
  • Yarn: 1.7.0
  • npm: 5.6.0
  • Watchman: 4.9.0
  • Xcode: N/A
  • Android Studio: Not Found

Packages: (wanted => installed)

  • react: ^16.3.2 => 16.4.0
  • 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

Steps to Reproduce

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

Expected Behavior

Compile and work fine

Actual Behavior

  1. The app have a grey screen
  2. The console output of Chrome Dev Tools from http://<local-IP>:8081/debugger-ui/ has a CORS error
  3. Error when compile using SdkVersion: 23
  4. Error on console when compile using SdkVersion: 26

So...

  1. The <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
  1. No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored`

Here I'm using the SdkVersion: 23

image

  1. When it doesn't work? The console shows below error:

More details here:

#16906 (comment)

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$ 

References

@react-native-bot

This comment has been minimized.

@gengjiawen
Copy link
Contributor

gengjiawen commented Jul 3, 2018

Looks like duplicate of #16906 , can you try workaround in that issue.

@francisrod01
Copy link
Author

I don't know if it's a duplicate.
I'll close it for now, because I don't have free time this month.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Android Android applications. Platform: Linux Building on Linux. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants