how to upgrade android sdk version by command line - android

i am new to Android development and i want to upgrade my android sdk version from 32.1.0-rc1 to 33.0.0-rc2.
And i have another question what is the difference between compileSdkVersion and targetSdkVersion on the file build.gradle on flutter ?

For update sdk by command LINE, see this gist:
https://gist.github.com/srayhunter/4bce340b62109b5bae43
sdkmanager "build-tools;30.0.2" "platforms;
About the difference ...
The compileSdkVersion is the version of the API the app is compiled against. This means you can use Android API features included in that version of the API.
And the targetSdkVersion indicate that you have tested your app on the version you specify.

Related

Android build is failing when updates to compileSDKVersion and targetSDKVersion

I have faced a problem in making an android build was working perfectly since the last 5 months but my Bitrise workflow is failing when I update compileSDKVersion and targetSDKVersion can you please help me are how to solve this issue
Previous
compileSdkVersion : 30
targetSdkVersion : 30
Work perfectly
Currently
compileSdkVersion : 31
targetSdkVersion : 31
Can’t work perfectly
Screen-short
[1]: https://i.stack.imgur.com/80ewD.png
Note:- My project is built in React Native framework, On my local system this project works perfectly and successfully created android build
System Specification:-
OS:- Monterey
RAM:- 16 GB
JDK Version:- 11.0.15
React native version:- 0.65.1
Updating just the SDK versions like that will cause problems because other pieces of React Native might be tied to it. You have to upgrade React Native to the latest version (or whichever version that supports SDK 31).
Undo your changes and upgrade using React Native CLI's upgrade command.
npx react-native upgrade
You can read more about it here.

Developing for older Android version

I want to develop for Android 23 (Marshmallow). I created a new project, modify/remove everything and only use these as my project's components.
Android SDK Build Tools 23.0.3
Android SDK Platform 23
Android Gradle Plugin 2.1.3
Gradle 2.14.1
Target SDK version: 23
Minimum SDK version: 23
Compile SDK version: 23
JDK 1.8.0_211
I manage to get it running on my Android 28 (Oreo) device, but I read it somewhere that the later version of SDK, Build Tools and Gradle provides better security. Should I use all of the latest tools? if so, can I use the latest tools to develop only for Android 23?
Because when I installed Android Studio, it prompt me to target my SDK to 26 since Google Play requires developers to do so. Please teach me the best practice to develop for older Android version. Thank you in advance.
I think you are not aware of what targetSDKversion means.
Let me clarify you. When Google releases a new version of android it brings new features, security and performances improvements. When you configure targetSDKversion then the user can benefit from these improvements while your app still runs on the older version.
For more information:
https://developer.android.com/distribute/best-practices/develop/target-sdk
You do not develop for a single SDK version.
You develop for a RANGE of versions, going from MinimumSDK (yours would be 23) to TargetSDK (minimum of 26 to get into the Play Store, but always best to go the latest possible)
https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/android-api-levels?tabs=windows

The specified Android SDK Build Tools version (19.0.0) is ignored

Warning:The specified Android SDK Build Tools version (19.0.0) is
ignored, as it is below the minimum supported version (26.0.2) for
Android Gradle Plugin 3.0.1. Android SDK Build Tools 26.0.2 will be
used. To suppress this warning, remove "buildToolsVersion '19.0.0'"
from your build.gradle file, as each version of the Android Gradle
Plugin now has a default version of the build tools.
What if I want to develop an apk that can work for API 19?
Is there a way without getting errors to compile and test the application easily?
buildToolsVersion is not your App's minimum API support version. You'll want to use minSdkVersion 19 to support API 19. Generally you'll always want to use the latest build tool version. If you want to test API 19 functionality, download and use the Android 4.4 emulator.

How can I change the defined API version of an Android app?

I am absolutly new in Android development and I have the following problem trying to build a sample project that I have downloaded from Internet.
When I try to build it I obtain the following error message:
Error:Cause: failed to find target with hash string 'android-18' in: C:\Users\Andrea\AppData\Local\Android\sdk
Install missing platform(s) and sync project
So I search online and I found this SO link: Android studio - Failed to find target android-18
Ok so I go into Tools > Android > SDK Manager and infact I have installed Android 6 corrisponding to the API level 23 but not Android 4.3 corrisponding to API level 18.
So what it means? It means that I have installed a different version o the Android framework ?(is it the SDK considerable as a framework or what?)
So, on Android Studio can I install different version of the SDK?
I think that the API level have to be defined in some way into the dowloaded application. How can I specify to this application to don't use the API level 18 but instead it use the installed API level 23 ? I think that it is not a problem because I have installed a newest version that have to support all the stuff of the oldest one, is it?
I will explain the problem a bit for you and then provide you with the solution.
You are facing this problem, because your project is targeting API level 18 to compile the project. So you MUST have API 18 SDK installed to compile the project.
This is why the IDE is complaining that,
Install missing platform(s) and sync project
The SDK is not the framework. The Android framework is same all over, but with different API levels new updates are pushed to the SDK, the latest being API 23, Marshmallow.
You should not download an older SDK to compile the project.
Always try to use the latest SDK available to work with. So, just head over to your build.gradle file or AndroidManifest.xml file and change the compileSdkVersion to 23.
You can either change the compileSdkVersion version in build.gradle to 23 or whatever version you have in your local machine
You can obtain the API Level 18 from the SDK Manager.
I go into Tools > Android > SDK Manager and infact I have installed Android 6 corrisponding to the API level 23 but not Android 4.3 corrisponding to API level 18.
So what it means? It means that I have installed a different version of the Android framework ?
Yes, you have a newer version of the SDK.
on Android Studio can I install different version of the SDK?
Yes, that is what the SDK Manager is designed for
I think that the API level have to be defined in some way into the dowloaded application. How can I specify to this application to don't use the API level 18 but instead it use the installed API level 23 ?
It is defined. Check either the AndroidManifest.xml or the build.gradle file in the module for the app (not in the project root). You should see some combination of minSdk, targetSdk, and/or compileSdk with a number after it. Since you are getting an error about missing SDK 18, then that number will be 18.
I think that it is not a problem because I have installed a newest version that have to support all the stuff of the oldest one, is it?
The support libraries are separate from the core SDK. You cannot run SDK 23 specific code on devices that have a version less than 23, therefore, to be safe, it is recommended that you start with downloading SDK 18, then run it, then try updating the compileSdkVersion number.

Android version downgrade

Please I am trying to build a small android app with ionic but I downloaded android SDK 5.1.1 .
I wish to deploy to a device that has android version 2.3.3 but it won't even build .
It keeps telling me that the target app is android-22. I want it to build for a lower version like android-8.
Please any help will really be appreciated.
I only want it to be able to build for a lower version
I tried to edit the version in the androidManifest.xml files on my project but still I get errors
->First of all, let`s make sure you have downloaded the plateform for Android 2.2 using Android SDK Manager.
->Set android:minSdkVersion to 8 in androidManifest.xml
->Verify the BuidTarget attribute, since it specifies the development tool of which api to provide you.
->Your problem seems to be the absence of API8 in your SDK.
you might need to change your minSdk in build.gradle
in the app build.gradle file set the min sdk version as 8.
defaultConfig {
applicationId "com.etrade.mobilepro.activity"
minSdkVersion 8
versionCode 87
versionName "4.5"
}
Since the app is not building I guess you don't have that particular sdk.I would suggest downloading the sdk through sdk manager.

Categories

Resources