React Native CLI project does not work on Android with a Mac M1 Max

I have a Mac m1 Max, trying to get a fresh project running,it is runing IOS without problem, but no luck on android, the error message I’m getting is the following when trying to build and run using react-native run-android --verbose
The following errors are reported:

I did install java with sdkman:

        | 8.0.322 | zulu | installed | 8.0.322-zulu

error Failed to install the app. Make sure you have the Android development environment set up: Setting up the development environment · React Native.

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01

Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

Warning: unexpected element (uri:“”, local:“base-extension”). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ‘:app:processDebugResources’.

Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.

Failed to transform appcompat-1.3.0.aar (androidx.appcompat:appcompat:1.3.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.

  > Execution failed for AarResourcesCompilerTransform: /Users/xlan/.gradle/caches/transforms-3/d7f19fb48ed68be2921ae87dc8e58f8e/transformed/appcompat-1.3.0.

     > AAPT2 aapt2-4.2.2-7147631-osx Daemon #1: Daemon startup failed

       This should not happen under normal circumstances, please file an issue if it does.

Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.

  > Execution failed for AarResourcesCompilerTransform: /Users/xlan/.gradle/caches/transforms-3/540dbfb90b248d7b59cd154497c15f99/transformed/core-1.5.0.

     > AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Daemon startup failed

       This should not happen under normal circumstances, please file an issue if it does.

Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.

  > Execution failed for AarResourcesCompilerTransform: /Users/xlan/.gradle/caches/transforms-3/540dbfb90b248d7b59cd154497c15f99/transformed/core-1.5.0.

     > AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Daemon startup failed

       This should not happen under normal circumstances, please file an issue if it does.

Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.

  > Execution failed for AarResourcesCompilerTransform: /Users/xlan/.gradle/caches/transforms-3/540dbfb90b248d7b59cd154497c15f99/transformed/core-1.5.0.

     > AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Daemon startup failed

       This should not happen under normal circumstances, please file an issue if it does.

Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.

  > Execution failed for AarResourcesCompilerTransform: /Users/xlan/.gradle/caches/transforms-3/540dbfb90b248d7b59cd154497c15f99/transformed/core-1.5.0.

     > AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Daemon startup failed

       This should not happen under normal circumstances, please file an issue if it does.

Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.

  > Execution failed for AarResourcesCompilerTransform: /Users/xlan/.gradle/caches/transforms-3/540dbfb90b248d7b59cd154497c15f99/transformed/core-1.5.0.

     > AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Daemon startup failed

       This should not happen under normal circumstances, please file an issue if it does.

Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.

  > Execution failed for AarResourcesCompilerTransform: /Users/xlan/.gradle/caches/transforms-3/540dbfb90b248d7b59cd154497c15f99/transformed/core-1.5.0.

     > AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Daemon startup failed

       This should not happen under normal circumstances, please file an issue if it does.

Failed to transform core-1.5.0.aar (androidx.core:core:1.5.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.

  > Execution failed for AarResourcesCompilerTransform: /Users/xlan/.gradle/caches/transforms-3/540dbfb90b248d7b59cd154497c15f99/transformed/core-1.5.0.

     > AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Daemon startup failed

       This should not happen under normal circumstances, please file an issue if it does.
  • Try:

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.

BUILD FAILED in 16m 10s

at makeError (/Users/xlan/projects/baredemo/node_modules/execa/index.js:174:9)

at /Users/xlan/projects/baredemo/node_modules/execa/index.js:278:16

at processTicksAndRejections (node:internal/process/task_queues:96:5)

at async runOnAllDevices (/Users/xlan/projects/baredemo/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)

at async Command.handleAction (/Users/xlan/projects/baredemo/node_modules/@react-native-community/cli/build/index.js:192:9)
1 Like

Same situation here. I have spent days until realizing this. Same projects builds a APK on Linux, but on a Mac with a M1 CPU it fails. I have to use two devices to maintain the project.

Well, the error suggests to report an issue, so I suggest you do that.
But not here which is not for reporting bugs and actually not at Gradle at all, as the message comes from AarResourcesCompilerTransform which is a class of the Android Gradle Plugin.
So it should be reported on the Google Android bug tracker if there is none yet. :slight_smile: