I'm a newbie to Android, and I'm trying to run an existing application.
In the file project.properties I have this line:
target=android-20
While in the manifest file, I have this line:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="14" />
Shouldn't these 2 directives refer to the same SDK version?
Is there any error in the app I'm trying to run?
Both of the two are different things.
minSDKVersion specifies that the app is supported minimum from which API level.
whereas targetSDKVersion mentions that which build-tool API version to be used to build the project. Both could have any value of Android API level but targetSDKVersion should not be less than minSDKVersion. Eclipse also gives error for this.
You might have noticed: when you use library method for old API than minSDKVersion API, It will raise an error asking to change the minSDKVersion. And the targetSDKVersion you are choosing in manifest file, you should have build-tool of that particular API.
Related
I am using instamojo payment library in my project version 3.4.0
compile 'com.instamojo:android-sdk:3.4.0'
when i change min Sdk version from 21 to 19, it is showing me following error
things i have done
change minSdkVersion 19 (in build.gradle app),
then sync,
then sync all project gradle files,
rebuilt project
invalid caches and restart
Any help will be valuable
Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [com.instamojo:android-sdk:3.4.0] C:\Users\Rushabh.gradle\caches\transforms-2\files-2.1\811256b860a0ca6a3de017f237334983\jetified-android-sdk-3.4.0\AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.instamojo.android" to force usage (may lead to runtime failures)
as per the error the library is to minSDK 21 , so you have to use that as minSDK ,as for the particular librays docs please go through in detail , as per build file from github it can be seen minSDK is set as 21.
see here in github of this build file from the library
This is confusing because there are 2 places where you can set the MinSDK. You can set it in the build.gradle file. (which is probably where you looking) and then also you forgot that it is set in "projects structure" screen. Go to the left in android studio and right click on your project and go down to "open module settings F4" in that screen under modules you can set the MinSDK. Make sure that and your build.gradle are the same.
Thank you #0ldMaid! Once I added the same version in both file paths the error went away.
uses-sdk android:minSdkVersion="21"
C:\Users\YourName\source\repos\MauiApp1\Platforms\Android\AndroidManifest.xml
C:\Users\YourName\source\repos\MauiApp1\obj\Debug\net6.0-android\AndroidManifest.xml
I have a Motorola Devour phone, which is quite old, and runs android 1.6. I have been trying to write my own apps for it, but I can't run the gradle sync because my minSdkVersion is 4. It comes out with this error:
Manifest merger failed : uses-sdk:minSdkVersion 4 cannot be smaller than version 14 declared in library [com.android.support:animated-vector-drawable:28.0.0] C:\Users\mccra\.gradle\caches\transforms-1\files-1.1\animated-vector-drawable-28.0.0.aar\19bf506067f85ca5d48da2fd39d59695\AndroidManifest.xml as the library might be using APIs not available in 4
Suggestion: use a compatible library with a minSdk of at most 4,
or increase this project's minSdk version to at least 14,
or use tools:overrideLibrary="android.support.graphics.drawable" to force usage (may lead to runtime failures)
I included the tools:overrideLibrary in the android manifest as
<uses-sdk tools:overrideLibrary="android.support.v7.appcompat, android.support.fragment, android.support.graphics.drawable, android.support.coreui, android.support.coreutils, android.support.loader, android.support.v7.viewpager, android.support.coordinatorlayout, android.support.drawerlayout, android.support.slidingpanelayout, android.support.customview, android.support.swiperefreshlayout, android.support.asynclayoutinflater, android.support.compat, androidx.versionedparcelable, android.support.cursoradapter, android.arch.lifecycle, android.support.documentfile, android.support.localbroadcastmanager, android.support.print, android.arch.lifecycle.viewmodel, android.arch.lifecycle.livedata, android.arch.lifecycle.livedata.core, android.arch.core, android.support.interpolator"/>
as it gave an error for every single api. When I run the gradle sync, I keep getting the same errors as before I overrode them. Then I tried to change the minSdkVersion on each library, but there must be a better way to do this.
Again, I am trying to make this app run on Doughnut, which is android 1.6, and API 4.
You need to get rid of all of those dependencies, as none of them will work on Android 1.6.
My app has a minSdkVersion of 8. I would like to use a library with a minSdkVersion of 14 on devices that support it and fallback to a different component if not. Theoretically, this might be possible using the new manifest merger, but it looks like there's a special case for minSdkVersion:
Defaults to 1.
The higher priority document's version will be used but importing a library with a more recent version will generate an error.
Is there a way to force gradle to include the library dependency so that I can deal with the SDK version issues?
Thanks to #CommonsWare's suggestion, I found the proper incantation. Everything works fine if I add this line to the AndroidManifest.xml:
<uses-sdk tools:node="replace" />
I have a app on the Google Play with the following configuration. Till now I thought that Google Play uses AndroidManifest to determine the minimum and the maximum SdkVersion. Unfortunately as it reveals people could download and install this app on higher APIs.
The question is; how to set maximum API limit for this app (I guess I need to set compileSdkVersion 17 in build.gradle but I have to be sure) before publish the apk.
AndroidManifest.xml (an extract):
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
build.gradle (an extract):
android {
compileSdkVersion 19
//...
}
You are setting targetSdk Version and minSdkVersion
maxSDK Version is a different attribute.
but is discouraged to set it
heres the full version of the code, from developer.android.com
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
As the Google play store indirectly choose the version ,after upload of the apk it looks after our android manifest.xml from there it takes all the information like minsdkversion and maxsdkversion in that manner our app will support based on that values it contain..
I'm using the latest and greatest IntelliJ Community edition. My application runs fine on the android emulator. However, I need the emulator to better match the Kindle Fire. I made the configuration changes in the AVD Manager (including setting device to API 10.)
When I went to my project to configure the project to target the new virtual device, I got the following message: "Build target of AVD DEV3 is not compatible with your build target."
It didn't take much work to figure out that the issue is related to my choice of API 10.
I don't know where I tell my project to use API 10. I looked all over and didn't see any references to the API level at all. Any ideas?
EDIT
I added
<uses-sdk android:minSdkVersion="10" />
to my AndroidManifest.xml file and was able to select the new device. I'm starting it up now.
The answer above is no longer true in Intellij (using gradle)
Now <uses-sdk> is ignored in the AndroidManifest.xml, it is automatically added to the built manifest file. To change the version, go to the 'build.gradle' file and look at the minSdkVersion.
As Tony and Blundell mention, the answer is to declare your minSdkVersion in your AndroidManifest.xml file. In this way, the application will be allowed to launch on any AVDs that at least meet the minSdkVersion.
Here's more documentation on the <uses-sdk> tag:
http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
Set this value in the Gradle file - as shown here:
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.kotlinconverterapp"
**minSdkVersion 26**
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}