Issue in Compiling gradle File - android

It is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '23.0.0 rc2'
defaultConfig {
applicationId "com.nanu.admin.notification"
minSdkVersion 8
targetSdkVersion 22
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.android.support:design:23.1.1'
}
the last two lines showing errors ..how can I solve that in android studio???

Thats because your build version of the project and support version are different change the support library versions

the problem is here
buildToolsVersion '23.0.0 rc2'
Solution : 1
replace builtToolsVersion with 23.0.1 or 23.0.2
Solution : 2
replace
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
with
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
or
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'

Since you are using the support libraries v23, you have to compile with api 23.
Change this line :
compileSdkVersion 23
Also change the buildToolsVersion with the latest stable release.
buildToolsVersion '23.0.2'

Related

Failed to resolved: compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "org.passitonkentucky.fayetteresources"
minSdkVersion 18
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.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.android.support:multidex:1.0.2'
}
I downloaded Android 3.0.1, before this I had error minimum version 3.0.
When that's resolved, it's now showing me error.
(27,4).
How can I solve this problem?
First you should avoid using "+" in version number its bad practice. add version number will solve your problem.
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'

How to change target sdk and compile sdk into 25

I recently updated my android studio in 2.3 . Now I want to change my target sdk and compile sdk into api 25 but which dependency should I compile ? now my target sdk and compile sdk is api 23 and I am compiling the dependency 23.4.0
Thankz in advance
my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.application"
minSdkVersion 14
targetSdkVersion 25
versionCode 60
versionName "2.2.6.25"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.android.support:appcompat-v7:23.4.0',
'com.android.support:design:23.4.0',
'com.android.support:cardview-v7:23.4.0',
'com.android.support:recyclerview-v7:23.4.0',
'com.android.support:support-annotations:23.4.0',
'com.android.support:multidex:1.0.1')
compile 'com.itextpdf:itextg:5.5.9'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:6.1.71'
testCompile 'junit:junit:4.12'
}
Call :25.1.0 instead of :23.4.0
You should use
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-annotations:25.1.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:support-v4:25.1.0'
and
compileSdkVersion 25
buildToolsVersion '25.0.1'
Go to your project Structure
Then click on app module
Now click on Flavors
There you Edit your Target sdk version and Min sdk version
please check screenshot
Try this
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
...
targetSdkVersion 25
}
}

Failed to resolve: com.android.support:appcompat-v7:24.4.0

apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "abdulsamadgroup.com.asgroup"
minSdkVersion 11
targetSdkVersion 24
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:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.google.code.gson:gson:2.2.3'
}
and here is details of installed sdk i am using.
Help me solve this problem. I have been searching it from 2 days.
Update your Support Repository .
1st way
Set
compileSdkVersion 24
buildToolsVersion "24.0.2"
And
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
Then Clean-Rebuild-Gradle .
2nd way
You can use latest version,
compileSdkVersion 25
buildToolsVersion "25.0.1"
And
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
Try change compile 'com.android.support:appcompat-v7:24.2.0' to compile 'com.android.support:appcompat-v7:24.4.0'
Please update you JDk version .
For Updating 23.0.0 JDK version is 1.7.
If you wanted to update more 24.0.0 or 25.0.1 your JDK version should be 1.8.
Error:Buildtools 25.0.1 requires Java 1.8 or above. Current JDK version is 1.7.

Gradle project refresh failed with no error details

I was working on a project and updated the Android Studio to 1.5 beta. Also I installed android sdks 22 and 23 via SDK manager. After restart the Gradle is failing to refresh without giving any error details.
Here is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.company.projname"
minSdkVersion 14
targetSdkVersion 22
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:22.0.3'
compile 'com.android.support:cardview-v7:22.0.2'
compile 'com.android.support:design:22.2.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.sothree.slidinguppanel:library:3.2.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.google.code.gson:gson:2.3.1'
}
Whats wrong with this?
Edit: Android Studio Version details
Thanks.

Android Studio support v4

I know this question was asked several times, but none of the answers helped me so far...
All I did was generating a preferences screen with Android Studio and now it tells me that NavUtils cannot be found. Even though my build.gradle looks right (I guess):
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.brobox.getyourshitdone"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:support-v4:20.0.+'
compile files('libs/android-support-v4.jar')
}
I hope someone can help :/
Edit:
Just created a new project on my laptop and generated the SettingsActivity again. This is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.brobox.getyourshitdone"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
}
Still got the same error <.<
You have to remove this line implementation files('libs/android-support-v4.jar') and you have to remove this file.
The support library should only be added by gradle. And you have done that in this line implementation 'com.android.support:support-v4:20.0.+'.
YourtargetSdkVersion and your compileSdkVersion are also weird. Those values are not supported with the L developer preview.
compileSdkversionshould be 'android-L', targetSdkVersion should be 'L'.
Press this button, and clean rebuild project.
And add to dependencies :
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
}
Well some time passed and now it works! I don't know what solved it exactly but I did the following:
I updated to Android Studio 0.8.12 manually, because that was the only way to update it
In a new project I tried to manually add a SettingsActivity and therefore added support-v4 to my repositories
Thanks for all your help on this silly question...

Categories

Resources