Using Android Studio 3.1.1, I'm try to add Butter Knife to project but build gradle fail.
the module level:
{ ...
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'}
And below is the build project level:
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
enter image description here
I recreated the new project from scratch and tested any solutions everybody said, but it does not work and still it does fail with this message:
Failed to resolve: support-compat
Eraser all your changes and just add:
dependencies {
.
.
.
.
.
.
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
Downgrad to
implementation 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
and classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
your problem is you added extra implementation keyword in your dependencies, change your project dependencies with code below
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
Ad this in your project level gradle
repositories {
google()
jcenter()
maven { name 'Sonatype SNAPSHOTs'; url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT' // here
}
And apply plugin on app level gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'//here
Related
This question already has answers here:
Gradle sync failed: Plugin with id 'com.google.android.gms:play-services' not found
(3 answers)
Closed 3 years ago.
I'm trying to add Firebase to my Android app, while syncing the project I got:
Gradle sync failed: Plugin with id 'com.google.gms:google-services' not found.
I added the dependencies, google-services.json file in app root, also I added Maven repo in build.gradle top level.
1/ build.gradle top project file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
jcenter()
google()
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0' // Google Services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
archRoomVersion = "1.0.0-alpha1"
}
}
2/ build.gradle // app level
dependencies {
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.persistence.room:compiler:1.1.1"
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.17'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
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 "android.arch.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "android.arch.navigation:navigation-ui-ktx:$navigationVersion"
implementation 'com.google.firebase:firebase-core:16.0.1'
}
buildscript {
ext {
navigationVersion = '1.0.0-alpha09'
}
}
apply plugin: 'com.google.gms:google-services' // Google Play services Gradle plugin
Any idea what should I do?
The apply plugin is wrong. Should be:
apply plugin: 'com.google.gms.google-services'
Notice the . between com.google.gms and google-services.
Also, just in case, google() should go before jcenter().
I can't build my Project when I add I follow [https://developers.google.com/admob/android/eu-consent]
I got below error!
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.google.android.ads.consent:consent-library:1.0.7.
buildscript {
repositories {
jcenter()
google()
// maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// 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"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
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.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.google.android.ads.consent:consent-library:1.0.7'
}
there only is a version 1.0.6, as the link you've provided states:
implementation "com.google.android.ads.consent:consent-library:1.0.6"
for it to work, you'd also need to add this plugin to the buildscript dependencies:
classpath "com.google.gms:google-services:4.2.0"
and apply that plugin at the bottom of the file:
apply plugin: "com.google.gms.google-services"
and a google-services.json file needs to be added to the project, which provides the ga_trackingId... see the documentation.
I tried find solution on internet but nothink work for me.
After implement firebase analytics my program display this error.
Error: Program type already present: com.google.android.gms.internal.measurement.zzfg
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module:app)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.google.firebase:firebase-database:16.0.5'
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.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-analytics:16.0.6';
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-config:16.1.2'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
}
Try updating the dependencies to the latest version for
com.google.android.gms:play-services and com.google.firebase:
Looks like it was discussed here:
com.google.android.gms:play-services-measurement-base is being requested by various other libraries
I wanted to monetize my app using admob.
When i used the admob option available in firebase it asked me to add the following dependency 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
but after the gradle build it gave me this error Failed to resolve: firebase-ads-15.0.0 so i used 'com.google.firebase:firebase-ads:12.0.1' which works great but with this one i can't see the ads. These are my dependencies :
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
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.daimajia.easing:library:2.0#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
implementation 'com.google.android.gms:play-services:12.0.1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:12.0.1'
//implementation 'com.google.firebase:firebase-ads:12.0.1'
//implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
}
This is my project level gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
//classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.0.0'
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()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Firebase core and ads compile version should same
Try this version 16.0.4
It looks like this :
implementation com.google.firebase:firebase-core:16.0.4
implementation 'com.google.firebase:firebase-ads:16.0.4'
change line :
implementation 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
to
implementation 'com.google.firebase:firebase-ads:15.0.1'
The error is not allowing gradle build to be successful.
My project level is below:
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.24.4'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My app level gradle file dependencies
dependencies
{
implementation 'com.android.support:support-v4:28.0.0-alpha3'
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'
})
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
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.google.firebase:firebase-messaging:17.0.0'
implementation 'com.android.support:design:28.0.0-alpha3'
testCompile 'junit:junit:4.12'
implementation 'com.startapp:inapp-sdk:3.8.1'
implementation 'com.android.support:gridlayout-v7:28.0.0-alpha3'
implementation 'com.android.support:support-v4:28.0.0-alpha3'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
My Google Repository version is 58, Android Support Repository is 47.0.0, Android SDK Build Tools is 28.0.0
If you are using windows just delete .gradle folder in C:\users\"username"
I don't ever had android studio in Linux or Mac, but it must be: ~/.gradle
My issue solved this way.
Take care of order where you put google()
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}