How to reduce my minSdkVersion on my module? - android

I developed a networking module for my company. The initial defaultConfigs we set defined minSdk as 29 and it was with these settings that version 1.0.0 of this module was published. Now the need arose to reduce this value to 26 or even less, if possible. I already changed the minSdkVersion to 26 in the module and published a new version, but I always get the same error:
Manifest merger failed : uses-sdk:minSdkVersion 26 cannot be smaller than version 29 declared in library [nearsea-technologies:android.network:1.0.1] (...)/.gradle/caches/transforms-3/c729ae7e60a0cde9500d48b107ed3b46/transformed/android.network-1.0.1/AndroidManifest.xml as the library might be using APIs not available in 26
Suggestion: use a compatible library with a minSdk of at most 26,
or increase this project's minSdk version to at least 29,
or use tools:overrideLibrary="nst.android.network" to force usage (may lead to runtime failures)
This is the defaultConfig of my module and my current project is the same.
defaultConfig {
minSdk = 26
targetSdk = 33
(...)
}
How can I resolve this? What do I need to do? What am I missing?
If you need more code, I can make it available.

In AndroidManifext.xml for your module just add line:
<uses-sdk tools:overrideLibrary="nst.android.network" />

Related

Could not find method compileSdk() for arguments [30] on extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension

I got the above error compileSdk() not found. While creating the app I have installed TargetSdk 31 and min SDK 19 But Apk does not install on Oreo Version so I have changed TargetSdk 31 to 31 and minSdk 19 to 16. I have uninstalled SDK 31 but it partially uninstalls. Please help me to solve this problem I am new to Android.
I have been strugling with this issue for hours until I looked at some older project. For some reason, newer versions of Android Studio mess up the directives from the Gradle file.
Just add "Version" after the name and it will work. So where you see "compileSdk" just rename it to "compileSdkVersion". You will probably also have to do that in "targetSdk" and so on.
in your <android_proj>/app/build.grandle instead of targetSdk 30 use:
android {
...
defaultConfig {
...
targetSdkVersion 30
}
}

i got this error while i builde my project

Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller
than version 16 declared in library
[com.google.firebase:firebase-iid:20.0.2]
C:\Users\bushi.gradle\caches\transforms-2\files-2.1\946a39d7756c6b05aa38a853bdffc128\firebase-iid-20.0.2\AndroidManifest.xml
as the library might be using APIs not available in 15 Suggestion:
use a compatible library with a minSdk of at most 15, or increase
this project's minSdk version to at least 16, or use
tools:overrideLibrary="com.google.firebase.iid" to force usage (may
lead to runtime failures)
Change minSdkVersion 15 in your build.gradle file to minSdkVersion 16.
The libraries you are referencing require a later version of Android.
You can find the build.gradle file under Gradle Scripts in Android Studio. The change you want to make is in the (Module: app) build file.

Android Studio API level error for Android Wear

I am trying to run and test a simple android application using android studio(version 3.0.1) on a smartwatch, I am getting the below error with respect to the gradle sync. (I am creating an new project by selecting the wear with the API level of 22 which is same as smartwatch API level).
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 22 cannot be smaller than version 23 declared in library [com.android.support:wear:26.1.0] C:\Users\Sai.gradle\caches\transforms-1\files-1.1\wear-26.1.0.aar\5b2a40104c2cc0843c9e44597771b49a\AndroidManifest.xml as the library might be using APIs not available in 22
Suggestion: use a compatible library with a minSdk of at most 22,
or increase this project's minSdk version to at least 23,
or use tools:overrideLibrary="android.support.wear" to force usage (may lead to runtime failures)
I have looked up for this error in most of the stackoverflow post's and they suggested to change the minimum SDK version in the build.GRADLE (app module) file in the defaultConfig section to 23, and the error doesn’t appear when I change the version to 23 as below.
defaultConfig {
applicationId "com.example.sai.wearexample"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
But, if I change the minSdkVersion version to 23 then there is the below error while I want to run the application on the smartwatch.
I have looked into many of the answers in the stackoverflow but I am not able to get any of the specific resolutions for this question. I am stuck in between these two errors, any help would be appreciated.
You should not use com.android.support:wear for api <23.
For the views you can add:
provided 'com.google.android.wearable:wearable:2.3.0'
compile 'com.google.android.support:wearable:2.3.0'
And change in your java and xml the code for use the tools of
com.google.android.wearable
instead
com.google.android.support:wearable
For example, use android.support.wearable.view.BoxInsetLayout instead of android.support.wear.widget.BoxInsetLayout.
I hope I have helped.

How to support multiple Android versions (4.1 through 7.0)?

How to make android app run on versions 4.1 through 7.0?
The following statement was added to the manifest file
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="25"/>
However it still only works on 7.0. What's required to support lower versions too?
Update your app's Gradle file with that:
android {
compileSdkVersion 25 // it is recommended to be the same of targetSdkVersion
defaultConfig {
minSdkVersion 14 // Android 4.1
targetSdkVersion 25 // Android 7.1
}
}
But maybe you wanna to support Android Oreo to, in this case compileSdkVersion and targetSdkVersion must be set to 26 (Android always ask to your support the last version)
There is a article which explain in more details minSdk, maxSdk and compileSdk: link to article

Trouble on android linux in Jenkins

meet face to face with trouble that :
java.lang.UnsupportedOperationException: Robolectric does not support API level 1, sorry!
properties in my build gradle :
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
What it can be?
versionCode in your code example is 1, the exception says API level 1 is not supported...I have the impression that "versionCode" represents the API level. What happens if you increase the versionCode - Value?
am not sure about your environment or tool setup, just make sure that your jenkins build is configued to build using gradle/gradle based build tool (only they will parse build.gradle file and generate a Manifest with proper fields) or if u r using some other build tool update the AndroidManifest with appropriate api level values

Categories

Resources