hufans / react-native-alioss

aliyun oss for react native
MIT License
16 stars 8 forks source link

Android: Task :rn-alioss:verifyReleaseResources FAILED #13

Open emclab opened 1 year ago

emclab commented 1 year ago

When building android release with ./gradlew assembleRelease for React Native 0.70.1/rn-alioss 0.25/gradle on MacOS Monetary/gradle 7.5.1, the build failed with the following error:

> Task :app:compressReleaseAssets
Execution optimizations have been disabled for task ':app:compressReleaseAssets' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/Users/macair/Documents/code/js/xyz_app6/android/app/build/intermediates/assets/release/mergeReleaseAssets'. Reason: Task ':app:compressReleaseAssets' uses this output of task ':app:copyReleaseBundledJs' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :rn-alioss:verifyReleaseResources FAILED
<============-> 96% EXECUTING [5m 35s]
> IDLE
> :react-native-reanimated:downloadBoost > boost_1_76_0.tar.gz > 57.44 MB/124.2
> IDLE
> IDLE
> IDLE
> IDLE
> IDLE
> IDLE

And more:

> Task :rn-alioss:verifyReleaseResources FAILED
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':rn-alioss:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/Users/macair/Documents/code/js/xyz_app6/node_modules/rn-alioss/android/build/intermediates/merged_res/release/values/values.xml:2723: AAPT: error: resource android:attr/lStar not found.

npx react-native run-android runs successfully. Here is the output of npx react-native info:

System:
    OS: macOS 12.5
    CPU: (8) arm64 Apple M1
    Memory: 64.39 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.15.0 - /opt/homebrew/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
    Android SDK:
      API Levels: 29, 30, 31, 32, 33
      Build Tools: 30.0.2, 30.0.3, 31.0.0, 33.0.0
      System Images: android-33 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 14.0/14A309 - /usr/bin/xcodebuild
  Languages:
    Java: 18.0.2 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.1 => 0.70.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

After deleting all under ./gradle and node-modules, and ./gradlew clean, yarn install again. But the error remains the same. Build on React Native 0.68.2 was successful.

emclab commented 1 year ago

The latest gradle version is 7.5.1 and the module used ver 6.1.1. Please bump up the gradle version and the SDK for the module as you can.

emclab commented 1 year ago

in build.gradle for rn-alioss, add the following at the end solved my problem:

configurations.all {
    resolutionStrategy {
        force 'androidx.core:core:1.6.0'
        force 'androidx.core:core-ktx:1.6.0'
    }
}
hufans commented 1 year ago

在 rn-alioss 的 build.gradle 中,在最后添加以下内容解决了我的问题:

configurations.all {
    resolutionStrategy {
        force 'androidx.core:core:1.6.0'
        force 'androidx.core:core-ktx:1.6.0'
    }
}

@emclab Thanks for your resolve if you can pls give me pr

pipi32167 commented 6 months ago

I found this fork can work.