My project worked fine last time.
Now I can't build this, I see a lot of problems in com.android.support/apcompat-v7/22.0.0/res/values-v21/values.xml
Error:(47, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
I need to build my application for minSdkVersion 16 and targetVersion 16.
My project is compiling only if I set minSdkVersion, targetVersion and compilingVersion to 21.
I'm using Android Studio 1.2.2.
Please help me to fix this problem.
I see a lot of problems in com.android.support/apcompat-v7/22.0.0/res/values-v21/values.xml
Your compileSdkVersion should be 22, if you are going to use a 22.x.y version of a support library.
I need to build my application for minSdkVersion 16 and targetVersion 16.
Set minSdkVersion to 16, targetSdkVersion to 16, and compileSdkVersion to 22. Changing minSdkVersion nor targetSdkVersion values will not result in errors like the one that you cite.
To fix this problem you need to use:
compileSdkVersion 21
I didn't known before about:
compileSdkVersion - is the version of the API the app is compiled against. This means you can use Android API features included in that version of the API.
minSdkVersion - controls the lowest level you say your application can run on.
targetSdkVersion - ontrols any automatically applied backward compatibility features
Related
I got the above error compileSdk() not found. While creating the app I have installed TargetSdk 31 and min SDK 19 But Apk does not install on Oreo Version so I have changed TargetSdk 31 to 31 and minSdk 19 to 16. I have uninstalled SDK 31 but it partially uninstalls. Please help me to solve this problem I am new to Android.
I have been strugling with this issue for hours until I looked at some older project. For some reason, newer versions of Android Studio mess up the directives from the Gradle file.
Just add "Version" after the name and it will work. So where you see "compileSdk" just rename it to "compileSdkVersion". You will probably also have to do that in "targetSdk" and so on.
in your <android_proj>/app/build.grandle instead of targetSdk 30 use:
android {
...
defaultConfig {
...
targetSdkVersion 30
}
}
I have an About box in my App that displays information about the App, the phone and the data it uses. It's very useful when a user has a problem. I can get the phone's SDK version using "android.os.Build.VERSION.SDK_INT". However, I haven't found a way to get the value of "CompileSdkversion" which indicates the SDK version the App was compiled with. This is the value that is set in the build.gradle file.
While the Android OS version varies by user, the compileSdkVersion does not. For version X.Y.Z of your app, the compileSdkVersion is whatever you said it was when you compiled that app version. So long as your about box contains the app version, you know what compileSdkVersion that you used, if you keep track of that (e.g., check what it was in your version control system).
But, if you really want to have it be available to you at runtime, you have two options.
If your minSdkVersion is 31 or higher, you can use compileSdkVersion on ApplicationInfo. However, most likely, if you are reading this before the year 2026, your minSdkVersion is lower than that.
For older devices than Android 12, you could add a BuildConfig field for it, at least with newer versions of the Android Gradle Plugin:
android {
compileSdk 31
defaultConfig {
applicationId "com.commonsware.android.myapplication"
minSdk 23
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "int", "COMPILE_SDK_VERSION", "$compileSdk"
}
// other stuff goes here
}
This takes your defined value for compileSdk and hoists it into BuildConfig.COMPILE_SDK_VERSION, so you can reference it at runtime. This was tested using a scrap Arctic Fox project, using Gradle 7.0.2 and 7.0.3 of the Android Gradle Plugin.
Here is the relationship between the three values:
minSdkVersion (lowest possible) <=
targetSdkVersion == compileSdkVersion (latest SDK)
CompileSdkVersion 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.
And the targetSdkVersion should be fully tested and less or equal to compileSdkVersion.(It depends on your app)
If you are using the features of API level of 26 then you need to use compileSdkVersion 26, the lower version will give you an error.
Android supports backward compatibility
(i.e. an app compiled on 26 can also run on a phone having API level 26 or lower).
Considering your use-case, wouldn't a better approach be just to show the current app version? If you know the version, you could look up how/when it was created (via git tags, for example) and then find out the SDK version it was compiled with.
I am trying to run and test a simple android application using android studio(version 3.0.1) on a smartwatch, I am getting the below error with respect to the gradle sync. (I am creating an new project by selecting the wear with the API level of 22 which is same as smartwatch API level).
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 22 cannot be smaller than version 23 declared in library [com.android.support:wear:26.1.0] C:\Users\Sai.gradle\caches\transforms-1\files-1.1\wear-26.1.0.aar\5b2a40104c2cc0843c9e44597771b49a\AndroidManifest.xml as the library might be using APIs not available in 22
Suggestion: use a compatible library with a minSdk of at most 22,
or increase this project's minSdk version to at least 23,
or use tools:overrideLibrary="android.support.wear" to force usage (may lead to runtime failures)
I have looked up for this error in most of the stackoverflow post's and they suggested to change the minimum SDK version in the build.GRADLE (app module) file in the defaultConfig section to 23, and the error doesn’t appear when I change the version to 23 as below.
defaultConfig {
applicationId "com.example.sai.wearexample"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
But, if I change the minSdkVersion version to 23 then there is the below error while I want to run the application on the smartwatch.
I have looked into many of the answers in the stackoverflow but I am not able to get any of the specific resolutions for this question. I am stuck in between these two errors, any help would be appreciated.
You should not use com.android.support:wear for api <23.
For the views you can add:
provided 'com.google.android.wearable:wearable:2.3.0'
compile 'com.google.android.support:wearable:2.3.0'
And change in your java and xml the code for use the tools of
com.google.android.wearable
instead
com.google.android.support:wearable
For example, use android.support.wearable.view.BoxInsetLayout instead of android.support.wear.widget.BoxInsetLayout.
I hope I have helped.
I'm working in a project and I would like to use Constraint! If I use it, when i want build the gradle or intall the apk in a pohne, i've this error:
"Error:In ConstraintSet, unable to find attribute android:elevation"
This is my gradle configuration:
defaultConfig {
applicationId "application"
minSdkVersion 14
targetSdkVersion 17
versionCode 25
versionName "3.11"
}
Can i change sometigh? There is a way to use constraint without change the version?
Thanks
You can try to compile with compile'com.android.support.constraint:constraint-layout:1.0.1 in build.grade. Or check compileSdkVersion to newest version
The android:elevation attribute is pretty new.
It defines the lift of the view on which its applied. It's used in Material Design in the newest Android Versions.
You can use it on API Level 21, and here you targeted Level is 17 which is lower than this.
replace your targeted version to 21 or above
If you want to get some shadowing effect you can use this:
Shadow
Hope this helps.
I am developing app in API level 23 (Marshmallow) but some methods and libraries are deprecated in API 23 i need to downgrade project to API 21 or API 22. But when i change my API level and build my project it gives error
I have tried all methods all things that are mentioned on this forum but none could helped me..
is give error for some value-23.xml file.. i have changed the name of that file from value-23.xml to value-22.xml but android studio said "FILE usder the build folder are generated and should not be edited"
You have changed your compileSdkVersion below 23, but you are still trying to use a version-23 edition of appcompat-v7. Change your appcompat-v7 statement in the dependencies of your build.gradle file, choosing a version that matches your compileSdkVersion. Or, move your compileSdkVersion back to 23 and address your deprecation issues in some other fashion.