Application API LEVEL 26 and Android 7? - java

I am new to android development . I have a simple question. If the method was introduced in API LEVEL 26 , can it be run on a device that has Android 7 OS?

Here's a list of Android versions and API levels.
As you can see, Android 7.0 has API level 24. So the method will not be available as it was introduced later.
If the method in question is a standard Java method, in particular a method from java.time, java.nio.file orjava.lang.invoke, then it might be available through API desugaring independent from the API level.

Related

Will my app run on android 4.0 if I use JDK 8

My android studio project uses the embedded JDK which is version 8 by default im wondering will my app still run on android 4.0 and 5.0 devices ?
The app will definitely run with JDK 8 run it.
Android Studio 3.0 and later supports all Java 7 language features and a subset of Java 8 language features that vary by platform version.
Android Studio provides built-in support for using certain Java 8 language features and third-party libraries that use them.
Note:
When developing apps for Android, using Java 8 language features is
optional. You can keep your project's source and target compatibility
values set to Java 7, but you still need to compile using JDK 8.
And about your minSDK comment "whats your preferred minSDK? if you start with API 19 you have a rate of 95%"->
minSdk is required to set the minimum api level run environment(android OS version) to the application. If you choose minSdk the minimum possible you can target max number of devices.
If you want to use JDK8 to compile your Android app there is no problem with it, you can easily set compatibility to Java 6/7 and there won't be any issues.
If you want to use Java 8 language features it all depends on the mindSdkVersion that you have set up. You can freely use:
- lambda expressions
- method references
- default and static methods in interfaces
- repeating annotations
Java 8 API is available from API level 24 unfortunately in your case you won't be able to use any Stream API and such.
For more information please check:
https://developer.android.com/studio/write/java8-support

How to use Java-specific functions in previous api levels?

Some java specific libraries asks for android min API 26. For example Base64.getUrlEncoder() asks for android min API 26. How can I use these java properties in previous api levels? I tried to increase compile java options to latest java version but still I'm not able to use in previous api levels. So is there any way to do this?
No you can't use those APIs below the stated minSDK.
Some APIs are cloned in the Support Library. Base64.getUrlEncoder() is not.
However you could use the Android Base64 version which is available since API 8.

Develop Android application for minimum Version 2

I have developed android application keeping minimum api level 8 and maximum 17. Used Api 14 compilation unit.When I run it on android phone the application crashes.I wan to create application for Android 2.0 -3.0 version i.e the application should be compatible on 2.0 version also. Kindly suggest how can i achieve this?
Because you compile against level 14 API, you might use methods or classes that are not available on API level 8, which will cause runtime errors on level 8 devices.
I suggest you compile your app against the API Level 8 SDK.
Android Lint tool in Eclipse can also find usages of methods that are not available on your app's minimum API level, but I'm not sure how much reliable its results are (It might not find all of the unavailable classes/methods).

Does ADT support Java 8 API?

Do Android Developers Tools support JAVA 8 API up to this date? I'm trying to build an Android app using JAVA 8 and I was wondering about this thing.
Java 8 APIs started becoming available in Android API 26 (which is Android 8, or Nougat). A mechanism called API desugaring is available to use certain Java 8 APIs on earlier Android versions, regardless of the Android API level.
However, there is no 1:1 connection between Android and Java API versions. In the past, it has taken Google some 2–3 years following the release of a new Java version to gradually start implementing its APIs. So, the question “is a certain Java API available on a certain Android version” can only be answered on a per-class/member base. You will have to look up every class, method, constant etc. on the Android API reference and see if it it supported, and what the minimum API version on Android is – or see if API desugaring provides it, which is not tied to a particular Android API level.

Is Android API 2.2.1 too obsolete to use?

What Android API version would you choose to begin developing a new Java application?
Recently I got a used smartphone running Android 2.2.1. Since I never experimentend with mobile development, I decided to use it as an occasion to try to develop a new app for Android.
I worked in Java from some year, and I feel comfortable with it, so since I already work as an independent software vendor I’ll try to sell the app on the Android market if I will be able to do a good one.
I don’t want to start developing with an outdated version of the API, so a I’m asking if starting my development and learning efforts using level 8 of the Android level API is the better choose to take, or if it would be better to use a newer version of the API.
I read why is Android API level 9 obsolete? and Which Android API to use? on S.O. about the same argument, but both the questions are pretty outdated now, and I think they left some question opened.
In particular, Jan Dragsbaek said in his answer:
You should always go for the lowest possible API to use. Simply
because the lower your API level is, the more users can you reach.
So looking at the current stats, you are able to reach 97.9% if you “dumb” yourself down to API level 7.
But why API level 9 is obsolete? One could not know for sure, but most likely because it had some major flaws.
Reading actual stats, this is the situation:
Platform Codename API-Lvl Distribution
Android 1.5 Cupcake 3 30,00%
Android 1.6 Donut 4 70,00%
Android 2.1 Eclair 7 550,00%
Android 2.2 Froyo 8 20,90%
Android 2.3 Gingerbread 9 0,50%
Android 2.3.2 -
Android 2.3.3 - 10 63,90%
Android 2.3.7 -
Android 3.0 Honeycomb 11 0,10%
Android 3.1 - 12 1%
Android 3.2 - 13 2,20%
Android 4.0 - Ice Cream Sandwich 14 0,50%
Android 4.0.2 -
Android 4.0.3 - 15 4,40%
Android 4.0.4
Total for Android 2.2 93,50%
Now the question is: What will I lose if I develop with level 8 of API in terms of features? And what do I gain in terms of stability or tool support?
EDIT:
I finally choose to use level 7 of the API, which offer me the features I really need to get started to experiment on my new phone. Eventually, when I think that app need some feature not available with the current level, then I will port the app to a next level of the API.
For now, I will try to follow Building a Custom Fancy ListView in Android and see if I'm missing something really useful from the beginning.
I think that you should look at your requirements too. Draw up the API's which is absolutely necessary for your app and narrow down to the minimum Android API level which you can use. Since it is correct that your outreach will be more if you make use of lower API levels.
Having said that, if you still feel uncomfortable with lower API level and find yourself restricted then you can infact use Android Support Libraries. Quoting from the description of the support library:
The Support Package includes static "support libraries" that you can add to your Android application in order to use APIs that are either not available for older platform versions or that offer "utility" APIs that aren't a part of the framework APIs. The goal is to simplify your development by offering more APIs that you can bundle with your application so you can worry less about platform versions.
Level 9 is obsolete because level 10 replaced it completely. Another way of saying that is that is Android 2.3.3 replaced Android 2.3, so now if you're aiming for 2.3 devices, you use the 2.3.3 API. Level 8 is not obsolete because there is not a similar API level to replace it (all the 2.2 updates were still level 8).
As for features lost, you can look at the list of all the new features in API 9 (API 10 doesn't really have any major new features but you can check it too on the same site). If you don't need any of those features, then no need to aim for 2.3.3. Same thing over again between 2.2 and 2.1; go with the lowest level that has the features you want, as you said. Speaking from experience, 2.1 provides everything you should need for regular use - internet, storage, graphics (although the advanced graphics get better as you go on), UI, etc.
You will neither gain nor loose nothing much.
Level 9 is obsolete as compared with level 10. Level 9 is GINGERBREAD and Level 10 is Gingerbread Maintenance Release 1 i.e. bug fixes.
Level 8 is 2.2 level 7 is 2.1 they are not obsolete, just old.

Categories