Android version downgrade - android

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.

Related

how to upgrade android sdk version by command line

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.

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

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.

failed to find target with hash string 'android-22'

I have updated android studio with latest version and then after googling I also updated Android SDK with API 18 but still it gives the same error.
Just click on the link written in the error:
Open Android SDK Manager
and it will show you the dialogs that will help you to install the required sdk for your project.
Open the Android SDK Manager and Update with latest :
Android SDK Tools
Android SDK Build Tools
Then Sync ,Re-Build and Restart Your Project
Demo Code for build.gradle
compileSdkVersion 21 // Now 23
buildToolsVersion '21.1.2' //Now 23.0.1
defaultConfig
{
minSdkVersion 15
targetSdkVersion 19
}
Hope this helps .
Okay you must try this guys it works for me:
Open SDK Manager and Install SDK build tools 22.0.1
Sync gradle That'all
I modified build.gradle compileSdkVersion to 23 from 22 and targetSdkVersion to 23 from 22.
My API level was 23. I had to update the API version to 23 as well.
I had to import my project from Eclipse to Android Studio. It worked for me.
I had similar issue. I updated android studio build tools and my project didn't find "android-22". I looked in android sdk manager and it was installed.
To fix this issue I uninstalled "android-22" and installed again.
I created a new Cordova project, which created with latest android target android level 23. when i run it works. if i changed desire android target value from 23 to 22. and refresh the Gradle build from the Andoid Studio. now it's fail when i run it. i got the following build error.
project-android /CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java
Error:(217, 22) error: cannot find symbol method requestPermissions(String[],int)
I changed the target level in these files.
project.properties
AndroidManifest.xml
and inside CordovaLib folder.
project.properties
However, i also have another project which is using the android target level 22, whenever i run that project, it runs. Now my question is can we specify the desire android level at the time of creating the project?
I think you should install API 18 from android sdk if not already installed, otherwise you can try "invalidate caches and restart" (Find: File->invalidate caches and restart).
Change
compileSdkVersion 18
minSdkVersion 10
targetSdkVersion 18
in build.gradle in your app directory/module
Or Download Latest API Version
In sdk Manager download android 5.1.1, it worked for me
Open project.properties file and change the line with target=android-22 to the desired value.
For example:
target=android-19

How do I Know My System Available Gradle buildToolsVersion

This issue is encountered when my Android Studio project is copied by others, but they can'r run it directly.
The error message is failed to find build tools versions XX.X.X.
Then how do they know what the version should be changed for their own system?
Or is there a better way to set the buildToolsVersion "XX.X.X" to widely suit others in build.gradle?
Also the same question for compileSdkVersion, how do I know the version(s) available in my system?
Is there a gradle(not limited) script to find out the available version?
On Linux you'll find your BuildTool Versions on :
$ANDROID_HOME/build-tools/
Look at your build.gradle (Module:<app-name>) file. There should be a buildToolsVersion line in that file. Make sure that you and others have that version of the build tools installed.
Also make sure that the version of build tools is still available form the SDK manager.
I had this issue when working on a friend's project. He was using a version of build tools that I could not get anymore. I think this is because things are updated and replaced.
We fixed this by both installing the most current version of build tools.
I have also ran into this issue when I upgraded Android Studios and the version of build tools was no longer available.
For the compileSdkVersion you can goto Tools > Android > SDK Manager. This will pull up a window that will allow you to manage your compileSdkVersion and your buildToolsVersion.
You can also select the link at the bottom left (Launch Standalone SDK Manager) this will give you a little bit more information.
You can check the available versions from the official android developer's link : https://developer.android.com/studio/releases/build-tools.html
Then choose the corresponding version (generally the latest) based on your compileSdkVersion and targetSdkVersion

Categories

Resources