I want to use some Google Play services and some extra libraries in the same project. My app/build.gradle file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "bahir.com.myapplication"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
// !!! problematic code !!!
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
compile 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92'
}
apply plugin: 'com.google.gms.google-services'
And my root/build.gradle file looks like this:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If I delete all 3 Google Play Service libs- it's runing good, or I have to delete this code:
// !!! problematic code !!!
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
and of course:
compile 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92'
to have a successfully build, I suppose the conflict is into problematic code in app/build.gradle, so is there a way to declare repositories for a single lirary, in my case for compile 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92' ???
Use the new plugin:
classpath 'com.google.gms:google-services:4.0.1'
AlphabetIndex-Fast-Scroll-RecyclerView using internally '25.3.1' you can exclude
compile("com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92") {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
}
Related
why my material calendar view failed to resolve, here is my
Module: app
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.project.cms"
minSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android- optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
implementation 'com.android.support:design:26.0.0-beta1'
implementation 'com.android.support:support-v4:26.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.2'
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
implementation 'com.android.support:cardview-v7:26.0.0-beta1'
implementation 'com.android.support:recyclerview-v7:26.0.0-beta1'
implementation 'com.github.prolificinteractive:material-calendarview:2.0'
}
here is my BUILD FILE
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
when I sync the gradle the error showed is
Failed to resolve:
com.github.prolificinteractive:material-calendarview:2.0
open.dependency.in.project.structure affected module app
Please help me
There is an issue in your dependency version
implementation 'com.github.prolificinteractive:material-calendarview:2.0'
Replace with
implementation 'com.github.prolificinteractive:material-calendarview:2.0.0'
Place this code:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
in the settings.gradle
My project suddenly couldn't build gradle. The following Error happens:
Error:Failed to resolve: play-services-basement
Here is my build.grdle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}
As I searched, there were two solutions:
add jcenter{url "http://jcenter.bintray.com/"} instead of jcenter()
move google() before jcenter()
but none worked. What Should I do?
tnx
P.S
I know my question is similar to this and this but the solutions doesn't work for me.
update 1:
app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.my.app"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "0.7"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
applicationVariants.all { variant ->
variant.resValue "string", "versionName", variant.versionName
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
google()
jcenter()
}
dependencies {
implementation 'com.android.support:recyclerview-v7:26.1.0'
// implementation 'com.google.firebase:firebase-core:16.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'im.crisp:crisp-sdk:0.1.10'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
compile 'com.stephentuso:welcome:1.4.1'
compile 'co.ronash.android:pushe-base:1.4.0'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:customtabs:26.1.0'
// compile 'com.google.firebase:firebase-auth:16.0.2'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.google.code.gson:gson:2.7'
compile('io.socket:socket.io-client:1.0.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
compile 'com.android.volley:volley:1.0.0'
testCompile 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
udpate2:
project gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am getting the following error :
Could not find method maven() for arguments [build_3sdtqstdmsgdnexrxaaxgljji$_run_closure1$_closure4#325a800c] on root project 'Appointments' of type org.gradle.api.Project.
Here's my Project Level Gradle File:
buildscript {
repositories {
google()
jcenter()
maven { url "http://jcenter.bintray.com"}
maven { url "https://maven.fabric.io/public" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.0'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
maven {
url 'https://maven.google.com/'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here's my app level Gradle File :
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.gtaandteam.android.wellcure"
minSdkVersion 19
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'
}
}
}
repositories {
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'ai.devsupport.instamojo:instamojolib:0.1.6'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-crash:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation "com.android.support:design:24.2.0"
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
I have tried all the techniques mentioned in other posts and solution website, but I dont find my same error listed in any of these websites. Hence I am creating this question here.
You're getting this error because your maven shouldn't be a direct child of "allprojects" but a direct child of "repositories".
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
Whenever I'm trying to include worker8/TourGuide library in my gradle file it is throwing me this error:
"Failed to resolve: com.github.worker8:tourguide:1.0.17-SNAPSHOT"
I tried to clean the project and tried to rebuild as well but nothing worked for me. Please provide your help. Thanks in advance.
app gradle file
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.abdulrehman.myapplication"
minSdkVersion 15
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'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
// compile ('com.github.worker8:tourguide:1.0.13-SNAPSHOT#aar'){
// transitive=true
// }
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Project gradle file
buildscript {
repositories {
jcenter()
google()
mavenCentral()
maven(){
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
dont place third party url in buildscript. place in allprojects.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
google()
mavenCentral()
maven(){
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My gradle sync fails because of this error:
I don't know exactly what is wrong with my gradle configuration (It must be something with maven import). Here are the files:
build.gradle (Top level)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/release" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
maven { url 'https://repo.spring.io/libs-milestone' }
flatDir {
dirs 'libs'
}
}
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.confidential.packageid"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/res-img']
}
}
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/release" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
maven { url 'https://repo.spring.io/libs-milestone' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name:'sdk-release', ext:'aar')
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:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services:10.2.1'
compile 'com.android.support:support-v4:25.3.1'
...
testCompile 'junit:junit:4.12'
...
compile 'com.noveogroup.android:androidlogger:1.3.6'
compile 'com.github.ybq:Android-SpinKit:1.0.5'
}
apply plugin: 'com.google.gms.google-services'
Which part of my gradle files is wrong?
Well, this exists... https://jcenter.bintray.com/com/noveogroup/android/android-logger/1.3.6/
(You're missing a dash. android-logger)
And maybe follow directions here? https://github.com/ybq/Android-SpinKit#gradle-dependency
For example,
allprojects {
jcenter()
// mavenCentral()
repositories {
maven { url "https://jitpack.io" }
...
}
Remember: jcenter() is a superset of mavenCentral()
Android buildscript repositories: jcenter VS mavencentral
Then, regading other things
// compile 'com.android.support:appcompat-v7:25.3.1' // not needed
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-core:10.2.1' // Should really use 'database' or 'messaging' instead
compile 'com.google.android.gms:play-services:10.2.1' // Should be split
// compile 'com.android.support:support-v4:25.3.1' // not needed
Refer to "Selectively compiling APIs into your executable" https://developers.google.com/android/guides/setup