I cannot click on next in Configure Image Asset in Android Studio - android

When I open the Configure Image Asset in Android Studio by right clicking on res and selecting new -> Image Asset, and after selecting the path to my image and resizing, I cannot press next because the next button is greyed out.
I've tried using the default image as well but the same problem prevails. Much appreciated if someone could shed some light.
Please see the screenshot

Your compileSdkVersion version should be above v26 to use adaptive icons.
For below v26 API Level you can use Legacy Icons Only in Icon Type

The very reason for that is written right there in the bottom:
Project must be built with SDK 26 or later to use adaptive icons.
You must be using Android SDK 25 or lower to build your project. Bump it up from API Level 26 or later as mentioned by #Ranjeet by changing your module-level build.gradle file. Should work fine that way.
Personally I use latest Android API level 29. It is strongly recommended that you always compile with the latest SDK. You’ll get all the benefits of new compilation checks on existing code, avoid newly deprecated APIs etc.

Related

Changing (lowering) minSDK (API level) for Android Studio (2020+)

How can I change the minimum SDK in an Android (Studio) project with recent (2020+) versions of Android Studio and Gradle?
During the creation of a new Android Studio project the wizard ask for the minimum SDK required.
Since the wizard generates a lot of boilerplate files and code, I assume that the boilerplate code is tailored to the minimum SDK chosen. My first objective is to generate a modern, lean, forward-compatible (Kotlin) app, so I chose API 31 (most recent non-beta on 29 Dec 2021). However, once the app (which is simple) is working, I would like to lower the minimum SDK to include as many devices as possible (without adding legacy dependencies, code, etc.). Is this a correct way to think about the relation between the choice of minimum SDK and the boilerplate code?
There are existing questions on older (2013) versions of Android Studio (and Gradle), e.g. here, but these do not work in modern versions of Android Studio and Gradle (I have only one build.gradle file and it does not mention any SDK, adding this gives errors).
EDIT: see below an image of the folder tree, as suggested.
I believe all you need to do is set minSdkVersion like provided by this answer. The problems you may encounter are going to be massively different based on what you're going to be doing, but mostly it should be OK. Of course, more you lower minSdkVersion, the more problems you will encounter, but it should be mostly ok to at least version 23.
However, minSdkVersion is usually chosen at the beginning. You should probably set it to 21 (which covers 98% of devices) and start from there (industry standard is currently at 23, which covers 94.1% of devices).
You should not be afraid of the app not being forward compatible because changes are usually quite small and there are ways to support different versions with ease and minSdkVersion doesn't even affect forward compatibility. Also, supporting multiple versions does not make the final size of the app any larger. Code that is not called for a specific version gets deleted at build time, so you don't have to fear having the app not lean because of lower SDK support. There is some build time performance penalty, but for a simple app, this is not noticeable. And in case there's a blocker with SDK version being too low, it's easier to raise it than lower it.
Bottom line here I'd say is, that it is easy to set a low minSdkVersion from the beginning. The amount of possible issues you'll encounter when lowering that version are probably not worth it and are also harder to fix than supporting a low SDK version from the beginning. And it all massively depends on the actual code.
Based on the comments by Ricky Mo.
The problem is that the default is the "Project View", which contains a build.gradle file that that defines the Kotlin version and the Android Studio Gradle plugin version.
The build.gradle file that defines the minSDK is found in the app folder (screenshot).
Alternatively you can switch from the "Project View" to Android. From the dropdown menu that open when you click "Project" (screenshot, highlighted).

Android studio 3 forcing me to create project with API 26

I'm trying to create a project with min sdk 18 and target 21. When I initially create a project a select the minimum SDK as 18 however it gives me no option to target 21 and gives me 26 by default. It's giving me a number of features that aren't supported in 18/26 such as android:roundIcon in the manifest and some drawables that I'm having trouble removing without getting errors. I've tried setting the min and target sdk in the build.gradle and then rebuilding the project as well as 'Sync project with gradle files'
EDIT: After deleting the 'mitmap' directory it seemed to resolve the problem but I'm wondering if I should even be deleting this?
Some features are removed (deprecated) in newer API levels, and some features are added or replaced. Generally, you can set your minimum SDK to a low API for example to 15 but if you initially created the project with higher minimum, Android studio gets excited and tries to implement the new stuff, later when you change your mind and specify low API it complains "I thought you wanted the new stuff :(" says the studio.
So you will need to do some refactoring in that case to your code like you just did.
Same applies to existing projects that target minimum API of +21.
When you change it to lower minimum API level things will turn red and it will most likely ask you to do a lot of if/else checking to existing code for API level for some features that work on certain API levels.
I hope that helps.

Getting minimum SDK and target device

How come starting a new project on android studio 2.2.3 doesn't let you choose minimum sdk or target devices anymore? It used to and now when you hit create new project after naming it it takes you directly to the project.
Even after it has taken you to the project, you can change it from the build.gradle file.
There are two build.gradle files. One at the app level and another at the project level.
Open the app level build.gradle and you'll be able to see targetSDK and minimumSDK options. You can alter them there.

scrollable tab (swipe) with API 8

I am trying to use the code template provided by android in eclipse and I set my min SDK to API 8. I tried to choose the "blank activity with scrollable tab" for using the swipe feature but it wouldn't let me continue and complaining that this code template support version 11 and more.
However, I thought that's why the support library of version 4 is! To support Api 4 and above.
Am I missing the point here or is there something I need to do?
Thank you
Use the android.support.v7 compatibility libraries (which work together with the v4 libraries).
When you create the project in eclipse set the minimum API version to 11 but once the project is created, edit AndroidManifest.xml to set minSDKVersion to 8.
From time to time when building the project, eclipse may complain about min SDK version being required for certain things - in this case just Clean the project and it will build without problems.
I have gotten it to work using ActionBarSherlock and ViewTabPager. Look into those

How to build my own Grid Layout in ANDROID so that it can work with the devices which are below API 14

I want to build a Calculator App, in which I want to format all the required buttons in such a way that, they all appears in a Grid form to me....
The one which I've made is only running on Android 4.0 & above devices...But I want that my calculator app should run on maximum Android devices(Android 2.2 & above) & which have a GridLayout in it..!
Please help me by suggesting me some code or anything else...
Thanx!
A backwards compatible implementation (for API level 7 and up) of GridLayout is also available as Android library project in the support library. After you've downloaded this add-on, you'll find an Android library project in your local sdk folder located at:
<sdk_folder>\extras\android\compatibility\v7\gridlayout
Set it up as dependency of the project you're working on. After that, you'll need to change the references throughout your project from the level 14 version to this compatibility one in order to support pre-ICS devices. Usage should be similar, if not identical.
See also:
GridLayout in Android 2.0?
Grid Layout support in android API 10

Categories

Resources