microsoft / appcenter-sdk-react-native

Development repository for the App Center SDK for React Native
Other
413 stars 135 forks source link

AppCenter Build does not support RN 0.56.0 #348

Closed acomito closed 6 years ago

acomito commented 6 years ago

I have successful local builds (in xcode too) but fails in the appcenter cloud with this:

https://gist.github.com/acomito/f551b9c2db85cf8cc1f15fb5f48d91a0


  React Native Environment Info:
    System:
      OS: macOS Sierra 10.12.6
      CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
      Memory: 30.86 MB / 8.00 GB
      Shell: 5.2 - /bin/zsh
    Binaries:
      Node: 9.7.1 - /usr/local/bin/node
      Yarn: 1.5.1 - /usr/local/bin/yarn
      npm: 5.6.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.2, macOS 10.13, tvOS 11.2, watchOS 4.2
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 9.2/9C40b - /usr/bin/xcodebuild
    npmPackages:
      react: 16.4.1 => 16.4.1
      react-native: 0.56.0 => 0.56.0
    npmGlobalPackages:
      react-native-cli: 2.0.1
ElektrojungeAtWork commented 6 years ago

Hey @acomito,

thanks for getting in touch. This is actually not an SDK issue. Currently AppCenter Build does not support RN 0.56.0 but the team is working on it.

I'm leaving this issue open for visibility but please bear in mind that the issues here are intended for the AppCenter React-Native SDK. For issues that are not related to the SDK, please get in touch via Intercom (the blue button on the bottom right corner in the AppCenter portal).

acomito commented 6 years ago

@TroubleMakerBen appreciate the quick response! I was hoping it was something simple like that.

ethanneff commented 6 years ago

Here is the error from Android

:appcenter:preBuild UP-TO-DATE
:appcenter:preReleaseBuild UP-TO-DATE
:appcenter:checkReleaseManifest
:appcenter:preDebugAndroidTestBuild UP-TO-DATE
:appcenter:preDebugBuild UP-TO-DATE
:appcenter:preDebugUnitTestBuild UP-TO-DATE
:appcenter:preReleaseUnitTestBuild UP-TO-DATE
:appcenter:prepareAndroidArchLifecycleRuntime100Library
:appcenter:prepareComAndroidSupportAnimatedVectorDrawable2610Library
:appcenter:prepareComAndroidSupportAppcompatV72610Library
:appcenter:prepareComAndroidSupportSupportCompat2610Library
:appcenter:prepareComAndroidSupportSupportCoreUi2610Library
:appcenter:prepareComAndroidSupportSupportCoreUtils2610Library
:appcenter:prepareComAndroidSupportSupportFragment2610Library
:appcenter:prepareComAndroidSupportSupportMediaCompat2610Library
:appcenter:prepareComAndroidSupportSupportV42610Library
:appcenter:prepareComAndroidSupportSupportVectorDrawable2610Library
:appcenter:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:appcenter:prepareComFacebookFrescoDrawee190Library
:appcenter:prepareComFacebookFrescoFbcore190Library
:appcenter:prepareComFacebookFrescoFresco190Library
:appcenter:prepareComFacebookFrescoImagepipeline190Library
:appcenter:prepareComFacebookFrescoImagepipelineBase190Library
:appcenter:prepareComFacebookFrescoImagepipelineOkhttp3190Library
:appcenter:prepareComFacebookReactReactNative0560Library
:appcenter:prepareComFacebookSoloaderSoloader030Library
:appcenter:prepareComMicrosoftAppcenterAppcenter161Library
:appcenter:prepareComMicrosoftAppcenterReactnativeAppcenterReactNative160Library
:appcenter:prepareOrgWebkitAndroidJscR174650Library
:appcenter:prepareReleaseDependencies
:appcenter:compileReleaseAidl
:appcenter:compileReleaseNdk NO-SOURCE
:appcenter:compileLint UP-TO-DATE
:appcenter:copyReleaseLint NO-SOURCE
:appcenter:compileReleaseRenderscript UP-TO-DATE
:appcenter:generateReleaseBuildConfig
:appcenter:generateReleaseResValues UP-TO-DATE
:appcenter:generateReleaseResources UP-TO-DATE
:appcenter:mergeReleaseResources
:appcenter:processReleaseManifest
:appcenter:processReleaseResources
/Users/ethanneff/dev/hinge/phoenix2/node_modules/appcenter/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for it
em: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/Users/ethanneff/dev/hinge/phoenix2/node_modules/appcenter/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for it
em: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

/Users/ethanneff/dev/hinge/phoenix2/node_modules/appcenter/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15:21-54: AAPT: No resource found thatmatches the given name: attr 'android:keyboardNavigationCluster'.

/Users/ethanneff/dev/hinge/phoenix2/node_modules/appcenter/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/Users/ethanneff/dev/hinge/phoenix2/node_modules/appcenter/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

/Users/ethanneff/dev/hinge/phoenix2/node_modules/appcenter/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

:appcenter:processReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':appcenter:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.703 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
✨  Done in 6.27s.
janpieterz commented 6 years ago

@TroubleMakerBen any rough idea for React Native 0.56 support? Are we talking next week, next month?

ElektrojungeAtWork commented 6 years ago

Hey @janpieterz, This is actively being worked on and should be available later this month.

declandowling commented 6 years ago

https://github.com/facebook/react-native/issues/20167

React native 0.56 requires node 8 as a minimum, it has been in production for 10 days and was in RC for around a month before that, so hopefully this isn't something completely out of the blue to the app center team.

Currently the app center cloud build machines use Node 6.14.3 - https://docs.microsoft.com/en-us/appcenter/build/software. Is the only solution here to wait for app center to support Node 8 as a minimum if wanting to use React Native 0.56?

...

While I'm aware it's nothing to do with the SDK, I wish there was a more public place to post about issues such as this rather than

please get in touch via Intercom (the blue button on the bottom right corner in the AppCenter portal).

dhei commented 6 years ago

Hey @declandowling, ~have you tried npm install -g npm@8 in the app center post clone script~

[Update]: I misread the message, you're asking for node.js v8 not npm.

You can try to brew install node@8 in the app center post clone script to upgrade to node v8.

syq7970 commented 6 years ago

"Failed to execute aapt" This is because targetSdkVersion is too low, for android workaround just change appcenter and appcenter-analytics targetSdkVersion and compileSdkVersion to 26.

but hope merge this change by official.

guperrot commented 6 years ago

@syq7970 This should be addressed by https://github.com/Microsoft/AppCenter-SDK-React-Native/pull/350/files and should be released later this week or early next week.

amhinson commented 6 years ago

The node issue can be fixed by adding a appcenter-post-clone.sh with:

#!/usr/bin/env bash
set -ex
brew uninstall node@6
NODE_VERSION="8.9.4"
curl "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.pkg" > "$HOME/Downloads/node-installer.pkg"
sudo installer -store -pkg "$HOME/Downloads/node-installer.pkg" -target "/"

This will just uninstall the version of Node App Center is currently using, and install Node 8.9.4 instead.

ethanneff commented 6 years ago

Release 1.7.0 is still broken. Still cannot build the SDK on Android with React Native 0.56.0. https://github.com/Microsoft/AppCenter-SDK-React-Native/pull/359 may fix the issue?

Right now, I still have to hard code the changes to the appcenter/build.gradle, appcenter-analytics/build.gradle , appcenter-crashes/build.gradle files

apply plugin: 'com.android.library'

def _ext = rootProject.ext
def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 23
def _buildToolsVersion = _ext.has('buildToolsVersion') ? _ext.buildToolsVersion : '27.0.3'
def _minSdkVersion = _ext.has('minSdkVersion') ? _ext.minSdkVersion : 16
def _targetSdkVersion = _ext.has('targetSdkVersion') ? _ext.targetSdkVersion : 22

android {
    compileSdkVersion _compileSdkVersion
    buildToolsVersion _buildToolsVersion

    defaultConfig {
        minSdkVersion _minSdkVersion
        targetSdkVersion _targetSdkVersion
        versionCode 29
        versionName '1.5.1'
        ndk {
            abiFilters 'armeabi-v7a', 'x86'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.facebook.react:react-native:+'
    compile 'com.microsoft.appcenter:appcenter:1.6.1'

    // compile project(':AppCenterReactNativeShared')   // For testing with TestApp
    compile 'com.microsoft.appcenter.reactnative:appcenter-react-native:1.6.0'
}
amhinson commented 6 years ago

For the Android issues, I've also had to go in and change the compileSkdVersion from 23 to 26 on a handful of native dependencies in the node_modules, including App Center. As a helpful tool to make sure those changes stay in place, I use https://github.com/ds300/patch-package , which essentially patches the node_module each time they are installed. This pattern works for the time being while all of the libraries update to the new Android standards.

jaeklim commented 6 years ago

@ethanneff Can you uninstall appcenter packages and install it again? Looks the build.gradle file that you posted isn't 1.7.0.

dhei commented 6 years ago

Hi @ethanneff,

App Center RN SDK v1.7.1 does works with RN 0.56.x. As @jaelim-ms pointed out, it appears that you're using v1.6.0 of appcenter-react-native dependency that comes with v1.6.0 of App Center RN SDK:

compile 'com.microsoft.appcenter.reactnative:appcenter-react-native:1.6.0'

Upgrade to App Center RN SDK v1.7.1 should address this issue.

guperrot commented 6 years ago

If you have a problem with the SDK specifically (with the latest version of our SDK) with react native 0.56, please create a separate issue, this issue is to track build support on App Center only.

dhei commented 6 years ago

Hey folks,

We added the support of React Native 0.56.x (with Xcode 9.4.1 for iOS) in App Center Build. No more workaround like this is needed anymore.

If your package.json contains RN 0.56+, then Node version on VM will select Node 8. In order to apply the new changes, you need to hit Save or Save and Build button to update build configurations in App Center portal.

FYI @acomito @ethanneff @declandowling @amhinson.

wmalgadey commented 5 years ago

Hey folks,

We added the support of React Native 0.56.x (with Xcode 9.4.1 for iOS) in App Center Build. No more workaround like this is needed anymore.

What if we need a specific node.js 8 version (8.10.0 to be specific), how can we uninstall node.js8 from post-clone script?

dhei commented 5 years ago

Hey @wmalgadey,

To install a specific version of Node, have you tried the workaround from https://github.com/Microsoft/AppCenter-SDK-React-Native/issues/348#issuecomment-406651622?

wmalgadey commented 5 years ago

Yes, but this only deinstalls v6 of node.js. It downloads 8.10 (in my example) but still uses 8.12.

ElektrojungeAtWork commented 5 years ago

Hey @wmalgadey,

I think the issue you are seeing is that you are installing Node 8.10 but App Center doesn't use that version, yet. As this issue on SO explains, you might need to run n again after you installed Node 8.10.

wmalgadey commented 5 years ago

Hmm, I used the script from https://github.com/Microsoft/AppCenter-SDK-React-Native/issues/348#issuecomment-406651622. There is no sudo n in this script, which can be run again :)

But I also tried to use n, which din't work neither. Still getting the error, that 8.12 is beeing used instead of 8.10.

ElektrojungeAtWork commented 5 years ago

Hey @wmalgadey,

Good news, there's a solution for you. Ever since App Center started to support RN 0.56.0, it's forcing node 8.12.0 per default.

Use this in you post clone script and you should be happy (verified this with a toy project of mine):

#!/bin/sh

# please specify required Node.js version
NODE_VERSION=8.10.0

# workaround to override the v8 alias
npm config delete prefix
. ~/.bashrc
nvm install "$NODE_VERSION"
nvm alias node8 "$NODE_VERSION"

Let me know how this goes!

wmalgadey commented 5 years ago

Is nvm installed by default? It is not mentioned on the documentation page https://docs.microsoft.com/en-us/appcenter/build/software. I will try, thank you for your efforts so far.

ElektrojungeAtWork commented 5 years ago

Hey Wolfgang,

Did the workaround work?

To answer your question: While nvm should generally be available on the machines, it is only used as part of the provisioning process of the machines and not intended to be used or working in a way that allows customer's to use it and rely on it. Does that make sense?

Best, Benjamin

wmalgadey commented 5 years ago

Ok, I didn't had the time to test it. We found a way to make our app compile with 8.12 :) So thanks for you efforts!

ElektrojungeAtWork commented 5 years ago

I'm glad things are working Wolfgang! Don't hesitate to get in touch with us again! (If you do, please open an new issue here on GH or get in touch through our support - the blue floating button on the App Center portal)

acollazomayer commented 5 years ago

@ElektrojungeAtWork Hi, Im having troubles with the script. after I use it, it fails with NA/: "Version "N/A => N/A" is not yet installed.

acollazomayer commented 5 years ago

@ElektrojungeAtWork it fails in the select node version script

evkhramkov commented 5 years ago

Hello @acollazomayer,

Looks like you have some issue in script or in your app configuration, but that is not related to SDK. Could you please reach out to App Center support (using blue intercom button in the right bottom) so we can closely look into your issue. It would be much more convenient to help you with the access to build logs and script contents which you're using.

baldursson commented 5 years ago

Even though I'm using React 0.57.4, App Center wants to use node 6. The workaround provided by @amhinson worked perfectly until a few days ago. Now App Center runs an additional script called "Select Node.js Version v2" (select-node-version.sh) that selects node 6 no matter what.

Any ideas?

evkhramkov commented 5 years ago

@baldursson you can set node version in build configuration instead of workaround scripts. By default it uses node v6

https://docs.microsoft.com/en-us/appcenter/build/react-native/nodejs

image

baldursson commented 5 years ago

Thank you @evkhramkov! I had no idea