There is a way of increasing the minSdk version of an Android build in an EXPO managed project?
I am using a custom-dev-client with native code. When I run the command for creating a build in Android I got next error: Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 24 declared in library [com.squareup.sdk.in-app-payments:buyer-verification:1.5.4]
Any help will be appreciated a lot.
Thanks
use expo-build-properties,
docs https://docs.expo.dev/versions/latest/sdk/build-properties/
In the root android/build.gradle there should be a setting:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 24
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
You should be able to increase/decrease the version there. When you build it'll take this and update the minSdkVersion for the whole application, including your manifest so no need to change anywhere else explicitly.
In build.gradle file, add this under dependencies
implementation "androidx.car.app:app:1.1.0-beta01"
Then rebuild the project, it only shows
:app:processDebugManifest >
Manifest merger failed with multiple errors, see logs
No more error details.
I have checked AndroidManifest.xml
There is no any warnings or errors.
The following is my setting in build.gradle file:
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "com.app.mobile"
minSdkVersion 23
targetSdkVersion 30
...
}
...
dependencies {
implementation "androidx.car.app:app:1.1.0-alpha02"
...
}
}
Android Gradle Plugin Version:3.3.2 Gradle Version:5.3
I have o change the mincompilesdkversion to 30 and then again to 29 now I am getting this error.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.appcompat:appcompat:1.4.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\75e2de9081ba66388e83ea28d3fd2da1\appcompat-1.4.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.appcompat:appcompat-resources:1.4.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\290cdab22c9c5b1b7c3f8650a9e9566d\jetified-appcompat-resources-1.4.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.emoji2:emoji2-views-helper:1.0.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\c885669bddbda30b297932769f58904c\jetified-emoji2-views-helper-1.0.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.emoji2:emoji2:1.0.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\078363885b7b4397f6f0ba1e544abc8e\jetified-emoji2-1.0.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.core:core:1.7.0-alpha01.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\805c250fb9ce03c9ddefabde06af7912\core-1.7.0-alpha01\META-INF\com\android\build\gradle\aar-metadata.properties.
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
BUILD FAILED in 8s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
Multiple task action failures occurred:
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.appcompat:appcompat:1.4.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\75e2de9081ba66388e83ea28d3fd2da1\appcompat-1.4.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.appcompat:appcompat-resources:1.4.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\290cdab22c9c5b1b7c3f8650a9e9566d\jetified-appcompat-resources-1.4.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.emoji2:emoji2-views-helper:1.0.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\c885669bddbda30b297932769f58904c\jetified-emoji2-views-helper-1.0.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.emoji2:emoji2:1.0.0-alpha03.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\078363885b7b4397f6f0ba1e544abc8e\jetified-emoji2-1.0.0-alpha03\META-INF\com\android\build\gradle\aar-metadata.properties.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.core:core:1.7.0-alpha01.
AAR metadata file: C:\Users\dell.gradle\caches\transforms-2\files-2.1\805c250fb9ce03c9ddefabde06af7912\core-1.7.0-alpha01\META-INF\com\android\build\gradle\aar-metadata.properties.
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
If you are coming here after Nov 4/22 where react native released 0.71.0-rc0 and you are unable to build your android project as i was follow this.
📢 Patches for >= 0.63
Releases for all the main versions of react-native with an hotfix:
🛳 0.70.5: https://github.com/facebook/react-native/releases/tag/v0.70.5
🛳️ 0.69.7: https://github.com/facebook/react-native/releases/tag/v0.69.7
🛳 0.68.5: https://github.com/facebook/react-native/releases/tag/v0.68.5
🛳️ 0.67.5: https://github.com/facebook/react-native/releases/tag/v0.67.5
🛳️ 0.66.5: https://github.com/facebook/react-native/releases/tag/v0.66.5
🛳️ 0.65.3: https://github.com/facebook/react-native/releases/tag/v0.65.3
🛳️ 0.64.4: https://github.com/facebook/react-native/releases/tag/v0.64.4
🛳️ 0.63.5: https://github.com/facebook/react-native/releases/tag/v0.63.5
By updating to these patch versions, your Android build should start working again.
To do so, in your package.json change react-native's version to the relevant new patch (ex. if you are on 0.64.3, change to 0.64.4) and run yarn install. No other changes should be necessary, but you might want to clean your android artifacts with a cd android && ./gradlew clean before trying to re-run your Android app.
Fix for older react-native (< 0.63)
The fix above only works on gradle 6.2 and higher. Older react-native used older gradle.
You may determine your gradle version by looking in your /android/gradle/wrapper/gradle-wrapper.properties file.
If you are on an older version of react-native (for example 0.63 or earlier) that uses gradle version 6.1 or below, you must use a different workaround as gradle 6.1 does not support exclusiveContent.
Add this in the allprojects area of your android/buld.gradle file.
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
More detailed info about the problem and the fix here: https://github.com/facebook/react-native/issues/35210
change these two lines and its now working
this was solution for react-native version .67 and lower
from
compileSdkVersion = 29
targetSdkVersion = 29
to
compileSdkVersion = 30
targetSdkVersion = 30
for latest version here are the changes
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 33 // with 31 was working fine
targetSdkVersion = 31
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
latest updated on react-native version .70 and above
compileSdkVersion = 33
targetSdkVersion = 33
I fixed it by adding this code to the android/app/build.gradle
dependencies{
...other dependencies,
implementation ("androidx.browser:browser:1.3.0"){
force = true
}
}
I found it after 4 hour of searching and testing several answers.
If you don't want to upgrade to SDK 31, add in android/app/build.gradle
android {
...
defaultConfig {
...
configurations.all {
resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }
}
}
}
Taken form this GutHub answer.
I was facing same issue too.
There was an issue with the library of core-ktx and then I replaced it with this:
implementation("androidx.core:core-ktx:1.6.0")
Change your versions to 30 in app build.gradle:
compileSdkVersion = 30
targetSdkVersion = 30
My issue is resolved may be it helps in your case too.
compileSdkVersion = 31
targetSdkVersion = 31
I'm using RN 0.64.2 version and the react-native-firebase library transitively pulled in the newer version of androidx.browser:browser:1.4.0-alpha01 and androidx.appcompat:appcompat:1.4.0-alpha03.
in my app/build.gradle I forced the androidx.browser:browser and androidx.appcompat:appcompat versions to an earlier ones.
runtimeOnly(group: 'androidx.browser', name: 'browser', version: '1.3.0') {
force = true
}
runtimeOnly(group: 'androidx.appcompat', name: 'appcompat', version: '1.3.1') {
force = true
}
from
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
to
buildToolsVersion = "30.0.0"
minSdkVersion = 16
compileSdkVersion = 30
targetSdkVersion = 30
react-native run-android
I have solved the issue by upgrading buildToolsVersion, compileSdkVersion and targetSdkVersion to 31 from 29
Just add this code block to the end of build.gradle file in app level
configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}
In our case: we re-created our react native app
We had a React Native app react-native#0.65.1 with this config
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
We created a new app react-native#0.70.5 and imported the code. the new config was
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
We faced the same problem (run android failed), so we changed compileSdkVersion from 31 into 33 and it worked, here is the new config
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 31
Changing compileSdkVersion 28 to compileSdkVersion 30
and targetSdkVersion 28 to targetSdkVersion 30 solved my problem
How you solved this issue
Change like this. Updated.
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.theblog"
minSdk 28
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 31
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-database:20.0.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
The error may also be here.
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
}
Check build error description here
I am using react-native-sensitive-info package in my project and I am facing an issue. Build fails with the following error Execution failed for task ':react-native-sensitive-info:lint'.
I looked online and tried adding abortOnError false and also checkReleaseBuilds false but both did not work.
Can any one suggest what I can do to resolve this please.
Thanks
R
[(> Task :react-native-sensitive-info:lint FAILED
Ran lint on variant release: 37 issues found
Ran lint on variant debug: 37 issues found
Wrote HTML report to file:///C:/Development/xxx-Retail-ReactNative/retail-native-app/node_modules/react-native-sensitive-info/android/build/reports/lint-results.html
Wrote XML report to file:///C:/Development/xxx-Retail-ReactNative/retail-native-app/node_modules/react-native-sensitive-info/android/build/reports/lint-results.xml
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-sensitive-info:lint'.
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
lintOptions {
abortOnError false
}
}
...
The first 3 errors (out of 10) were:
C:\Development\xxx-Retail-ReactNative\retail-native-app\node_modules\react-native-sensitive-info\android\src\main\java\br\com\classapp\RNSensitiveInfo\view\Fragments\FingerprintAuthenticationDialogFragment.java:115: Error: Call requires API level 23 (current min is 18): android.content.Context#getSystemService [NewApi]
mActivity.getSystemService(FingerprintManager.class),
~~~~~~~~~~~~~~~~
C:\Development\xxx-Retail-ReactNative\retail-native-app\node_modules\react-native-sensitive-info\android\src\main\java\br\com\classapp\RNSensitiveInfo\view\Fragments\FingerprintAuthenticationDialogFragment.java:115: Error: Class requires API level 23 (current min is 18): android.hardware.fingerprint.FingerprintManager [NewApi]
mActivity.getSystemService(FingerprintManager.class),
~~~~~~~~~~~~~~~~~~
C:\Development\xxx-Retail-ReactNative\retail-native-app\node_modules\react-native-sensitive-info\android\src\main\java\br\com\classapp\RNSensitiveInfo\view\Fragments\FingerprintUiHelper.java:35: Error: Class requires API level 23 (current min is 18): android.hardware.fingerprint.FingerprintManager.AuthenticationCallback [NewApi]
public class FingerprintUiHelper extends FingerprintManager.AuthenticationCallback {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* 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 5.0.
See https://docs.gradle.org/4.8/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 23s
I have added 'abortOnError false' as well.
here is the build.gradle.
lintOptions {
abortOnError false
//checkReleaseBuilds false
}
subprojects {
project.configurations.all {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion rootProject.ext.buildToolsVersion
}
}
}
}
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
compileSdkVersion = 28
buildToolsVersion = "27.0.3"
minSdkVersion = 18
targetSdkVersion = 28
}
settings.gradle
include ':react-native-sensitive-info'
project(':react-native-sensitive-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sensitive-info/android')
gradle.properties
android.useDeprecatedNdk=true
android.enableAapt2=false
android.enableJetifier=false
android.useAndroidX=false
package.json
"react-native-sensitive-info": "5.4.1",
Could you suggest how to fix this please
Based on error 'Error: Class requires API level 23 (current min is 18)' i suggest to change minSdkVersion = 18 to minSdkVersion = 23 in build.gradle.
ext {
compileSdkVersion = 28
buildToolsVersion = "27.0.3"
minSdkVersion = 23
targetSdkVersion = 28
}
In my build.gradle file:
compile 'com.android.support:support-v4:[10.0.0,26.0.0['
compile 'com.android.support:appcompat-v7:[10.0.0,26.0.0['
Running gradle dependencies, shows:
sourcesReleaseCompile - Classpath for compiling the sourcesRelease sources.
+--- project :MyProject
| +--- com.android.support:support-v4:[10.0.0,26.0.0[ -> 26.0.0-alpha1
[...]
| \--- com.android.support:appcompat-v7:[10.0.0,26.0.0[ -> 26.0.0-alpha1
I want to avoid including 26.0.0-alpha1... Why isn't gradle respecting ivy standard notation here?
Test project: https://github.com/benmarten/gradle-dependency-test
Ivy Standard: http://ant.apache.org/ivy/history/latest-milestone/settings/version-matchers.html
Your version is wrong, 26.0.0 has not be released yet. Check the versions you have locally:
$ ls ~/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/
18.0.0/ 22.1.1/ 23.4.0/ 25.0.1/
19.0.0/ 22.2.0/ 24.0.0/ 25.1.0/
19.0.1/ 22.2.1/ 24.0.0-alpha1/ 25.1.1/
19.1.0/ 23.0.0/ 24.0.0-alpha2/ 25.2.0/
20.0.0/ 23.0.1/ 24.0.0-beta1/ 25.3.0/
21.0.0/ 23.1.0/ 24.1.0/ 25.3.1/
21.0.2/ 23.1.1/ 24.1.1/ 26.0.0-alpha1/
21.0.3/ 23.2.0/ 24.2.0/ maven-metadata.xml
22.0.0/ 23.2.1/ 24.2.1/ maven-metadata.xml.md5
22.1.0/ 23.3.0/ 25.0.0/ maven-metadata.xml.sha1
Since 26.0.0-alpha1 is out but 26.0.0 is not, you will need to use +. This works for me with Gradle 3.5:
dependencies {
compile 'com.android.support:support-v4:[10.0.0,26.0.+['
compile 'com.android.support:appcompat-v7:[10.0.0,26.0.+['
}
Possibly unrelated to your question but your project does not compile:
/Users/<>/repo/gradle-dependency-test/app/src/main/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library [com.android.support:appcompat-v7:26.0.0-alpha1] /Users/<>/.android/build-cache/72b0bd3c930a8826bf341b591250d185129357b9/output/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:app:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library [com.android.support:appcompat-v7:26.0.0-alpha1] /Users/<>/.android/build-cache/72b0bd3c930a8826bf341b591250d185129357b9/output/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.136 secs
It turns out, it is your minSdkVersion version. In your app/build.gradle, set your minSdkVersion to 14:
android {
defaultConfig {
minSdkVersion 14
}
}
compileSdkVersion 26 Release Now
Setting up Gradle for api 26 (Android)
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.keshav.retroft2arrayinsidearrayexamplekeshav"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'