Trouble running hello world android app - android

I'm a newbie who installed Android studio but simply can't get a simple hello world app to run!
Whenever I try running a program, I get the error :
Failure [INSTALL_FAILED_OLDER_SDK]
I've been googling but to no avail. I've changed build.gradle to :
defaultConfig {
applicationId "com.minimap.Minimap.minimap"
minSdkVersion 8
targetSdkVersion 8
versionCode 1
versionName "1.0"
}
and I added this to my manifest :
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
Yet the hello world app fails to run on two different cellphones (a samsung galaxy s3, and an alcatel), so I'm guessing the problem is on android studio's side. I'd like to mention that I have not forgotten to install the API 8 sdk
Do you guys have any idea what might be going on? Any help would be greatly appreciated.

You should try to set your targetSDKVersion to 22 (The lastest Android revision).
It will let you use the latest library included in Android.
Also, on Android studio, using Gradle, you dont' have to add the uses-sdk tag in your Android Manifest
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
It will be override during the build phase

Related

Restrict app installation for particular version of android

I am working on android app. Can anybody tell me that how can we restrict our app installation in android version less than 4.0 from google play developer console.
This is not set in Google Play developer console, it is set in the project's build gradle.
The setting is in build.gradle file in your application module. There should be something like this.
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
change minSdkVersion to whatever value of sdk you want to support.
Read more here: https://developer.android.com/studio/publish/versioning.html#minsdkversion
And here are the sdk int value for each Android version: https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
There is no way that I know of to manage that in Developer Console. You should upload binary that was packaged with Minimum Android Version set in AndroidManifest.xml to what ever is the minimum you still want to support (4.0 in your case).
Example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="14" />
</manifest>
14 is the API Level of Android 4.0.

Difference in AndroidManifest.xml

I am asking this to make my understanding clear about this. Currently, I have developed few android apps using eclipse. Now I have switched to Android studio and the very first thing I observed is that my manifest file doesn't have
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="9" />
which I had in eclipse, instead I have this in my build.gradle(Module: app) in AS.
defaultConfig {
applicationId "com.example.testing"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
So my question is : is this info added to manifest later and if not, then how the app will recognize its min and target sdk. I am little confused with the structure in AS.
Yes, the value inside your build.gradle will be added to the manifest when you'll be launching your app. In fact even if you add manually sdk parameter in the manifest, it will be overridden by the gradle value !
It seems that the manifest shown in the explorer is like a preview of the final manifest.

Android studio keeps not finding target android-19 but I don't want to compile with that

I am trying to import a project in Android Studio that was initially meant to be compiled with Android-19 API. However now I need to make it work on a device with Android 4.0.3 (so I want to compile with android-15). Yet, Android Studio keeps telling me this, no matter what I do:
Error:failed to find target android-19 : C:\Users\BurrafatoMa\AppData\Local\Android\Sdk
Install missing platform(s) and sync project
(Lucky me that I did not have android-19 installed, otherwise I would have never noticed, right?)
AndroidManifest.xml:
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="15" />
build.gradle:
android {
compileSdkVersion 15
buildToolsVersion '17.0.0'
defaultConfig {
minSdkVersion 10
targetSdkVersion 15
versionCode 1
versionName "1.0"
}
...
project.properties:
target=android-15
I tried the solutions proposed in stackoverflow and on other sites, with no success. What am I missing?
Maybe the project contains some module or library that needs android-19 to compile, I think

Unwanted versioncode increment in android Manifest

I am trying to deploy a version 1.1 update to my android apk of my worklight app. However when I try to update the versionName on my Manifest and build the project, it automatically gets updated back to 1.0 (updated to 1.1) and versionCode is also auto incremented. I do not want this to happen and I want an updated version 1.1 to be built. Any help here please ?
example entry below... the versionCode got updated to 13 from 12.
android:versionCode="13" android:versionName="1.0"
I use eclipse/worklight and not Android Studio. This auto update is still kind of confusing me.
If you are using Android Studio settings in your app build.gradle will override your app manifest.
Make your changes in build.gradle file
defaultConfig {
applicationId "com.abc.yourapp"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.1"
}
Try this code to change version
here is link
if it is not working for you then clean project and then rebuild it

In IntelliJ, how to set the Android API level

I'm using the latest and greatest IntelliJ Community edition. My application runs fine on the android emulator. However, I need the emulator to better match the Kindle Fire. I made the configuration changes in the AVD Manager (including setting device to API 10.)
When I went to my project to configure the project to target the new virtual device, I got the following message: "Build target of AVD DEV3 is not compatible with your build target."
It didn't take much work to figure out that the issue is related to my choice of API 10.
I don't know where I tell my project to use API 10. I looked all over and didn't see any references to the API level at all. Any ideas?
EDIT
I added
<uses-sdk android:minSdkVersion="10" />
to my AndroidManifest.xml file and was able to select the new device. I'm starting it up now.
The answer above is no longer true in Intellij (using gradle)
Now <uses-sdk> is ignored in the AndroidManifest.xml, it is automatically added to the built manifest file. To change the version, go to the 'build.gradle' file and look at the minSdkVersion.
As Tony and Blundell mention, the answer is to declare your minSdkVersion in your AndroidManifest.xml file. In this way, the application will be allowed to launch on any AVDs that at least meet the minSdkVersion.
Here's more documentation on the <uses-sdk> tag:
http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
Set this value in the Gradle file - as shown here:
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.kotlinconverterapp"
**minSdkVersion 26**
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Categories

Resources