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

Android Test Error: uses-sdk:minSdkVersion 18 cannot be smaller than version 21 declared in library #3343

Closed
1 of 2 tasks
karna419 opened this issue Apr 25, 2022 · 9 comments

Comments

@karna419
Copy link

karna419 commented Apr 25, 2022

What happened?

I followed the guideline and tried testing in React Native Android in RN0.64.3. Added Gradle minSdkVersion to 18 as detox official guide suggested having at least 18. This is what I get in cli.

> Configure project :react-native-firebase_messaging
:react-native-firebase_messaging package.json found at /Users/karna/projects/Ram/examinatr-mobile-app/node_modules/@react-native-firebase/messaging/package.json
:react-native-firebase_app package.json found at /Users/karna/projects/Ram/examinatr-mobile-app/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_messaging:firebase.bom using default value: 29.1.0
:react-native-firebase_messaging package.json found at /Users/karna/projects/Ram/examinatr-mobile-app/node_modules/@react-native-firebase/messaging/package.json
:react-native-firebase_messaging:version set from package.json: 14.8.0 (14,8,0 - 14008000)
:react-native-firebase_messaging:android.compileSdk using custom value: 30
:react-native-firebase_messaging:android.targetSdk using custom value: 30
:react-native-firebase_messaging:android.minSdk using custom value: 18
:react-native-firebase_messaging:reactNativeAndroidDir /Users/karna/projects/Ram/examinatr-mobile-app/node_modules/react-native/android

> Task :app:processDebugGoogleServices
Parsing json file: /Users/karna/projects/Ram/examinatr-mobile-app/android/app/google-services.json

> Task :expo-file-system:processDebugManifest
/Users/karna/projects/Ram/examinatr-mobile-app/node_modules/expo-file-system/android/src/main/AndroidManifest.xml:8:9-10:20 Warning:
        provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:8 to replace other declarations but no other declaration present

> Task :app:processDebugMainManifest FAILED
[:react-native-reanimated] /Users/karna/projects/Ram/examinatr-mobile-app/node_modules/react-native-reanimated/android/build/intermediates/library_manifest/debug/AndroidManifest.xml Warning:
        Package name 'com.swmansion.reanimated' used in: :react-native-reanimated, react-native-reanimated-64-jsc.aar.
/Users/karna/projects/Ram/examinatr-mobile-app/android/app/src/debug/AndroidManifest.xml Error:
        uses-sdk:minSdkVersion 18 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.64.3] /Users/karna/.gradle/caches/transforms-3/6a9cd4eeeb285f80b9e6f413ecd78d0d/transformed/jetified-react-native-0.64.3/AndroidManifest.xml as the library might be using APIs not available in 18
        Suggestion: use a compatible library with a minSdk of at most 18,
                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.

ReactNativeFirebase WARNING: NPM package '@react-native-firebase/messaging' depends on '@react-native-firebase/app' v14.8.0 but found v14.7.0, this might cause build issues or runtime crashes.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed with multiple errors, see logs

* 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.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 18s
345 actionable tasks: 345 executed
10:05:36.970 detox[14302] WARN:  [build.js] 

Important: 'detox build' is a convenience shortcut for calling your own build command, as provided in the config file.
Failures in this build command are not the responsibility of Detox. You are responsible for maintaining this command.

10:05:36.976 detox[14302] ERROR: [cli.js] Command failed: cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..

What was the expected behaviour?

Should be able to built detox test in react native android

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

Install RN0.64.3
add detox and setup in android platform
build the detox test

In what environment did this happen?

Detox version: 19.6.5
React Native version: 0.64.3
Node version: 16.14.2
Device model: Emulator Pixel_API_29
Android version:
Test-runner (select one): jest

Detox logs

Detox logs

uses-sdk:minSdkVersion 18 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.64.3] /Users/karna/.gradle/caches/transforms-3/6a9cd4eeeb285f80b9e6f413ecd78d0d/transformed/jetified-react-native-0.64.3/AndroidManifest.xml as the library might be using APIs not available in 18
        Suggestion: use a compatible library with a minSdk of at most 18,
                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)
                
10:05:36.976 detox[14302] ERROR: [cli.js] Command failed: cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..

Device logs

Device logs
paste logs here!

More data, please!

No response

@d4vidi
Copy link
Collaborator

d4vidi commented Apr 25, 2022

It sounds like this is what you're looking for. In any case, I advise setting the min SDK version to at least 21.

Please close the issue if that helps.

d4vidi added a commit that referenced this issue Apr 25, 2022
d4vidi added a commit that referenced this issue Apr 26, 2022
d4vidi added a commit that referenced this issue Apr 26, 2022
d4vidi added a commit that referenced this issue Apr 26, 2022
d4vidi added a commit that referenced this issue Apr 26, 2022
@karna419
Copy link
Author

I still have the issue. I appended

subprojects{ afterEvaluate { android { buildToolsVersion = "29.0.3" compileSdkVersion = 30 defaultConfig { minSdkVersion = 18 targetSdkVersion 30 } } } }

to android/build.gradle file. Curious why detox forcing to use minSdkVersion=18 while recent RN needs at least 21.

@d4vidi
Copy link
Collaborator

d4vidi commented May 1, 2022

Try to apply this code specifically.
Detox doesn't force the SDK version per se. It is typically determined under your project's build.gradle.

@stale
Copy link

stale bot commented Jun 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

@stale stale bot added the 🏚 stale label Jun 10, 2022
@stale
Copy link

stale bot commented Jun 18, 2022

The issue has been closed for inactivity.

@stale stale bot closed this as completed Jun 18, 2022
@d4vidi
Copy link
Collaborator

d4vidi commented Jun 19, 2022

This is likely to be fixed indirectly once we finalize RN .68 compatibility - #3344

@ecexplorer
Copy link

This is still an issue for our team

@ablack34
Copy link

I'm facing a similar issue. My project has a minSdkVersion of 21 but the package has a minSdkVersion of 18.

Is the advice to update the minSdkVersion of this package to 21 or update the minSdkVersion of my actual project to 18? I am using RN70.7.

TIA for any advice! :)

@d4vidi
Copy link
Collaborator

d4vidi commented Feb 23, 2023

@ecexplorer @ablack34 try to apply these stackoverflow suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants