Appcenter: AppCenter unable to build RN 0.61.2 on Android

Created on 30 Oct 2019  路  21Comments  路  Source: microsoft/appcenter

Note: I'm putting this here because I don't see a way to report a bug in the AppCenter interface.

I'm converting an app that was building fine in AppCenter on RN 0.59 to a newer version of React Native. This is an Android-only issue.

Full log of Gradle Task:

2019-10-30T18:55:16.3948320Z ##[section]Starting: Gradle Task
2019-10-30T18:55:16.3993330Z ==============================================================================
2019-10-30T18:55:16.3993570Z Task         : Gradle
2019-10-30T18:55:16.3993660Z Description  : Build using a Gradle wrapper script
2019-10-30T18:55:16.3993780Z Version      : 1.128.0
2019-10-30T18:55:16.3993850Z Author       : Microsoft Corporation
2019-10-30T18:55:16.3993980Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613720)
2019-10-30T18:55:16.3994110Z ==============================================================================
2019-10-30T18:55:17.6310410Z SYSTEMVSSCONNECTION exists true
2019-10-30T18:55:17.6316540Z [command]/Users/runner/runners/2.159.2/work/1/s/react-native/android/gradlew -DMOBILECENTER_KEYSTORE_PASSWORD=*** -DMOBILECENTER_KEY_ALIAS=*** -DMOBILECENTER_KEY_PASSWORD=*** -DAPPCENTER_KEYSTORE_PASSWORD=*** -DAPPCENTER_KEY_ALIAS=*** -DAPPCENTER_KEY_PASSWORD=*** -p react-native/android clean :app:assembleRelease
2019-10-30T18:55:20.0527710Z Starting a Gradle Daemon (subsequent builds will be faster)
2019-10-30T18:55:26.2463780Z Gradle 5.4.1
2019-10-30T18:56:16.1243990Z 
2019-10-30T18:56:16.1344160Z FAILURE: Build failed with an exception.
2019-10-30T18:56:16.1344960Z 
2019-10-30T18:56:16.1345420Z * Where:
2019-10-30T18:56:16.1346780Z Script '/Users/runner/runners/2.159.2/work/1/s/react-native/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 182
2019-10-30T18:56:16.1347210Z 
2019-10-30T18:56:16.1347580Z * What went wrong:
2019-10-30T18:56:16.1347910Z A problem occurred evaluating script.
2019-10-30T18:56:16.1428050Z > Unable to determine the current character, it is not a string, number, array, or object
2019-10-30T18:56:16.1479450Z   
2019-10-30T18:56:16.2496420Z   The current character read is 'i' with an int value of 105
2019-10-30T18:56:16.2498730Z   Unable to determine the current character, it is not a string, number, array, or object
2019-10-30T18:56:16.2530120Z   line number 1
2019-10-30T18:56:16.2531550Z   index number 0
2019-10-30T18:56:16.2534540Z   info Run "react-native --help" to see a list of all available commands.
2019-10-30T18:56:16.2549100Z   ^
2019-10-30T18:56:16.2551620Z 
2019-10-30T18:56:16.2552150Z * Try:
2019-10-30T18:56:16.2553410Z Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
2019-10-30T18:56:16.2553830Z 
2019-10-30T18:56:16.2554190Z * Get more help at https://help.gradle.org
2019-10-30T18:56:16.2554610Z 
2019-10-30T18:56:16.2554960Z BUILD FAILED in 57s
2019-10-30T18:56:17.0868770Z Error: /Users/runner/runners/2.159.2/work/1/s/react-native/android/gradlew failed with return code: 1
2019-10-30T18:56:17.1027630Z ##[error]Error: /Users/runner/runners/2.159.2/work/1/s/react-native/android/gradlew failed with return code: 1
2019-10-30T18:56:17.1042940Z     at ChildProcess.<anonymous> (/Users/runner/runners/2.159.2/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
2019-10-30T18:56:17.1043280Z     at emitTwo (events.js:106:13)
2019-10-30T18:56:17.1043390Z     at ChildProcess.emit (events.js:191:7)
2019-10-30T18:56:17.1043480Z     at maybeClose (internal/child_process.js:886:16)
2019-10-30T18:56:17.1043580Z     at Socket.<anonymous> (internal/child_process.js:342:11)
2019-10-30T18:56:17.1043670Z     at emitOne (events.js:96:13)
2019-10-30T18:56:17.1043760Z     at Socket.emit (events.js:188:7)
2019-10-30T18:56:17.1043860Z     at Pipe._handle.close [as _onclose] (net.js:497:12)
2019-10-30T18:56:17.1046660Z ##[section]Finishing: Gradle Task

It looks like I'm not the only one to have this issue, similarly to #1042 and issues in other repos.

bug build

Most helpful comment

@King-of-Spades You're right. Mine was a different issue. I had to set def enableSeparateBuildPerCPUArchitecture = false in my android/app/build.gradle

Thanks for looking into it.

All 21 comments

@bkraeling I'd suggest reach out to support (via App Center portal). The details here are good, but often times we need to know which app is it in App Center, potentially experiment with different configuration, etc. We can post back the findings here if we found what's wrong

@DennisPan How do I access that? I'm not seeing any way to contact support within AppCenter.

Hi @bkraeling -- We made some changes to the "New issue" page here this week in an attempt to guide folks toward starting a chat with our dedicated support folks to look into issues like this. However, it looks like the language we used wasn't clear enough. Sorry about that.

To start a chat after logging into App Center, open up the chat window using the blue button in the lower-right corner of the page. In there you should see a button for "New conversation"

image

@alexcnichols Thanks for the screenshot! I wasn't seeing that because I had a browser extension blocking it. I'll use that to contact support.

Same issue with same log here

Same issue for me, all version of RN since 0.6.5 - I get:

Starting a Gradle Daemon (subsequent builds will be faster)
Gradle 5.5

FAILURE: Build failed with an exception.

* Where:
Script '/Users/runner/runners/2.160.0/work/1/s/AppName/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 182

* What went wrong:
A problem occurred evaluating script.
> Unable to determine the current character, it is not a string, number, array, or object

  The current character read is 'i' with an int value of 105
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  info Run "react-native --help" to see a list of all available commands.
  ^

I was able to fix the issue by using my second solution here https://stackoverflow.com/a/58681112/7485366

@DanielRaouf thanks! works perfectly on RN 0.61.3 on appcenter

Thanks everyone! Closing this as this comes from React Native (with its own tracking Issue), and there is a solution that works.

@DanielRaouf's solution above worked for me, but only after switching my project from npm to yarn. Thanks for your help, everyone!

No solution has been working for me. Be it latest RN (6.1.5) nor moving from nom to yarn nor installing adding cli-platform-android to the project. I used a fresh basic RN app. See my issue report here: https://github.com/jkoutavas/ReactNative-AppCenter/issues/1

The easiest and cleanest solutions is to restrict the cli build versions to ones that work.

My build worked fine with react-native 60.* and after upgrading to 61.5 the build fail for both iOS and Android. To solve this added the following resolutions to enforce the cli versions.

  • versions extracted from my previous release that worked. You might want to tweak them if they don't work for you.
"resolutions": {
    "@react-native-community/cli": "^2.6.0",
    "@react-native-community/cli-tools": "^2.8.3",
    "@react-native-community/cli-platform-android": "^2.8.3",
    "@react-native-community/cli-platform-ios": "^2.8.3"
  }

The easiest and cleanest solutions is to restrict the cli build versions to ones that work.

My build worked fine with react-native 60.* and after upgrading to 61.5 the build fail for both iOS and Android. To solve this added the following resolutions to enforce the cli versions.

  • versions extracted from my previous release that worked. You might want to tweak them if they don't work for you.
"resolutions": {
    "@react-native-community/cli": "^2.6.0",
    "@react-native-community/cli-tools": "^2.8.3",
    "@react-native-community/cli-platform-android": "^2.8.3",
    "@react-native-community/cli-platform-ios": "^2.8.3"
  }

You sir are a genius! Thank you so much for the workaround!!! It works with exactly those values for me.

The easiest and cleanest solutions is to restrict the cli build versions to ones that work.
My build worked fine with react-native 60.* and after upgrading to 61.5 the build fail for both iOS and Android. To solve this added the following resolutions to enforce the cli versions.

  • versions extracted from my previous release that worked. You might want to tweak them if they don't work for you.
"resolutions": {
    "@react-native-community/cli": "^2.6.0",
    "@react-native-community/cli-tools": "^2.8.3",
    "@react-native-community/cli-platform-android": "^2.8.3",
    "@react-native-community/cli-platform-ios": "^2.8.3"
  }

You sir are a genius! Thank you so much for the workaround!!! It works with exactly those values for me.

Actually, I have to revise my statement. Using the resolution prop with the values above causes even greater problem (HMRClient red screens), even on the iOS side imho because of the cli-platform-ios resolution (but I am far from an expert here). The Android build will pass though...

As I need RN 61 I will build Android locally for now. FYI the Android build passes for me on MacOS and Windows. I can't see why it should fail on AppCenter.

The easiest and cleanest solutions is to restrict the cli build versions to ones that work.
My build worked fine with react-native 60.* and after upgrading to 61.5 the build fail for both iOS and Android. To solve this added the following resolutions to enforce the cli versions.

  • versions extracted from my previous release that worked. You might want to tweak them if they don't work for you.
"resolutions": {
    "@react-native-community/cli": "^2.6.0",
    "@react-native-community/cli-tools": "^2.8.3",
    "@react-native-community/cli-platform-android": "^2.8.3",
    "@react-native-community/cli-platform-ios": "^2.8.3"
  }

You sir are a genius! Thank you so much for the workaround!!! It works with exactly those values for me.

Actually, I have to revise my statement. Using the resolution prop with the values above causes even greater problem (HMRClient red screens), even on the iOS side imho because of the cli-platform-ios resolution (but I am far from an expert here). The Android build will pass though...

As I need RN 61 I will build Android locally for now. FYI the Android build passes for me on MacOS and Windows. I can't see why it should fail on AppCenter.

You are right @geekazoid-at! My solution is buggy! Anyone found a solution to this issue?!
I updated to react-native 0.61.5 and don't want to revert everything back. Build fails in Android only!

Same hear

Same deal. I think AppCenter can't build 0.61.5 android builds at the moment. The error I'm getting is

##[error]Publishing build artifacts failed with an error: Not found PathtoPublish: /Users/runner/runners/2.165.0/work/1/a/build

Which makes it seem VERY similar to this issue https://stackoverflow.com/questions/44545862/fix-error-publish-build-artifacts-failed-with-error-not-found-pathtopublish

I don't think this issue should be closed as it has not been resolved yet.

@dkwl93 I'm not seeing the PathtoPublish error discussed anywhere else in this thread. That, combined with the fact that the original issue was filed related to 0.61.2 rather than your version 0.61.5 makes me suspect that they might not be the same cause.

I checked a few of the other reports before your message that indicated the fix was ineffective; and noted that in only one case was an error message shown, but indirectly: https://github.com/microsoft/appcenter/issues/1285#issuecomment-564173908

That error did look similar-ish, but not quite the same as the original one discussed in this thread. I don't know if it's actually related; but it's symptomatically closer to the original issue.

@King-of-Spades You're right. Mine was a different issue. I had to set def enableSeparateBuildPerCPUArchitecture = false in my android/app/build.gradle

Thanks for looking into it.

Thanks for confirming that, I'm seeing at least 1 other report of an error that's similar to yours, but not the original one on this thread; so I'm checking with them if your fix or something similar would work for them. I love the irony of it :D

The name of application in package.json must not have an uppercase letter, this fixed my problem !

Was this page helpful?
0 / 5 - 0 ratings