Facing issue in Latest Support Library v26.0.0-beta1 - android

I am facing weird issue in Latest support library.
I just migrated my project to the latest Support version provided by GOOGLE and as per google guideline
So the problem is can't find the cardView in latest support file. Is anyone facing this problem ?
here is my App Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0-rc2"
defaultConfig {
applicationId "com.temp"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
lintOptions {
disable 'RestrictedApi'
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:$support_libs"
compile "com.android.support:design:$support_libs"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'jp.wasabeef:blurry:2.1.1'
}
// REQUIRED: Google's new Maven repo is required for the latest
// support library that is compatible with Android O
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
and here is the project gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.support_libs = '26.0.0-beta1'
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

I don't see cardview added to dependencies anywhere in your app gradle file. Try adding:
compile 'com.android.support:cardview-v7:25.3.1'

AppCompat v7 don't contain CardView, you need to make the explicit claim of that lib in your dependencies.
So, add compile 'com.android.support:cardview-v7:$support_libs' to your dependencies.

Add these dependencies in gradle file:
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'

Related

Error build gradle when creating firebase

I've tried to add firebase to my project, but I got stuck. Here is my build gradle project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here is my build gradle module app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.vlad.comentariibac"
minSdkVersion 9
targetSdkVersion 24
versionCode 5
versionName "1.4"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.firebase:firebase-core:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
The line
compile 'com.google.android.gms:play-services-ads:9.0.0'
is highlighted with red and is saying that all google.android.gms libraries must use the exact same version specification. I need some help. Thanks in advance!
On Android, Firebase is actually part of Play services. When you build with Firebase, all of the SDK versions must match your Play services SDK versions. As it stands now, you are asking for 9.0.0 of play-services-ads and 10.0.1 of firebase-core. These need to match, and the latest version of the entire set of Play services SDKs is 10.0.1.

Gradle build failed for two dependencies

I am trying to build gradle with the following dependencies. but its not compiling. I have tried a lot by changing the versions by seeing forums. I search for the dependencies in project structure dialog and found the following two.
de.hdodenhof:circleimageview:2.0.0
com.mcxiaoke.volley:library-aar:1.0.1
Actually I am using two pc. This was build in another pc with following
de.hdodenhof:circleimageview:1.2.1
com.mcxiaoke.volley:library-aar:1.0.19
Still no luck and the gradle build taking 20-25 minutes each time
Main build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.map"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4#aar') {
transitive = true
}
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0'
}
This sounds like gradle is unable to reach the remote repository. Does your firewall block it, is your internet connection working,...?

Access remote gradle dependency

This is my first time to make remote repository. But I am facing some problem in accessing it. Following are my gradle files:
root gradle file
// Top-level build file where you can add configuration options
common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.imagelettericon"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
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:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.github.akashandroid90:imageletter:1.0'
}
and each time when I sync the code I am getting same error
Failed to resolve: com.github.akashandroid90:imageletter:1.0
I have follow this and this link to make my repo. But now I am not able to access it in gradle file.
Yo have to change your dependency.
compile 'com.github.akashandroid90:imageletter:1.0' is wrong.
Reading the doc in the github repo you should use.
dependencies {
compile 'com.imageletter:ImageLetterIcon:1.0'
}
However you can check the dependency in the jcenter repo.
Reading the pom file in the repo, I have some doubs about the name.
It should be:
compile 'com.github.akashandroid90:image-letter-icon:1.0'
You can use another way to add a dependency with a github project,using the github repo and the jitpack plugin
In this case you have to add this repo tp your build.gradle
repositories {
// ...
maven { url "https://jitpack.io" }
}
and the dependency:
dependencies {
compile 'com.github.User:Repo:Tag'
}
In your case it is
compile 'com.github.akashandroid90:ImageLetterIcon:1.0'
More info here.

Android aar dependencies

I am new to Gradle build system, I have a library project which includes dependencies like Retrofit, okhttp etc.
I compiled my project and created an aar file. I created a dummy project and added my library aar as a dependency.
Now if I don't add Retrofit and okhttp as dependency in my dummy app's build.gradle file, my app crashes with class not found exception.
My Question is : Since the library aar file already includes Retrofit and okhttp as dependency then why do I need to add them explicitly in dummy app's build.gradle file too? Is there a workaround.
Here is my library build.gradle
apply plugin: 'com.android.library'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.+'
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
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'])
compile 'com.android.support:appcompat-v7:22.+'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:cardview-v7:21.+'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
}
I was able to resolve this by adding the aar file to a local maven repository. Somehow just adding aar in libs folder and including it as a dependency does not fixes the problem.
If you encounter similar problem just modify your library project build.gradle with these additions
apply plugin: 'maven'
version = "1.0"
group = "com.example.lib"
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.github.dcendents:android-maven-plugin:1.0'
}
}
repositories {
mavenLocal()
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://${System.env.HOME}/.m2/repository/")
}
}
}
Run the task in the terminal provided in the Android studio itself as ./gradlew uploadArchives
Then in your app module's build.gradle file, add the library as dependency
compile ('com.example.app:ExampleLibrary:1.0#aar') {
transitive = true;
}

Can't add ViewPagerIndicator to app with Gradle

i am trying to add Jack Whartons ViewPagerIndicator library https://github.com/JakeWharton/ViewPagerIndicator
to my app as i want to use the circle indicator for the viewpager i have. However i am having trouble adding it to my app.
i have followed this tutorial - Using ViewPagerIndicator library with Android Studio and Gradle
However i am getting this error
Error:Artifact 'library.aar (com.viewpagerindicator:library:2.4.1)' not found.
Searched in the following locations:
https://jcenter.bintray.com/com/viewpagerindicator/library/2.4.1/library-2.4.1.aar
if i remove the jCenter() code in my gradle then it works but the other dependencies i have included do not, so i am not sure how to get round having all the dependencies work together.
Here is my top level gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
}
And here is my module:app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "co.app.al.app"
minSdkVersion 16
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'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.afollestad:material-dialogs:0.6.2.3'
compile files('libs/volley.jar')
compile 'uk.co.chrisjenx:calligraphy:2.0.2'
compile 'com.viewpagerindicator:library:2.4.1#aar'
}
Thanks for any and all help
You can check the maven repository or jcenter:
http://search.maven.org/#search%7Cga%7C1%7Ccom.viewpagerindicator
https://bintray.com/bintray/jcenter/com.viewpagerindicator%3Alibrary/view#files
There is a library artifact with 2.4.1, but it ISN'T an AAR file.
You have to use an alternative repo
maven { url "http://dl.bintray.com/populov/maven" }, but it is important the order.
Change your script:
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
mavenCentral()
}
}

Categories

Resources