uxcam / react-native-ux-cam

54 stars 10 forks source link

Gradlew Build Failure with UX-CAM on assembleAndroidTest #115

Closed WarleyLopes closed 8 months ago

WarleyLopes commented 12 months ago

Description

Encountering build issues with assembleAndroidTest gradlew build of our app on version 5.14.13, specifically when the target/compile SDK is above the version supported by UX-CAM.

Conditions

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
    }
    // ... other configurations ...
}

Steps to Reproduce

  1. Run ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug inside the android folder.

Observed Behavior

The build fails with the following error:

> Task :react-native-ux-cam:checkDebugAndroidTestAarMetadata FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-ux-cam:checkDebugAndroidTestAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > 34 issues were found when checking AAR metadata:

       1.  Dependency 'androidx.appcompat:appcompat:1.6.1' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :react-native-ux-cam is currently compiled against android-32.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 33, for example 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).
[...]
      34.  Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that
           depend on it to compile against version 33 or later of the
           Android APIs.

           :react-native-ux-cam is currently compiled against android-32.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 33, for example 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

Key issues include dependencies requiring a compileSdkVersion of at least 33, while :react-native-ux-cam is currently compiled against android-32.

Potential Solution

Exploring the possibility of making UX-CAM compile with mismatching SDK settings by modifying the android/build.gradle to reference the root project's settings:

minSdkVersion = rootProject.ext.minSdkVersion ?: 21
compileSdkVersion = rootProject.ext.compileSdkVersion ?: 32
targetSdkVersion = rootProject.ext.targetSdkVersion ?: 32
DFDIEGOH commented 12 months ago

Thank you for sharing this @WarleyLopes We will investigate this internally and keep you posted on any updates

omerts commented 8 months ago

@DFDIEGOH Any updates on the above? this also breaks our build with latest React Native 0.73.5

omerts commented 8 months ago

It is any easy fix, just bump the compilieSDKVersion to 33, created #121

rubin22 commented 8 months ago

@omerts can you make a commit. There has been a change in main branch. Unable to merge since there is a conflict. Thanks for PR.