Rebuild project for lower sdk/jdk. Failure [INSTALL_FAILED_OLDER_SDK] - java

I have an android project which was build under jdk 1.7. I have all 4+ and 2.1 -2.3 sdk packages in my InteilJ enviroment. All the time the project was tested under jdk 1.7, and v4.0++ emulator. Now I want to run it on device with 2.3.5 android api version but it responds with Failure [INSTALL_FAILED_OLDER_SDK] . I downloaded older jdk 1.6 and set 2.3 api for project. Even it passes rebuilding, the project can't start on real device. I've set minSdkVersion in manifest. When I start new project with above settings it works on this 2.3.5 device. Any ideas, sollution ?

Unfortunately, the installation failure error messages are not easy to understand in all cases.
[INSTALL_FAILED_OLDER_SDK] means that the minimum API level of the APK you are trying to install (android:minSdkVersion) is higher than the API level of the device you are trying to install it on.
In your case, a normal Android 2.3.5 device will report that it runs API Level 10. I say "normal", because a vendor firmware or ROM mod could report that it runs API Level 3, or API Level 1337, though usually the API level is not tinkered with this way.
In your case, it would appear that the manifest of the project has an android:minSdkVersion of 11 or higher. There is nothing wrong with that... except that the app will refuse to install on Android 1.x/2.x devices and emulators.

Related

Using latest libraries for apps on old Android devices

I have updated the Apache Commons Compress to the latest 1.18 in my Android project which has minSdkVersion 16
Everything was fine(build, run) until I have tested it on old Xoom device with Android 4.1
It did not crash but worked wrong and it was really hard to diagnose what's wrong.
I end up with some log records like
unable to resolve static field (UTF_8) in
Ljava/nio/charset/StandardCharsets
NoClassDefFoundError; thrown while initializing
Lorg/apache/commons/compress/archivers/zip/ZipEncodingHelper
And find out the problem is lack of support java.nio.charset in the pre 19 Androids.
QUESTION 1: Is there a way to add support of Java 1.7 and newer on the older devices? So the all latest libraries which tend to move toward minimum required Java version 1.7 and up will work on such devices with no problem. May be some Google Play settings?
Guess answer for Q1 is NO. So...
QUESTION 2: Should we use libraries with minimum JDK 1.6 for Android if we want to run our app on older devices(e.g., minSdkVersion 16). I managed to resolve my issue migrating back to the latest Commons Compress 1.12 with minimum 1.6 JDK
QUESTION 3: Is there a way to check whether all dependencies gonna work with old devices without the need to test the app on such devices? E.g., some tool to validate dependencies against particular Android SDK.

Unable to load class 'com.google.gson.JsonObject'

I am trying to include firebase SDK in my Android Studio Project. But it giving me an error. I am using latest JDK version (1.7.0_71) and it is asking for upgrading higher version to (1.7.0_67).
I need help for basic firebase setup SDK on android. I tried to setup it by the reference of following link: https://firebase.google.com/docs/android/setup#add_the_sdk.
I am getting following error: Please check attached screenshot
I had the same problem trying to GCM to an old android project.
The solution for me was to also add
classpath 'com.android.tools.build:gradle:2.1.2'
to the top-level build file dependencies, just before classpath 'com.google.gms:google-services:3.0.0'. For the old android project, this dependency only existed in the module-level build file.
Make sure you are using Android Studio 1.5 or above. Just saw a guy who had the same issue and he was using android studio 1.0.1
Updating the Android Studio will fix it for you. Also check other pre-requisites.
Prerequisites from official documentation are as follows:
A device running Android 2.3 (Gingerbread) or newer, and Google Play services 9.2.1 or newer
The Google Play services SDK from the Android SDK Manager
Android Studio 1.5 or higher
An Android Studio project and its package name
First of all complete all the steps mentioned in a link you had followed for Firebase
And note that it requires active internet connection so please check internet connection and add both project and app level dependencies as per suggested in link of Firebase you had used in question
Also it is best to use JDK version 1.8 and above because oracle officialy ended support for those versions. If you are working with Firebase Api which is quiet new so i would highly recommend as it is also recommended by most professionals including developers at Google.Or if you want to go with JDK 1.7 then update it to latest Jdk 7u80 or 7u79 at least because it has least issues comparing to older versions.
The best solution is use JDK version 1.8 and follow all the steps in link https://firebase.google.com/docs/android/setup#add_the_sdk
Ensure that you have the google-services.json file, with the client id: <effective package name>, in the app directory. This you download from the Firebase console when you add an app.

Struggling to compile android apps in Eclipse with a min-sdk that is smaller than the target-sdk

I'm struggling with "no resource found" issues whenever I set my min sdk levels to be smaller than the target+compile sdk levels. I've tried a lot of support library solutions to this problem but none of them have worked.
Here is one error in the eclipse console out of hundreds of these:
SourceCode\AndroidExact\appcompat_v7\res\values-v21\themes_base.xml:191:
error: Error: No resource found that matches the given name: attr
'android:colorPrimaryDark'
However, I can compile and run my android apps in two cases:
minSDK = targetSDK.
minSDK = (any api level) and targetSDK = (api level 21).
For these two cases, I am able to use the Eclipse GUI wizard to create and run an empty hello world android application project. I can also write a more complex app for these two cases.
But for cases where (minSDK < targetSDK and targetSDK != 21), my Android apps will not compile due to the "no resource error".
This solution[1] by reVerse on stackoverflow works. But there is a catch. It only works for target 21. I tried target 19, and it doesn't work. I need to be able to choose a target other than 21, for learning purposes and for device-specific apps.
I have also tried the following (and failed):
Installing JDK 7, and configuring for android workspace
Installing JDK 6, and configuring for android workspace
I think I will be able to make it work if I use JDK 7 with Eclipse Kepler, and that I am configuring my Eclipse wrong.
From Froyo to Lollipop I have the SDK Platform and Google API installed. I also installed the Android Support Repo, Android Support Library, Google Play Services, Google Play Repository, Google USB Driver, and the HAXM driver. I have uninstalled and reinstalled these packages just in case they may have been unintentionally deleted outside the sdk manager.
I am using Windows 7, Eclipse Luna, JDK 8, and ADT 23.0.4.
Do you guys have any suggestions or solutions? I will provide more specific details upon request, as I will do whatever it takes to make this work on Eclipse.
Jump on the Android Studio wagon. It's now at version 1. My advice is to create a new project in Android Studio then slowly one by one manually copy in your source files. This will give you a lot of experience with the new ide and you won't have a single headache with the migration wizardry. Besides that with android studio and gradle to use the support (v7) libraries requires one line in the gradle file.
Example this is all you need in the gradle file with android studio for a google map application and the support libraries where its two extra projects in eclipse.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21+'
compile 'com.google.android.gms:play-services:4.2.42'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile "com.android.support:support-v4:21+"
}

IntelliJ IDEA 12 - Incompatible Android version error

I'm starting out Android development with IntelliJ IDEA 12.0.
I have installed and configured JDK and Android SDK. I wanted to target Android SDK 2.3.3 so the SDK is configured as in the screenshot.
When I try and run the project though, I'm getting the following error:
android-validator: [untitled] Incompatible version of Android SDK Platform-tools package. Min version is 11. Please, update it though SDK manager
Followed by
android-validator: [untitled] Incompatible version of Android SDK Tools package. Min version is 19. Please, update it though SDK manager
I wasn't able to find any information on this and not sure what this means. Any pointers is appreciated.
--New project config--
--Install Android Packages--
android-validator: [untitled] Incompatible version of Android SDK
Platform-tools package. Min version is 11. Please, update it though
SDK manager
Because you have revision 10 and the IntelliJ IDEA tool needs revision 11
android-validator: [untitled] Incompatible version of Android SDK
Tools package. Min version is 19. Please, update it though SDK manager
Because you have revision 16 and the IntelliJ IDEA tool needs revision 19
The mentioned minimal revisions are requirements for IntelliJ IDEA to provide Android tools and to compile your applications. You should definitly launch again the Android SDK Manager and check the Tools folder, as on your screenshot, and click on "Install 2 packages".
I had the same issue. I updated "Android SDK Platform-tools" but it didn't work.
After that I realized that in the past I set c:\Android\android-sdk as the SDK folder. But the SDK manager was updating the folder named c:\Documents and Settings\my.user\Local Settings\Application Data\Android\android-sdk So IntelliJ was checking the old folder.
Problem solved after changing to right folder. So be sure that you set new folder if you have such issue. Check help documentation for setting the SDK folders: http://www.jetbrains.com/idea/webhelp/configuring-global-project-and-module-sdks.html

android app deployment issue

i had an android app and the target for the app i selected is Android 4.0.3 API Level 15.
And by connecting an android phone to my machine i copied the apk file from my machine to the phone.
But the problem is the phone that am using for testing the app is on Android version 2.3.6 installed.
I think thats why when am double click on the apk file to install on device it is showing an error like There is a problem parsing the package.
How can it be solved.?
In your manifest include a minimum SDK version along with your target like this:
<uses-sdk android:minSdkVersion="4" />
<uses-sdk android:targetSdkVersion="15" />
In your manifest you'll have to change the minsdkversion to suit the test phone, or else it will not work.
Be careful how you do this as obviously many classes have been added to Android between v2.3.x and 4.x. Not only that but even classes which existed for 2.3.x may have had methods and/or constants added to them.
As others have said, simply set your min and target SDK manifest entries but be aware that if you use any classes only available after v2.3.x, you will get runtime exceptions when trying to test.
In general I can see you running into trouble - if you really need the 4.x API then you will never be able to test on the 2.3.6 device and you will have to use an emulator. If, on the other hand, you will only be using classes available in v2.3.x then there is no point in targeting v4.x at all. In that case simply target v2.3.x instead.
You need to set minSDK version 2.3, if you want to run APK in your mopbile.
App is build for Android 4.0.3 API level 15, You must set minSDKVersion in manifest file of the project. By setting minSDKVersion app will run on all later Android OS versions. For example if you set it to 7, app will run on API Level 7 onwards. Not on 3, 4, 5 or 6.

Categories