use a compatible library with a minSdk of at most 16 - android

Hi I am trying to build detox to test my app. I am facing compatibility issue. My app runs with android versions 21 to 31. I get the below error when I run the command "yarn detox build -c android"
Error:
Task :react-native-midnight:processDebugAndroidTestManifest FAILED [androidx.vectordrawable:vectordrawable-animated:1.0.0]
/Users/user/.gradle/caches/transforms-2/files-2.1/5677f0d1d2fd33816116c626e2dd87f1/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.
/Users/user/projects/MyWorkspaceapp/node_modules/react-native-midnight/android/build/intermediates/tmp/manifest/androidTest/debug/manifestMerger10963475594834660155.xml:5:5-74
Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.65.2]
/Users/user/.gradle/caches/transforms-2/files-2.1/b7e25968130290bea6922f5b0f7f24b0/jetified-react-native-0.65.2/AndroidManifest.xml
as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
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.
build.gradle:
ext {
compileSdkVersion = 31
targetSdkVersion = 31
minSdkVersion = 21
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
// buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion 21
targetSdkVersion 31
multiDexEnabled true
}
}
AndroidManifest.xml
> <uses-sdk android:minSdkVersion="21"
> android:targetSdkVersion="31"
> android:maxSdkVersion="31"
> tools:overrideLibrary="com.facebook.react" />

Add the below line in build.gradle. It works
subprojects {
ext {
compileSdk = rootProject.ext.compileSdkVersion
minSdk = rootProject.ext.minSdkVersion
targetSdk = rootProject.ext.targetSdkVersion
}
afterEvaluate { subproject ->
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
}
}
}
}

Related

firebase messaging from minSdkVersion error on android with flutter

When I debug on android I get the error regarding minSdkVersion.
I tried adding:
android {│
defaultConfig {
minSdkVersion 19
}
}
in the build.gradle file but it didn't work. Also I added:
flutter.minSdkVersion = 21
flutter.targetSdkVersion = 30
flutter.compileSdkVersion = 30
in the local.properties file but that also didn't work
Add this to the build.gradle
defaultConfig {
minSdkVersion 21
multiDexEnabled true
}
and
dependencies {
...
implementation 'com.android.support:multidex:1.0.3'
}

Method for arguments with gradle in android studio

Syncing the project files with gradle files in android studio is resulting in the following error
Error:(14, 0) Could not find method applicationId() for arguments [com.amazon.mysampleapp] on project ':app' of type org.gradle.api.Project.
where the gradle file reads
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
applicationId "com.amazon.mysampleapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
What is happening here? Removing applicationID moves the error to minSdkVersion
The applicationId doesn't go inside the android block, but instead your buildConfig block:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
applicationId "com.example.my.app"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
Pulled that from this page about applicationId: http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename

Android Studio: use one version number for all modules

I'm building a complex project with multiple modules that gets build together to create a distributed sdk.
My purpose is to have one variable for version major, minor and revision who I later inject into the buildConfig.
Cant find how to do it.
This is what I tried so far:
project1:
// PROJECT VERSIONS
project.ext {
major = 1
minor = 7
revision = 2
}
project2:
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode project(':project1').ext.major
versionName "1.0"
}
Thank you!
You can configure these values in the build.gradle file in the root of the project.
Example:
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.1"
minSdkVersion = 15
targetSdkVersion = 23
}
Then in the module/build.gradle you can use:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
//...
}
In the beginning of build.gradle of project2 add the following line:
evaluationDependsOn(':project1')
Then the evaluation you wrote will work.

Running different version in Android library versus your app

I have the following in my main app:
...
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 19
versionName "1.0.5"
}
...
In a library I use, this is defined:
...
android {
compileSdkVersion 17
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 7
}
...
I have uppgraded my API target etc. in my app. The library I have, use the same API target etc. (haven't changed the code). If I upgrade my app and use libraries, can I leave them as is? Or do I need to sync the two in respect with compileSdkVersion, buildToolsVersion, minSdkVersion and targetSdkVersion?

Failure [INSTALL_FAILED_OLDER_SDK]|

I do not find an answer. help!
I can not emulate my app that I get the error title .. all my information from the device and project is as follows:
Choose Device:
samsung GT-19300 Android 4.3(API 18) ---> No, minSdk(API 20) > deviceSdk(API 18)
build.gradle:
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "app.bluezone.win"
minSdkVersion 20
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
AndroidManifest.xml:
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="22"/>
What should I do?
Instead of changing the minSdkVerison & targetSdkVersion in build.gradle
Just open the Manifest file and use this
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21"/>
Ref : Android Studio : Failure [INSTALL_FAILED_OLDER_SDK]
Can you please try with below code
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "app.bluezone.win"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
also remove sdk stuff from manifest file
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21"/>

Categories

Resources