I added the following line to my build.gradle(Module:app):
compile 'com.android.support:design:21.0.3'
But when executing Gradle I'm getting
Failed to resolve: com.android.support.design:21.0.3
I got that code from the android support design library and added it to a new project. I added it to the dependency section as such:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId 'com.solodroid.androidnewsapp'
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:design:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:recyclerview-v7:21.+'
compile files('libs/StartAppInAppPlus-2.3.jar')
}
Use the same version of appcompat as your sdk version. Also in newer android studio use implementation keyword.
implementation 'com.android.support:appcompat-v7:26.1.0'
IMP
Or first check your sdk that you have downloaded the version 21.0.3.
You should add official google repository in app gradle. Also on project gradle if other modules need that repository.
apply plugin: 'com.android.application'
buildscript {
repositories {
google()
}
}
...
android {
...
Related
After updating android studio to version 3.0, I can't preview layout of my app, I get the error like:
'Failed to load AppCompat ActionBar with unknown error'.
How can I fix this? but if I run the app on my device phone, its run normally.
This is my Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.halloo'
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
}
dependencies {
compile 'com.squareup.okhttp3:okhttp:3.5.0'
}
dependencies {
compile 'com.android.support:support-v4:24.+'
}
dependencies {
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
}
dependencies {
compile 'com.android.support:support-v4:24.+'
compile 'junit:junit:4.12'
}
dependencies {
compile 'com.android.support:support-v4:24.+'
compile 'com.mikhaellopez:hfrecyclerview:1.0.0'
}
Thank you very much for your time and assistance in this matter.
First, you need to use the same version of compileSdkVersion, buildToolsVersion, targetSdkVersion, and support library version. I see that you want to use buildToolsVersion '26.0.2'. So, change all of them to version 26.
Second, you need to clean up your build.gradle. There is no need for duplicate dependencies.
Third, try clean and build your project. As the last resort, try File -> Invalidate Caches/Restart...
Your app build.gradle should be something like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.halloo'
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.mikhaellopez:hfrecyclerview:1.0.0'
testCompile 'junit:junit:4.12'
}
You also need to check for your project build.gradle. It should contain build:gradle:3.0.0 (as #dheeraj-joshi has pointing out), something like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
// maven { url "https://maven.google.com" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Then, you need to check your gradle version. It should at least using gradle-4.1.
I had similar problem (maybe not exactly the same one).
I was able to run the starter code on the phone and the menu was there. However, preview pane in Android Studio didn't show actual layout.
I have fixed it by changing Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar in styles.xml.
This is a bug in android support library version "26.0.0-beta2'
use:
compile 'com.android.support:appcompat-v7:24.2.1'
with:
buildToolsVersion '26.0.0'
and
classpath
'com.android.tools.build:gradle:3.0.0-alpha8'
everything should work fine.
I am trying to build apk file in my android studio but it is generating the following error.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zzd.class
How to get out from this issue and build apk file.
Mygradle file code is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.wedding.weddingapp"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
configurations { all*.exclude module: 'gson-2.5' }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://raw.githubusercontent.com/layerhq/releases-android/master/releases/" }
maven { url "https://raw.githubusercontent.com/layerhq/Atlas-Android/master/releases/" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.layer.atlas:layer-atlas:0.3.6'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.volley:volley:1.0.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Its probably because you must be using older version of google services
please make sure apply plugin: 'com.google.gms.google-services'
and com.google.firebase:firebase-messaging:9.8.0 are compatible note don't use com.google.gms.google-services 9.0.0 please make sure you are using above 9.0.0 version
After updating my android studio to 2.2 preview 4 version i have this errors:
Error:(93, 54) No resource found that matches the given name (at 'android:actionModeCloseDrawable' with value '#drawable/abc_ic_ab_back_mtrl_am_alpha').
my build.gradle (app) is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "android.arisa.kalahroodfinal"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
exclude module: 'support-v4'
}
compile('com.afollestad.material-dialogs:core:0.8.1.0#aar') {
transitive = true
}
compile('com.afollestad.material-dialogs:commons:0.8.1.0#aar') {
transitive = true
}
compile files('/Users/Bmaster/AndroidStudioProjects/KalahroodFinal/libraries/jsoup-1.9.1.jar')
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.google.android.gms:play-services:9.6.1'
/*
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
*/
testCompile 'junit:junit:4.12'
}
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
jcenter()
}
and i use : classpath 'com.android.tools.build:gradle:2.2.2'
I have changed build tools to 23 version but I already have that error!!
Replace #drawable/abc_ic_ab_back_mtrl_am_alpha with #drawable/abc_ic_ab_back_material
This resource has been removed in this library see this
RESOURCES
Update support library 23.2.0 build bug Question Also other searching results for explanation
I am working at Windows 7 OS, Android Studio. After compiling AndroidAnnotation framework, I can not compile project. Right during the process of compiling it responds with "Error:Could not find the AndroidManifest.xml file, using generation folder"
My gradle file is:
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.falcodeceo.beautifulmind"
minSdkVersion 16
targetSdkVersion 24
versionCode 23
versionName "2.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:palette-v7:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.eightbitlab:blurview:1.1.2'
compile 'org.androidannotations:androidannotations:4.1.0'
}
Looked through some answers but can not apply it, as I do not understand how it works. So I will be thankful if you explain how it all goes.
You miss some necessary configuration. Just add following parts to your Gradle file
buildscript {
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'android-apt'
dependencies {
apt "org.androidannotations:androidannotations:4.1.0"
}
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
}
}
More details can be found at androidannotations wiki https://github.com/excilys/androidannotations/wiki/Building-Project-Gradle
I have a library project which had colliding xml names like activity_login,etc..
Now even though this is the case when I run the Actvity in the library project is inflating my xml instead of its own and subsequently throwing NPE.
I've already tried giving it the fully qualified R file name but it still seems to be inflating the wrong file.
Ps:I've tried clean build doesnt work either on AS1.2.1.1.
Is this a bug of AS or am I doing something wrong
Here is my gradle file
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xxx"
minSdkVersion 14
targetSdkVersion 21
versionCode 17
versionName "2.4.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:recyclerview-v7:22.0.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile project('libraries:holograph')
compile project('libraries:facebook')
compile files('libs/google-api-client-android-1.18.0-rc.jar')
compile files('libs/google-api-client-java6-1.18.0-rc.jar')
compile files('libs/google-api-client-1.18.0-rc.jar')
compile 'com.crashlytics.android:crashlytics:1.+'
compile project(':chartlib')
compile project(':payu')
}
And build.gradle of payu is
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 2
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile('de.keyboardsurfer.android.widget:crouton:1.8.+#aar') {
exclude module: 'support-v7'
compile 'com.android.support:appcompat-v7:18.0.+'
}
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'de.greenrobot:eventbus:2.2.1'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.mobsandgeeks:android-saripaar:1.0.3'
compile project(':CustomBrowser')
}
And my Settings.gradle
include ':app', ':payUMoneysdk', ':CustomBrowser'
This is happening by design, consider it as overriding the library activity layout. I use it extensively for Strings, Colors etc. where it's more useful.
Just rename your projects XML layouts.