Failure [INSTALL_FAILED_OLDER_SDK] android studio error - java

Android studio shows this Failure [INSTALL_FAILED_OLDER_SDK]
error occurs while installing the application.
I tried to change min sdk levels, gradle min sdk level but it is not working. Any suggestions?

Make sure the <uses-sdk> line in your manifest matches what's in build.grade, and that your target device/emulator version is in the same range.

Applications that target/compile with the Android L preview currently cannot be run on devices that do not have the L preview.
Change your compile and target versions to API 19 in your build.gradle like so and you should be all set:
android {
compileSdkVersion 19
defaultConfig {
targetSdkVersion 19
}
}

Related

targetSDKVersion, minimumSDKVersion, and compileSDKVersion for specific device

I'm programming for one specific device and I'm having trouble understanding how I should be setting minsdkversion, compilesdkversion, and targetsdkversion. I want to get a compiler error when I'm using a library that doesn't exist for API level 25. Here's what I gatherered. Minsdkversion prevents calling API that doesn't exist for API version. Compilesdkversion should always be the latest version. Targetsdkversion is what the app was tested against (don't understand what this means).
minsdkversion-25
compilesdkversion-28 (needed for AndroidX)
targetSDKversion-25
Version settings
Among those version settings, only minSdkVersion takes effect to detect API level error. If you'd like to know details of the version settings, see documentation.
How to let build system report API level error
For release builds, place "lintOptions" in app/build.gradle and mark "NewApi" as "fatal". Then lintVitalRelease gradle task reports error during compilation.
android {
lintOptions {
fatal "NewApi"
}
compileSdkVersion 30
defaultConfig {
minSdkVersion 25
targetSdkVersion 30
:
}
:
}
Checking API level manually
In debug builds, the lintOptions above doesn't have any effects because the lint is not included in debug build tasks (there is no lintVitalDebug gradle task). So rather, after coding, run "code inspection" manually to detect all the NewApi problems in your code. If incompatible API uses found, you'll see "calling new methods on older version" error in the inspection result.

Failed to find style 'coordinatorLayoutStyle' in current theme In Android Studio 3.1

The Android Studio 3.1 layout preview fails to find style 'coordinatorLayoutStyle' in the current theme.
Failed to instantiated one or more classes.
Exception shown are :-
java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener
This happened due to use of alpha version SDK 28
We need to change the android { ... } in "build.gradle" in app file
compileSdkVersion 28 to compileSdkVersion 27
targetSdkVersion 28 to targetSdkVersion 27
Also, try to change implementations like
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' to
implementation 'com.android.support:appcompat-v7:27.1.1'
Hope this works!
For Android Studio v3.1.*, in addition we need change:
implementation 'com.android.support:design:28.0.0-alpha3' to
implementation 'com.android.support:design:27.1.1'
you can fix this issue by adding this script to the app module build.gradle, in the android section
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == "com.android.support") {
if (!requested.name.startsWith("multidex")) {
details.useVersion "27.+"
}
}
}
}
This appears to be a bug in the current version of Android Studio (3.1.3) as I was encountering the same thing. I downloaded the beta build from here and opened my existing project and the errors disappeared.
https://developer.android.com/studio/preview/?utm_source=android-studio
Not exactly a fix but hopefully it will get you back up and running.
Update
1. com.android.support:appcompat stable version 28.0.0 is released. So no need to downgrade version. Just use 28.0.0.
def supportVersion = "28.0.0"
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
You can ignore design library if you don't need it.
2: You also need to update your compileSdkVersion & targetSdkVersion to remove some gradle warnings.
compileSdkVersion 28
targetSdkVersion 28
Never use alpha versions of any library, because alpha, beta and rc
versions may have bugs. And you don't want to face these types of errors often.
Important Suggestion
I suggest you migrate to androidx because android will not update support library after 28.0.0, all updates will be available to androidx package only. Check related answer.
This is fixed in Android Studio 3.2.
Go to app/res/styles and change the Theme.AppCompat.Light.DarkActionBar for this one Base.Theme.AppCompat.Light.DarkActionBar

Gradle sync field in android studio 3.0.1

I just tired to create my first android application and installed android studio 3.0.1 with API 27 , 26 and other necessary SDK tools but after creating a new project now I get a " Gradle sync field error " with no error number but with a 6 message error in "Message gradle sync" ... I didn't find a good solution for that .. may anyone help me ?
Note : I have jdk 1.8 on my windows and android studio uses from it and the embeded jdk is uncheck !
This is the screenshot of my problem !
As you removed the Expresso Dependency from Build.Gradle
you need to remove the Testclass also. Because method in that ApplicationTestClass needs that dependencies.
Try deleting your test class.
java->your_package(androidTest)->delete the files here**
Also add in your Build.Gradle(Project : ) //First one
allprojects {
repositories {
google()
}
}
Check build.gradle replace classpath with -
classpath :'com.android.tools.build:gradle:3.1.0-alpha02'
check- compileSdkVersion 26
buildToolsVersion '26.0.2'
3.update all libraries build.gradle -compileSdkVersion 26
buildToolsVersion '26.0.2'

Can not resolve symbol R and build.gradle error

I began to program with android and so I downloaded Android Studio 2.1.3 and android SDK and jdk 1.8.0_60 the Gradle version is 2.14.1.
I want to program with Android 2.2.
In my class called GameView is the problem:
bmp = BitmapFactory.decodeResource(getResources(),
R.mipmap.ic_launcher);
it can not resolve symbol R
I read that I can solve the problem in these ways:
BUILD -> Clean Project
Tools -> Android -> Sync Project with Gradle Files
File -> Invalidate Caches / Restart
Nothing helped so I tried to changed the Versions in build.gradle(Module: app).
I do not really know wich Versions I need to program for Android 2.2.
Please help me or do you know any other solution to fix that problem?
Thanks!!!
In my case the solution was to put the minSdkVersion from 8 to 9.
I also changed the versions in build.gradle:
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.panjutorials.lazypudding"
minSdkVersion 9
targetSdkVersion 24
versionCode 1
versionName "1.0"
The only disadvantage is that I program with Android Nougat now but that's okay.
Good luck for everybody who has a similar problem.

Android project error

I am trying to run an app that has a Google Maps Activity on my phone. My phone's running on Android 4.1.3 and the Minimum SDK for my project is API 15: Android 4.0.3
I just created the project on Android Studio and tried to run it on my phone. But it won't run and I am keep getting this error. Can someone tell me how to solve this?
That error probably means that you are using too much libraries. And because you are trying to use google maps I'm guessing you included everything google.
Try to just use the libraries you need.
For maps use this:
dependencies {
com.google.android.gms:play-services-maps:9.2.1
}
Reading material:
https://developers.google.com/android/guides/setup
You need to configure your gradle for multidex.
Modify the module-level build.gradle file configuration to include the support library and enable multidex output, as shown in the following code snippet:
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
See more on same link which you are refering : https://developer.android.com/studio/build/multidex.html#mdex-gradle
You can also see some related question for same error:
How to enable multidexing with the new Android Multidex support library
Android java.exe finished with non-zero exit value 1

Categories