I had two API version(21,27) in my SDK platform and my Virtual Device was also targeting API 21.
The problem was MediaPlayer in my MainActivity was not working. I checked volume , it was obviously turned on but could here no sound.
So i thought the higher API version(In my case, API 27) might be causing the problem so i uninstalled it. and now every singe code has turned into red-which means error occured)as u can see.
enter image description here
would you give insight of what is the cause and how to fix it?
Thanks you so much in advance.
Latest android studio version should use latest build tools and better to target with current popular version just like:
your project build.gradle should set like that:
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 27
set your min support sdk if the app support from SDK 21 to 27.
Should install back the latest sdk 27
download every api version and try
start with api 27 and keep coming down but you don't have to delete the sdk version
You just need to click the "Sync Project with gradle file", available in AndroidStudio
This will also download necessary SDK version in case missing.
Related
I have just upgraded the gradle plugin in my app to version 3.2.
I'm now getting a lint error stating that FloatProperty, which was already being used in my app, cannot be used. The minimum API level in my gradle file is 21. The error is:
Class requires API level 24 (current min is 21)
My question is why does this build and run fine even on my test phone running API 22?
your compileSdkVersion which is 28 on its own has nothing to do with what devices can and cannot run your app. Usually, you set this to be the latest version of the Android SDK.
Frequently, the development tools will warn you on the fly when you try using something that is newer than your minSdkVersion. You can run a full Lint check to reconfirm periodically.
targetSdkVersion helps with backwards compatibility, and usually my description is "it's the version of Android that you were thinking of at the time you were writing the code".
My android application is able to install in Oreo & Pie without any problem. If I tried to install the release build in Marshmallow & Nougat version of phone it is throwing an error "There is error while parsing the package" Please find my sdk version in gradle
compileSdkVersion 28
minSdkVersion 21
targetSdkVersion 28
implementation com.android.support:appcompat-v7:28.0.0
implementation com.android.support:support-v4:28.0.0
implementation com.android.support:design:28.0.0
Suppose If I change my compile & target sdk version to 26 does it work in Marshmallow & Nougat devices? If I change to SDK version to 26 and support libraries to 26.0.0 am getting build error like android resource linking failed.
Please help me to resolve this issue and provide solution for my android application should support from marshmallow to pie[latest forward compatibility].
Thanks in Advance
As per your build gradle, I think your buildToolsVersion is not proper.
buildToolsVersion '28.0.3'
Change your buildToolsVersion as per above.
There is no change in your build.gradle file. Please proceed with same configuration "compileSdkVersion 28
minSdkVersion 21
targetSdkVersion 28 " . It looks fine
I guess there is a problem in release apk. Please recheck following common mistake:
Are you installing release apk directly from SD card.( You should not install release apk directly, you need to publish in play console, then only you can use your apk otherwise you should use debug apk only )
Version number ( Whether it is already not used )
Are you renamed your release apk file ? - If you did means please rename back to old name.
Correct the API level in manifest file. ( Cross check with build.gradle file )
Hi Everybody Thanks for the suggestion and comments. Finally I found what is the issue in Nougat 7.0 version.
The issue not with the gradle. Issue due to my package name in project folder i.e Activities,Services,Utilities,Models all the package name has been starts with Capital letter so it throws an error saying that in android manifest file android:name is not defined[not able to recognize while trying to install in Nougat device].
Found issue by installing the release apk in API Level 24 & 25 simulator and found out the error in LogCat.
Once I modified all the package name in my project with small letter i.e activities,services,utilities, now I can able to install the release apk in Nougat version device.
Now unable to install it in Marshmallow device 6.0. This time am getting App is not installed error
Please let me know what am missing for version 6.0 devices.
Thanks in Advance
compileSdkVersion and targetSdkVersion are usually kept similar and by defining this, you tell the app what android devices are you specifically making the app for. So whatever your targetSdkVersion is, the app will run smoothest in this.
minSdkVersion is the minimum sdk that you want to target. So if you want the minimum device supported to be a Marshmallow then the app would not be available for a device having api version below Marshmallow, in fact the app won't even appear on playstore.
Android studio is not working correctly and sent picture of problem please check and provide a feasible solution.
Go to your build.gradle(app) file and look for minSdkVersion. Change its value from 22 to 18. This happened because your phone has API 19 and minSdk of your app is 22.
I'm very new to Android development and this is one of my first projects. I realized that my API Level is set to 20 when datepicker gave an "exception rasied during rendering" error.
I wanted to change the API level to 19 as the API 20 is set to wearable devices. I have installed the API 19 SDK but it doesnt appear for selection during development.
I have also tried to set -
minSdkVersion 10
targetSdkVersion 20
on build gradle but it doesn't work.
I cannot run the emulator as the API is set to 20 and it will display error on a watch :(
How do I set make the API 19 as one of the options during development as I already installed the SDK?
Set
compileSdkVersion 19
in your build.gradle.
minSdkVersion and targetSdkVersion control app installation and runtime backwards compatibility modes, not the SDK you build with.
I can't find any other android API in the project. it is showing only API 20 Android 4.4W. how do i overcome from it?
The issue is because you are using the API level 20 for wearable devices. You need to download other sdk through the Android SDK Manager.
In Eclipse, open windows->android sdk manager->select Android 4.4.2 and check Android sdk and ARM system image and click install packages
Now you have the API level 19 source code so eclipse will now be able to render the views
Now go to the graphical layout tab of the layout and change the android version from 20 to 19.
In Android Studio you just need to change your graphical layout API from 4.4w to 4.4.2 as in the picture below.
Within the eclipse you can change the API version of the design layout. This worked for me.
If you using Android Studio
1 Open your Build.gradle
2 change values as you need
like this
android {
compileSdkVersion 17
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.example.xxx.xxxx"
minSdkVersion 16
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
3 press Sync Project with gradle file..
4 if you do not have that API it will ask you to download..
rebuild the project..