React-native-pager-view: Android build fails for libs with minSdkVersion 17 with react-native 0.64

Created on 3 Apr 2021  路  5Comments  路  Source: callstack/react-native-pager-view

Environment

  • react-native-pager-view: 5.1.2
  • React Native: 0.64.0
  • Node: v14.8.0

Description

The following command fails after upgrading to RN 0.64

./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug

With the following message:

> Task :react-native-pager-view:processDebugAndroidTestManifest FAILED
[androidx.vectordrawable:vectordrawable-animated:1.0.0] /.gradle/caches/transforms-2/files-2.1/3050775700026023c1db3db79ab19a97/vectordrawable-animated-1.0.0/AndroidManifest.xml Warning:
        Package name 'androidx.vectordrawable' used in: androidx.vectordrawable:vectordrawable-animated:1.0.0, androidx.vectordrawable:vectordrawable:1.0.1.
/node_modules/react-native-pager-view/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger2807704319365703146.xml:5:5-74 Error:
        uses-sdk:minSdkVersion 17 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.64.0] /.gradle/caches/transforms-2/files-2.1/4e32a44ca1590525038237dd6b47cd32/jetified-react-native-0.64.0/AndroidManifest.xml as the library might be using APIs not available in 17
        Suggestion: use a compatible library with a minSdk of at most 17,
                or increase this project's minSdk version to at least 21,
                or use tools:overrideLibrary="com.facebook.react" to force usage (may lead to runtime failures)

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

Reproducible Demo

Run ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug

Most helpful comment

All 5 comments

Would it be possible to release this change @troZee as it's currently causing a problem for us trying to build against react native 0.64?

@IPWright83 I have this in my script waiting for the release: sed -i "s/minSdkVersion 17/minSdkVersion getExtOrIntegerDefault('minSdkVersion')/" ./node_modules/react-native-pager-view/android/build.gradle

@Andarius is that supposed to be add something to the file? I gave it a quick try but doesn't seem to be working for me :(

I've also tried adding <uses-sdk tools:overrideLibrary="com.facebook.react"/> into my android/app/src/debug/AndroidManifest.xml file which didn't help. All of which I thought would be irrelevant as our build.gradle defines 23 as our minSdkVersion.

 ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 23
        compileSdkVersion = 29
        targetSdkVersion = 29
        kotlinVersion = '1.3.61'
        ndkVersion = "20.1.5948944"
    }

It'll replace the line containing minSdkVersion 17in the build.gradle of react-native-pager-view with minSdkVersion getExtOrIntegerDefault('minSdkVersion'). Run this after a yarn install from your folder that contains node_modules

Was this page helpful?
0 / 5 - 0 ratings

Related issues

supermaverickws picture supermaverickws  路  8Comments

olhapi picture olhapi  路  4Comments

KingAmo picture KingAmo  路  9Comments

troZee picture troZee  路  8Comments

orcunorcun picture orcunorcun  路  9Comments