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
Related
Thanks for stopping by. I have been working on an app at API 23. Now Android Studio is "upgrading" it to API 26. This is not what I want. I want to keep it at API 23. Everytime I make a new app its 26. Downgrading doesn't work; I get a bunch of errors.
Thanks
You can change it as you like.
1.Click on your project folder > app > build.gradle
An example of build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
2.Open your Android Studio, and go to Menu.
File >Project Structure. In project Structure window, select app module in the list given on left side.
Select the Flavors tab and under this you will have an option for setting “Min Sdk Version” and for setting “Target Sdk Version”.
Select both the versions and Click OK.
Keep in mind that if you're uploading it to the play store, it's going to have to target 26, soon to be 27. That's probably why AS is trying to update your version.
I changed the API level in my android project for test purposes from 22 down to 7 in the build.gradle file.
Gradle has no problems to build the project and it runs on my (Android 5.1 OS) withouth problems.
Does the successfull build indicates the app would run without problems on lower OS (down to API level 7)? If not - how can I check which API is the lowest appropriate for my application?
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.myapplication"
minSdkVersion 7
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
}
The Gradle tooling, especially Lint, is nowadays very good to figure out whether or not your minSdkVersion really works for your app and will usually block a release build in the lintVitalRelease task when you use API that is not available on your min SDK level.
And of course, you always could (and should) create an API level 7 emulator and test-drive your app there as well. Even if it does not crash right away, some things might behave weird / different or might plainly be not working or visible at all, because compat API calls you were using have been converted to noops on lower API levels.
I keep getting the a error after trying to add a library to my project, however all i did was cause a error.
Error:The SDK Build Tools revision (19.0.0) is too low for project ':library'. Minimum required is 19.1.0
I have read up on the problem but what they suggest i have already done such as changing the version shown below to one above, but they have always been as shown below.
compileSdkVersion 23
buildToolsVersion '23.0.2'
I thought it could have been the minimum version so i change it but still no change.
minSdkVersion 23
targetSdkVersion 23
Both of them are above the required version yet i keep getting the error, any ideas on what is causing the error?.
The problem still occurs after i have removed the library i was trying to import now i am just left with an error that wasn't there before.
Thanks in advance.
Edit:
Gradle File
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "quiz.quiz"
minSdkVersion 23
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'}
Go to your SDK Manager and update your SDK Build Tools. See if that works. This is how mine looks.
I am using Android studio and i want to use Marshmallow API and AppCompatActivity. When I created a new project the build.gradle contained the below lines but I receive error at R class which says not a symbol.
Please let me know how to correct the build.gradle to get the App work.
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.com.myapplication"
minSdkVersion 19
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.0.1'
}
Click on Build->Clean Project and that will perform a gradle clean
Update your Android SDK Manager Install all component of Android 6.0 (API 23)
R file can be erased due to many reasons, try rebuilding your project(which is the most common issue) and other issues may include any syntax error or inappropriate file permissions in work space, the exact error report can help address the issue better.
SOLUTION
In build.gradle file, I set both minSdkVersion and targetSdkVersion to 19 (my Android device's API level).
Also, compileSdkVersion's value must be less than your device's level API.
Issue was:
I cannot install my app I developed in Android Studio, in my Android device (LG G3).
When I try to install my app, this window comes.
When I click OK, the log outputs this.
This was my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "*AppID*"
minSdkVersion 15
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
What I've tried to do:
1. Modify build.gradle to (Changed compileSdkVersion's value to 15):
apply plugin: 'com.android.application'
android {
compileSdkVersion 15
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "*AppID*"
minSdkVersion 15
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
2. Clean the project: i.imgur.com/lbdeXGe.png.
Take a look at Failure [INSTALL_FAILED_OLDER_SDK] Android-L
Recently there was a post here regarding the L SDK's incompatibility with prior versions of Android. I've been digging in
AOSP repositories for quite a few hours now, and determined that the
tools behave this way because they are designed to treat preview
platforms differently. If you compile against a preview SDK
(android-L), the build tools will lock minSdkVersion and
targetSdkVersion to that same API level. This results in the produced
application being unable to be installed on devices running older
releases of Android, even if your application isn't doing anything
specific to L. To make matters worse, the new support libs (CardView,
RecyclerView, Palette, etc.) are also locked into the L API level,
even though--according to their repository names--they should work on
API level 7 just fine (and they do!).
The error means your device has an Android version that is less than your specified minSdkVersion. Set the minSdkVersion to the device's version. If that's not possible, there's really nothing you can do other than using a newer device.
Edit:
Now seeing userM1433372's answer ... That should be the actual issue. Thought you already tried a different SDK version, but you only changed compileSdkVersion to 15 without changing targetSdkVersion! I would suggest setting both targetSdkVersion and compileSdkVersion to 19 (which is the latest non-preview-version).