android app deployment issue - java

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.

Related

Questions on rolling-out app on Google Play Console which includes questions on `aewt` and `UID` and SDK, API versions

Dear Android developers geniuses,
I need help with rolling-out my app in the Google Play Console. I’ve stumbled on a chain of problems that appears to be like a catch 22 situation. I’ve started rolling-out my app using Internal testing and soon I discover when I got the pre-launch report, that my app triggered two errors, which I was told will prevent me from continuing the rollout until they’ve been fixed. The two errors are the:
`java.lang.SecurityException: Calling from not trusted UID!`
and
`java.lang.NoClassDefFoundError: aewt`
I’ve done my research here on this platform and elsewhere, and I found a few possible solutions which I tried to fix. I then rebuild another bundle and uploaded it to the internal testing but to no avail, these problems persist.
I followed this link for attempting to solve the problem aewt https://stackoverflow.com/questions/64706041/fatal-exception-firebase-messaging-intent-handle-java-lang-noclassdeffounder
And this to solve the UID! problem
Calling from not trusted UID
None worked.
It then dawned on me that these problems appear on the old version of Android from android 5 and below. So I’ve decided to limit the usage of my app to android 6.0 and above. Little did I know that this will turn out to be a perplexing task as well. And I’m confused as hell.
I followed the instructions on here: [https://developer.android.com/training/basics/supporting-devices/platforms] and added the suggested codes to my app. But here again, it didn’t work and I was able to run my app on the emulators that run Android version 5.0 and below.
The first code that I used was this:
`<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...>
<uses-sdk android:minSdkVersion="6" android:targetSdkVersion="15" />
...
</manifest>`.
However, I couldn’t figure out what is the SDK version. Was it the OS version? Or the API version? Or maybe another set of numbers which I couldn’t find a reference to on the web. I know that this issue is been covered lengthy on this platform but I still couldn’t find the right answer. Anyway, I’ve tried every logical possibility on this using a combination of OS versions and then API versions but none of them seems to prevent my app from running on the old Android version.
I’ve also added this code to the MainActivity:
`private void setUpActionBar() {
// Make sure we're running on Marshmallow or higher to use ActionBar APIs
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
}`
But still, my app was happy to run on older OS’s
Here is a recap of my problems. I get error messages on rolling out my app which appears to be unsolvable which prevents me from continuing from rolling out my app. An attempt to limits the distribution of my app to OS 6.0 and higher has failed too.
What shall I do now?
Try to roll-out my app on the production track and hope for the best?
Is the SDK number the OS number or the API or neither?
Is there another method in which I can tell Android not to get installed on an older versions? Please Help!
The SDK version is the API version. Example OS version 6.0 is API version 23
So if you only want your app to run on OS version 6.0+ then set your minSdkVersion in build.gradle (module) file to 23 (see line 10)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "your.package.name"
minSdkVersion 23
targetSdkVersion 30
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
This is the important one. Setting it in the manifest.xml file is okay, but this is the one that really matters.
EDIT:
Also, specifying minSdkVersion and targetSdkVersion in the manifest.xml file is not necessary; however, if you are going to specify it, you need to make sure that your manifest.xml file and gradle.build file have the same settings.
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="30" />

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.

android-support-v7-appcompat error on eclipse [duplicate]

After upgrading to Android Studio 1.3.1 yesterday, Getting this error when building projects, I cannot create a new project. Adding error and build.gradle file below :
Alredy tried changing compileSdkVersion and buildToolVersion to 21.
Every major revision of the Support Library, such as the 23.0.0 AppCompat you are using, compiles against the API level of the same number: i.e., API 23 as per this G+ post from the AppCompat developer. Therefore to use 23.0.0, you must update your compileSdkVersion to 23.
Note this is completely different from targeting API 23 (which can be done separately and is what is required to use the runtime permissions model).

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

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.

Write one app for sdk versions: 4-15

I'am writing simple app. I want to run this app on many android devices (from 1.6 do newest).
I have minSdk version in manifest: 4 and target 15.
Everything is ok until I change target version to 1.6. Then I have errors for example on this line
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
How to write once and run on many android versions ?
EDIT: Errors: Error retrievieng parent for item: No resource found for given name: Theme.Holo.Light.DarkActionBar
Your target project should always be set to SDK level 15.
With your minimum target at 4, your app will run on 1.6 devices even though you are set to level 15. You will have problems in you lower your target SDK level, because you are using features from 15. The Android build tools in Eclipse will tell you if you are trying to use API features that don't exist down to API level 4.
Make sure you are following the directions in the "Holo Everywhere" blog post: http://android-developers.blogspot.ca/2012/01/holo-everywhere.html ("Using Holo while supporting Android 2.x")
This will ensure you are using the Holo theme on 3.x+ and the classic Android theme on 1.x and 2.x.
You receieve this error because Theme.Holo has been introduced in sdk > 10

Categories