How to increase Android project’s minSdk version in EXPO project? - android

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.

Related

Task :react-native-splash-screen:processDebugAndroidTestManifest FAILED

command i'm trying to run:
./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug
Most of the progress works without failure, but near 90% I get an error message
Error Message:
Task :react-native-splash-screen:processDebugAndroidTestManifest FAILED
[androidx.vectordrawable:vectordrawable-animated:1.0.0] /Users/devingantt/.gradle/caches/transforms-3/8513b8b73b7884b15d157c479782c91b/transformed/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/devingantt/Documents/pqaa_detox/node_modules/react-native-splash-screen/android/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest1586857056775225339.xml:5:5-74 Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.68.2] /Users/devingantt/.gradle/caches/transforms-3/20ecbe39ea883ff454b9d4682071f45b/transformed/jetified-react-native-0.68.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.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-splash-screen:processDebugAndroidTestManifest'.
> Manifest merger failed with multiple errors, see logs
build.gradle
buildscript {
ext {
ext.kotlinVersion = '1.3.40' // (check what the latest version is!)
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
buildToolsVersion = "29.0.2"
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:7.0.2')
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
I'm having trouble understanding the error message as my minSdkVersion is 21 which should be higher than the 16 that appears. Doing a search in the repo for "16" doesn't appear to help either.
I found a working solution on github https://github.com/uxcam/react-native-ux-cam/issues/24#issuecomment-892547229 adding this to build.gradle seems to fix the problem
subprojects {
...
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
}
}
}
}
}

gradle file config to target android API 22

I have installed Android Studio 3.1.13 with gradle 4.8.1 and java 1.8.0_171, previously installed. I have installed also the SDK API 22 because I need to test an app in Android 5.1.1
The problem is that the default configuration has compileSdkVersion 28 and I had changed it to 22. I have tried many settings but there are always errors due to the version of android API
My current module build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.company.test"
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.0.0'
}
and the proyect build.gradle is
buildscript {
repositories {
google()
jcenter()
}
dependencies {
//classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
When I tried to build, the IDE now says
The SDK Build Tools revision (22.0.1) is too low for project ':app'. Minimum required is 25.0.0
Don't know how can I build and test and app for API 22. I'm newbie in Android develpoment. Thanks in advance
As far as I understand your question, the app needs to be tested running on android api level 22 right?
Based on this assumption I would say the most straight forward solution would be to keep every value on default (as long as this worked for you before). Just lower the minSdkVersion to 22.
Short explanation of most important values:
compileSdkVersion 22 : API Level the app is compiled against
buildToolsVersion '22.0.1' : Buildtools Version to compile code (has to match compileSdkVersion)
minSdkVersion 22 : This is the minimum api you want the app running on.
targetSdkVersion 22 : Simply says, you tested your app running on specified API. Google now uses this to determine if your app is up to date to be published in Playstore or not
As emandt already mentioned BUILDTOOLS and gradle should be up to date, as well as targetSdkVersion and compileVersion.
TESTING APP ON API Level:
As long as you compiled your app for a target higher than minSdk you can simply build and install the apk to a device running the requested API level.
The "buildToolsVersion" string should be compatible with the "classpath 'com.android.tools.build:gradle:x:x:x" setting.
You have to lower the second setting until it is accepted.
However I suggest to use latest BUILD TOOLS and latest GRADLE and not revert back to an old ones. Those Tools affect only the Build procedure, not the App itself.

Importing older gradle projects into android studio

How do i import a project downloaded from github which is based on an older gradle version (2.0.0)?
here is my build.gradle-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.3"
minSdkVersion = 14
targetSdkVersion = 23
}
whenever i change the gradle version to 2.1.2 (which is the gradle version used by all my projects), the project gets stuck on the "building.." message and never imports-
classpath 'com.android.tools.build:gradle:2.1.2'
I even tried replacing the whole build.gradle file with the one in my projects, and still no luck.
This is what i do after importing project from Github
There are two gradle files as shown is picture
In first gradle file replace class path with yours
classpath 'com.android.tools.build:gradle:2.1.2'
now in other gradle file as shown in figure
replace these below lines with yours
compileSdkVersion 23
buildToolsVersion "23.0.2"
and
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
If there are dependencies on libraries than you would require to change them too
Also try to check root gradle file and properties.
Use default gradle wrapper . It could be found in File->Settings ->Build->Build Tools->gradle.
disable InstantRun though its require but could be helpful sometimes.
Try this .

Execution failed for task :appprocessDebugManifest. Manifest merging failed. See console for more info

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
apply plugin: 'android'
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
}
}
defaultConfig {
minSdkVersion 8
targetSdkVersion 16
}
}
Still no luck after much researching. I change the version number, and the android manifest matches the minSdkVersion and targetSdkVersion as the build.gradle file above. No idea why this doesn't work?!?
In gradle build system minSdkVersion and targetSdkVersion defined in AndroidManifest.xml file will be replaced by what you have mentioned in build.gradle file.
If you are using multiple modules or libraries in your project make sure all build.gradle files as well as AndroidManifest.xml files having same set of configuration for minSdkVersion and targetSdkVersion.
UPDATED
It might possible that any library like google_play_services or other is using different minsdkVersion .
Check your Gradle Console output and make the required changes in your AndroidManifest.xml files as well as in build.gradle files. Also take care that all your build.gradle and AndroidManifest.xml files should have same minsdkVersion. I tried with different values and finally found that most of the libraries uses minSdkVersion 8 .
Also for better practice you can remove min and target sdk from Manifest and have them in build.gradle file only for minimal confusion.

Android Studio: Manifest merging failed for adding aar for sherlock action bar

I tried adding sherlock as an aar using gradle and it states an error saying "manifest merging failed. See console for more info".
Where exactly is the console ? I am using Windows, I see no windows in Android Studio claiming to be a console. I presume I would get to see more info here ?
This is my gradle file, my minsdk and tarjetsdk are the same in my manifest and my build.gradle.
Anyone had this and fixed it ?
Here is my gradle file
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0','com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
}
Thanks in advance
I guess targetSDK is higher in ABS.
Check console out and set your targetSDK to 18.

Categories

Resources