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

Create GitHub Actions Java w Gradle debug workflow on Ubuntu 20.04 for AGP 7.1.1+ resolving ReactAndroid:configureNdkBuildDebug #276

Merged
merged 133 commits into from
Apr 27, 2022

Conversation

leotm
Copy link
Owner

@leotm leotm commented Jan 15, 2022

Edit: TL;DR


0.68.1, AGP 7.0.4

Execution failed for task ':app:mergeDexRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
   > There was a failure while executing work items
      > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
         > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
           Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
           Type com.facebook.react.viewmanagers.ActivityIndicatorViewManagerInterface is defined multiple times: /home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/android/app/build/intermediates/project_dex_archive/release/out/com/facebook/react/viewmanagers/ActivityIndicatorViewManagerInterface.dex, /home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/build/.transforms/0d458503427e991dea020f09247b1474/transformed/classes/classes.dex

0.68.0-1, NDK 21/24, AGP 7.1.1 (more logs)

> Task :ReactAndroid:configureNdkBuildDebug[<arch>] FAILED
C/C++: /home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/../ReactCommon/butter/Android.mk:28: *** Android NDK: Aborting.    .  Stop.

FAILURE: Build failed with an exception.

Execution failed for task ':ReactAndroid:configureNdkBuildDebug[<arch>]'.
> [CXX1405] error when building with ndkBuild using /home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Build command failed.
  Error while executing process /usr/local/lib/android/sdk/ndk/[21](https://github.com/leotm/react-native-template-new-architecture/runs/5997822205?check_suite_focus=true#step:13:21).4.7075529/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/563[25](https://github.com/leotm/react-native-template-new-architecture/runs/5997822205?check_suite_focus=true#step:13:25)o5v/obj NDK_LIBS_OUT=/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/56325o5v/lib NDK_APPLICATION_MK=/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/src/main/jni/Application.mk THIRD_PARTY_NDK_DIR=/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/build/third-party-ndk REACT_COMMON_DIR=/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/../ReactCommon REACT_GENERATED_SRC_DIR=/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/build/generated/source REACT_SRC_DIR=/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react -j2 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}

7 actionable tasks: 1 executed, 6 up-to-date
  Android NDK: WARNING: Ignoring unknown import directory: /home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/build/generated/source    
  Android NDK: /home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/../ReactCommon/butter/Android.mk: Cannot find module with tag 'glog' in import path    
  Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?    
  Android NDK: The following directories were searched:    
  Android NDK:         
  
  /home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/../ReactCommon/butter/Android.mk:[28](https://github.com/leotm/react-native-template-new-architecture/runs/5997822205?check_suite_focus=true#step:13:28): *** Android NDK: Aborting.    .  Stop.

Nightly

FAILURE: Build failed with an exception.

Build file '/home/runner/work/react-native-template-new-architecture/react-native-template-new-architecture/node_modules/react-native/ReactAndroid/build.gradle' line: 396

A problem occurred evaluating project ':ReactAndroid'.
> Project with path ':ReactAndroid:hermes-engine' could not be found in project ':ReactAndroid'.

Fixed in

PR to Facebook after


GA Virtual Envs - Ubuntu 20.04.4 LTS

  • Architecture: x64
  • .../sdk/ndk-bundle -> .../sdk/ndk/21.4.7075529
  • 21.4.7075529 (default) ANDROID_NDK_HOME / ANDROID_NDK_ROOT
  • 22.1.7171670
  • 23.1.7779620 ANDROID_NDK_LATEST_HOME

GA gradle/gradle-build-action defaults:

  • temurin-11
  • ./gradlew build

RN

Gradle

# :ReactAndroid
# :react-native-...
# :app
# chmod +x gradlew
./gradlew clean
./gradlew check
./gradlew build
./gradlew assembleDebug
./gradlew assembleRelease

Side-by-side NDK (AGP->NDK) (recommended)

So v22/23 needs override

v24/25

  • custom ubuntu-latest Docker image
  • self-hosted runner this MBP M1 2020 on macos 12.3

Docker image history

template, rn-tester

  • ./gradlew assembleDebug

CI (Buck)

  • Test Docker Android Image
  • test_android > Build Android App

BitRise

@leotm leotm changed the title GA gradlew Ad Hoc GitHub Actions Gradle Ad Hoc build Jan 15, 2022
@leotm leotm changed the title GitHub Actions Gradle Ad Hoc build GitHub Java CI with Gradle Action - Android Ad Hoc build Jan 15, 2022
@leotm leotm changed the title GitHub Java CI with Gradle Action - Android Ad Hoc build GitHub Java with Gradle Action - Android Ad Hoc build Jan 15, 2022
@leotm leotm marked this pull request as ready for review January 15, 2022 15:03
@leotm leotm changed the title GitHub Java with Gradle Action - Android Ad Hoc build GitHub Actions - Java with Gradle - Android Ad Hoc build Jan 15, 2022
@leotm
Copy link
Owner Author

leotm commented Feb 27, 2022

Enable after: #377

@leotm leotm added android Native Android changes (Java, Gradle, Kotlin) native ci GitHub Actions workflow - Bundling / Building / Compiling / Integrating / Testing and removed native labels Mar 20, 2022
This reverts commit d748ffb.
33.0.0 rc2 fine locally on MBP M1 2020 Monterey 12.3

But not on ubuntu-latest
To match Ubuntu latest 20.04
- ANDROID_NDK_HOME
- ANDROID_NDK_ROOT

Consider mac-os latest for Android builds

Consider NADROID_NDK_LATEST_HOME 23.1.7779620 override
@leotm leotm added this to the Android CI 1-build milestone Apr 5, 2022
@leotm leotm removed this from the Android New Arch Builds milestone Apr 25, 2022
@leotm leotm added the 🐞 Bugerino: Summin' ain't work'n jimmy label Apr 25, 2022
@leotm leotm changed the title [Ubuntu 20.04] RN 0.68.1 - New Arch - AGP 7.1.1 ReactAndroid:configureNdkBuildDebug [Ubuntu 20.04] RN @0.68.1/nightly - AGP 7.1.1 - ReactAndroid:configureNdkBuildDebug Apr 25, 2022
@leotm leotm added this to the Android Debug APK - AGP 7.1.1+ milestone Apr 26, 2022
@leotm leotm marked this pull request as ready for review April 26, 2022 15:41
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':react-native-screens' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10

https://github.com/leotm/react-native-template-new-architecture/runs/6181690191?check_suite_focus=true#step:6:134

Consider
- Downgrade AGP
- Raise/fix issue
@leotm leotm changed the title [Ubuntu 20.04] RN @0.68.1/nightly - AGP 7.1.1 - ReactAndroid:configureNdkBuildDebug Create GitHub Actions Java w Gradle debug workflow on Ubuntu 20.04 for AGP 7.1.1+ resolving ReactAndroid:configureNdkBuildDebug Apr 27, 2022
@leotm leotm merged commit de48d53 into master Apr 27, 2022
@leotm leotm deleted the ci/java-w-gradle branch April 27, 2022 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Native Android changes (Java, Gradle, Kotlin) ci GitHub Actions workflow - Bundling / Building / Compiling / Integrating / Testing 🐞 Bugerino: Summin' ain't work'n jimmy 🐧 Linux: Ubuntu 22.04 LTS for Android CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Ubuntu 20.04] RN @0.68.1/nightly - AGP 7.1.1 - ReactAndroid:configureNdkBuildDebug
1 participant