My old android project(with sdk 2.2.3) cannot be compiled with sdk 4.2.2, because it seems that 4.2.2 does not have "android.webkit.CacheManager".
So how would I solve it? What can be its replacement?
It seems that CacheManager was deprecated in API level 11, and the following commit in Android 4.2.1_r1 shows that many of its APIs were removed.
A basic implementation of a replacement would be to save the file locally, along with a tag specifying the last used time. Then, after a (certain) period of time, check if the asset is too old and delete it, if true.
This article and this article seem to provide with example implementations. There are also plenty of libraries, as this one.
Related
I am building an app using Android Studio version 2.1.
I am testing it on a Lollipop device and a marshmallow one.
I was suggested to use support libraries, and I would like to make sure that it runs smoothly on Jelly Bean devices too.
I have looked it up, but can't quite understand if using v4 o v7 guarantees Jelly Bean compatibility (I am assuming it does, but not sure).
This is the first app I am developing and I just realised that I mistakenly used support versions in some activities, and native in others. I am fixing that.
Is there any tool which analyses all the code and then determines the earliest Android version that can run my app? Possibly giving suggestions on changes to make the compatibility broader?
All the answers I found so far confused me, they possibly require knowledge I don't yet have. I am a Java developer quickly trying to put together an app for a start up.
The minVersion in your manifest or gradle file determines the minimum SDK version that can use it. If you lower that number, any API call that doesn't exist on that version will cause an error or warning. Fix them.
BTW, KitKat is 19. So to have KitKat as the minimum SDK you don't need to use any support versions most likely. The best reason to do so is that it will provide a more consistent interface going forward- fewer version specific oddities when using support versions.
For some reason the original Aviary framework has stopped working and this has forced me to migrate our code to use the new CreativeSDK instead.
Unfortunately this new SDK has a minSdkVersion of 14 = Android 4.0, but a lot of our customers still use older versions (a little over 20 % according to Googles statistics for our app).
We cannot release an app update that cuts away that many users, but is there a way to compile the app with a lower api level and then just disable the image editing for the "old api" users?
is there a way to compile the app with a lower api level and then just disable the image editing for the "old api" users?
Tricky question. You can try build the app with api lv < 14 but then the creativeSDK will not be able to compile, resulting in a build error, so no.
Android 4.0 is already ~4 years old. It happens more and more that libraries drop support for older android versions (for good reason I think. Just update already!), as is the case with the creativeSDK. The minSDK requirement went from 2.3 in the aviary framework to 4.0 in the creativeSDK.
Adobe has to have done this for a reason. It is too much of a hassle to provide compatibility for 'old' versions of android, especially for complex functionality.
It is mentioned here, here and here that the creativeSDK now really requires api 14, and compatibility for older versions is not mentioned anywhere, meaning it very much likely doesn't exist.
To come back to your question, I think what would be a solution for you is to create multiple APKs for different API levels. There is some work to be done, but it is officially supported by Android, and the steps on how to achieve it are described clearly in the documentation I linked to.
Other than that, you have two options:
Drop the SDK and use another library.
Contact support and ask if they had forseen this issue and how they suggest you go about solving it.
As noted by Tim, the Adobe Creative SDK supports Android API 14 and up. It won't work for anything lower than that.
If you're using the Image Editor UI component, it's also worth noting that for APIs 14 and 15, the AviaryIntent.Builder will not work.
There is a workaround for that issue documented here.
Update: Note that starting in version 0.9.7 of the Creative SDK, the Image Editor supports Android API 16 and up only. This is noted in the Getting Started guide.
Android platform sample codes and reference from the Android developer site is based on platform 1.5 I understand that newer platforms can support applications developed on older platforms but the reciprocal is not applicable which makes sense but is the coding different? Are codes that were used for developing 1.5 apps still useful in newer platforms or have newer classes and methods replaced them? It seems that eclipse is producing a lot of coding errors in its samples in relation to classes and methods also if a app that was developd by a IME is unable to be viewed on the emulator or how can it be tested or retrieved on the device? Any advice is welcome...sorry it's so long
If you look in the SDK folders, on windows it will be c:\<SDK location>\samples\android-x the samples are located according to api level so they will definitely be compatible there so I would look at these.
To answer your other questions, yes there are api changes as you go up an api level so they should cause warnings or compilation errors and some classes may even be completely removed. Generally the lower level stuff shouldn't change too much but the most important thing is that the semantics change rarely unless there was a design flaw in the original implementations.
The release notes for each version usually points out what has changed and the online documentation is generally superb in my opinion in informing you what exactly is deprecated. If you are just targeting old devices then your emulator is just set to target those api levels but if you are concerned about functionality then you could code using api 1.5 say, and run an ICS api level 15 emulator and check everything works OK, if not then you decide what the best strategy should be. Generally I would advise to target Android 2.2 and above for mobile devices and 3.0 for tablets but really it is up to you.
three are classes that are deprecated and can't be used anymore, like Contacts.People. There are also classes that are deprecated, they can still be used but they should be avoided in new projects. And there are new classes that were not available before. In some cases like for Fragment there are compatibility support libs to use the new features on the old platform but this is not true for classes like for example PreferenceFragment that are not supported on old platforms.
I'm developing an Android app which will target 2.1/2.2 devices, so I have my project set up to use the 2.2 SDK (API level 8), but allow for installation on devices with at least API level 7.
The problem is that during my daily development, I'm not always paying close attention to which API level of the methods/classes/constants that I'm using, which makes it very easy to break code on older devices. I have got dynamic classloading working, and as much as I dislike having a ton of extra factory classes and interfaces in my project, I'm willing to deal with that solution. Currently, the only way I have to check an older API level is to set my project's settings to the given level, rebuild, see what breaks, and then refactor. It's quite a pain.
What I would really like is the ability to scan my code and check compatibility for a given API level without changing my global project build settings. Is there some easy way to do this?
Android API Analysis Plug-In for Eclipse:
http://adt-addons.googlecode.com/svn/trunk/apianalysis/
Ok, so based on my research and the comment by #CommonsWare, there's no static analysis tool or some other easy way to do this. Shucks.
I currently have an app on the market that supports Android 1.5 (SDK level 3) and up. It also takes advantage of several features that are only present in Android 2.0 (SDK level 5) and up. I do this using Reflection.
I read a post on the Android Developer Blog that talks about how to support these new features while using no Reflection, which would be amazing.
http://android-developers.blogspot.com/2010/07/how-to-have-your-cupcake-and-eat-it-too.html
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
I have tested this out and while it works there is one huge downfall. Currently if I try to add a SDK level 5 class, but I don't know that it's a SDK level 5 class, there is no worries. Eclipse isnt going to find the class and I'm not going to be able to add it.
Using Google's recommended method does allow me to add the classes and gives me no notification that this code is targeted just to SDK level 5 users. This opens up too big of a possibility of adding in code that would break some users without knowing.
Does anyone know of any plugins, options, etc that would warn me at the places I have targeted SDK level 5 to keep this from happening?
One possible way, and I havent tested this, would be to individually change Android manifest file and set android:targetSdkVersion to each SDK and try to compile. That way you will be able to sequentially test out each SDK support.