I want to ONLY target Android Lollipop (21) for app development but Android Studio seems to force me download and install all the latest tools up to Android Oreo (28). Some of the information was removed for brevity. Let me know if you need to know anything else.
App Gradle
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
}
dependencies{
implementation 'com.android.support:appcompat-v7:21.0.0'
implementation 'com.android.support:support-v4:21.0.0'
implementation 'com.android.support:design:21.0.0'
}
Project Gradle
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
Errors that I have been getting,
ERROR: Failed to find Build Tools revision 26.0.2
Google Play requires that apps target API level 26 or higher. <= at targetSdkVersion
As of now I am trying to reinstall Android Studio
Related
ERROR: Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.google.firebase:firebase-iid:19.0.0] C:\Users\User.gradle\caches\transforms-2\files-2.1\856a947c1a9c6ebc4d2fc0c2fb4dbece\firebase-iid-19.0.0\AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 16,
or use tools:overrideLibrary="com.google.firebase.iid" to force usage (may lead to runtime failures)
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.2.0' // Google Services plugin
}
dependencies {
// Add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.1.0'
}
minSdkVersion for firebase library is changed to API level 16 to align with the Google Play services distribution policy.
so you have to change your gradle file like
android {
...
defaultConfig {
minSdkVersion 16
..
}
}
Error says minSdkVersion 15 cannot be smaller than version 16
In that case:
Just change the minSdkVersion in gradle file to 16
The minimum SDK level required to use the most recently versions of Firebase libraries is 16. There is no workaround.
In your build.gradle file change the value with:
android {
...
defaultConfig {
minSdkVersion 16 //or higher
..
}
}
in your build.gradle file, please change the version higher than "minSdkVersion 15".
android {
compileSdkVersion 28
defaultConfig {
applicationId 'com.Demo'
minSdkVersion 21
targetSdkVersion 28
versionCode 10
versionName "1.6"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
and Add gradle :- implementation 'com.android.support:multidex:1.0.3'
Please go to build.gradle(Module.app) and update "minSdkVersion" to 16 or more as below:
defaultConfig {
.............
minSdkVersion 21
............
}
or upper then click on "Sync".
I encountered the same problem and the solution worked for me as follows:
You have to go to the build.gradle file .. app
and then to the defaultConfig{ . section
and replace this text
minSdkVersion flutter.targetSdkVersion
with this code
minSdkVersion 19
then click on "Sync".
Of course, this solution will work with those who work on Platform Flutter , Visual studio code
Recently I've been getting this problem.
As far as I know, there is no 26.X.X versions of these support libraries, what does Gradle wants from me?
After reviewing a previous question, you may want to be sure that your compileSdkVersion matches across the board, if you want to build in 25 but you are in 23.
This support library should not use a different version Error in build.gradle
You can confirm versions by >> Create new project in Android studio >> Press Ctrl+Shift+Alt+S >> Proceed to 'Project' section >> You can see actual gradle version and android pluging version. Copy that to your project.
The problem lies in your Compile version in build.gradle file.
It seems, your compile version is 26.
Please change your compile version to 25 and sync gradle.
compileSdkVersion 25
buildToolsVersion "25.0.3"
Please set your Compile Version to 25
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.user.xxxxx"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
I get this error when trying to build my app:
Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha1
Required by:
MyApp:app:unspecified
Gradle version:
classpath 'com.android.tools.build:gradle:2.3.0-alpha2'
Android studio version;
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "MyApp"
minSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
}
I tried going to SDK TOOLS and enabling the constraint solver, but I did not help. This happened just today, and have not have had this issue earlier. Any ideas?
Check if you have installed ConstraintLayout. Open SDK Manager and than in SDK Tools tab you can check what version of ConstarintLayout is installed.
I am facing a strange issue, i installed latest appcompat-v7:23.0.0
Where as i got to know i must not need it but i need to go with appcompat-v7:22.2.1 or appcompat-v7:22.0.0
I updated my gradle as per my needs but it always pickup appcompat-v7:23.0.0 which is not required, any one guide me how can i resolve this issue?
Since you are using
compile 'com.google.android.gms:play-services:+'
you are using the latest version compile 'com.google.android.gms:play-services:8.4.0' which has a dependency with support libraries v23.
You have to compile with API 23.
Change this line:
compileSdkVersion 23
If you don't want to use the api23 you can use a specific version like as
compile 'com.google.android.gms:play-services:7.8.0'
In general is not a good practice the use of + in your dependencies because you can't replicate the build in the future with the same libraries and you don't know which version you are using.
Also you can use api23 with Httpclient.
Just use:
android {
useLibrary 'org.apache.http.legacy'
}
More info here.
The useLibrary requires the gradle plugin 1.3.0 (classpath 'com.android.tools.build:gradle:1.3.0') or higher.
AppCompat (aka ActionBarCompat) started out as a backport of the
Android 4.0 ActionBar API for devices running on Gingerbread,
providing a common API layer on top of the backported implementation
and the framework implementation. AppCompat v21 delivers an API and
feature-set that is up-to-date with Android 5.0
You can use
compile 'com.android.support:appcompat-v7:22.0.1'
Finally
android {
compileSdkVersion 22
buildToolsVersion '22.0.1' // You can set buildToolsVersion '23.0.1'
Advice
You should use
compile 'com.google.android.gms:play-services:7.8.0' // or 8.4.0
Good Approach : Use latest Version .
you need to download the latest support repository from internal SDK
manager of Android Studio or from the stand alone SDK manager. Then
you can add compile 'com.android.support:appcompat-v7:23.0.1'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId ""
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0' // or 8.4.0
}
Edit
You can use this classpath
classpath 'com.android.tools.build:gradle:1.3.0'
Then Clean-Rebuild-Restart-Sync your project . Hope this helps .
I have recently updated android studio which brought me many problems.
whenever I create a new android project the gradle scripts(Module:app) is displaying the below code
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.listproject"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), `'proguard-rules.pro'`
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.+'
}
here the above compiledsdkversion 23 provides me
Error:Failed to find: com.android.support:appcompat-v7:23.+ Open
File:open.dependency.in.project.structure">Open in Project Structure
dialog
Because before upgrading I had compiledsdkversion as 21 and it does not provide any problem in gradle sync task.
But when I manually modified the compiledsdkversion to 21 it worked correctly.But every time when I create a new project it has been set to 23.Is there any way to make 21 as default or any corrections for compiledsdkversion 23 itself.
I have another doubt before upgradation my restful services projects worked correctly after this upgradation I am facing many problems.
Even HelloWorld application is not running.But if I manually change the compiledsdkversion to 21 everything is fine.Please provide me a solution for making the compiledsdkversion to 21 by default.
> compile 'com.android.support:appcompat-v7:23.+'
The "+" in "v7:23.+" means to take the newest "v7:23" version. If you have no internetconnection this fails.
either reestablish an internetconnection while building or replace the package with a fixed versionnumber that your system has locally cached when there was an internet conntection (i.e. com.android.support:appcompat-v7:23.0.1)
You are using the appcompat (and other support libraries) v23, please compile your project with API 23.
Change in your build.gradle the compileSdkVersion to 23