Downgrade project version in android studio from 6.0 to 5.0

Asked

Viewed 189 times

0

I developed a project in android studio API 23: Android 6.0 (Marshmallow). However, the project should be developed for android 5.0. I would like to know if there is the possibility of doing some kind of downgrade to the version API 21: Android 5.0 (Lollipop) in android studio?

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "br.eng.itech.execamera_2019101"
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

2 answers

2


I developed a project in android studio on API 23: Android 6.0 (Marshmallow).

No, the project was developed using API 28 as indicated in build.Gradle with compileSdkVersion 28.

I wonder if there is the possibility to do some kind of downgrade for version API 21: Android 5.0 (Lollipop)

I don’t know exactly what you want or why to do "downgrade". Whatever the reason, consider the following:

  • You should always compile the application using the latest version of the API. This way you can use all the features of the SDK, including new ones that do not exist in previous versions.
    You must indicate it in build.Gradle in compileSdkVersion version.

  • Where your application can run, depends on what you were informed on build.Gradle in defaultConfig(equivalent to tag <uses-sdk> in the Androidmanifest.xml).

    She has three attributes:

    • android:minSdkVersion="integer"
    • android:targetSdkVersion="integer"
    • android:maxSdkVersion="integer"

    These three attributes allow the application to inform its compatibility with one or more versions of Android.

    Its meaning is as follows:

    • android:minSdkVersion="integer" - Indicates the minimum API level required for the application to run. Android will not let the application be installed on devices with an API level lower than the value indicated by this attribute.

    • android:targetSdkVersion="integer" - Indicates the level of the API for which the application was made. Informs the system that the application has been tested to run at this level and the system should not provide any kind of "compatibility behavior" to run on devices with the same API level.

    • android:maxSdkVersion="integer" - Indicates the maximum level of API the application can run on. Android will not allow the application to be installed on devices with an API level higher than the value indicated in this attribute.

      Heed: The declaration of this attribute is not recommended, new versions of the API are designed to be compatible with previous versions. There is no reason to intensionalmente block the possibility of the application to be installed in new versions.

  • 1

    I believe he just can not run the app on android 5 because of minSdkVersion 23, If he changes it to 21 I think he’s got it where he wants it

  • @Brunoromualdo It is possible that this is why the AP says it wants to do "downgrade", I do not know. However a more comprehensive and explanatory answer is more useful.

  • Exactly! The big issue is that the app runs perfectly on devices with version 6.0 or higher. However, users who still own devices with android 5.0 fail to install the application. For this reason, I would like to do the ""downgrade" of the version I developed for 5.0. If this is not possible, I will have to develop the whole project again in version 5.0!?

1

Change the minSdkVersion 23 to 21.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.