started today with Firebase - it seems pretty easy, but currently I'm doing something completely wrong.
My build error:
Error:Execution failed for task ':app:preDebugBuild'. Android dependency
'com.google.firebase:firebase-core' has different version for the compile
(9.0.0) and runtime (11.2.0) classpath. You should manually set the same version via DependencyResolution```
with apply plugin: 'com.google.gms.google-services' in the base feature's build.gradle
Without this line there are no build errors, but, Firebase stops working (that was pretty predictable :D)
base feature's build.gradle:
apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
android {
baseFeature = true
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
minSdkVersion 17
targetSdkVersion 26
versionCode 35
versionName "1.1.1"
}
buildTypes {
release {
minifyEnabled false
}
}
}
repositories {
flatDir {
dirs 'libs'
}
mavenCentral()
}
dependencies {
androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2', {
exclude group: 'com.android.support', module: 'support- annotations'
})
testCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:$support_version"
compile "com.android.support:support-v13:$support_version"
compile "com.android.support:recyclerview-v7:$support_version"
compile "com.android.support:design:$support_version"
compile "com.android.support:customtabs:$support_version"
compile "com.android.support:support-vector-drawable:$support_version"
implementation "com.google.firebase:firebase-messaging:$firebase_version"
implementation "com.google.firebase:firebase-database:$firebase_version"
implementation "com.google.firebase:firebase-appindexing:$firebase_version"
implementation "com.google.firebase:firebase-core:$firebase_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
and the project's one:
buildscript {
ext.kotlin_version = '1.1.4-3'
ext.firebase_version = '11.2.0'
ext.support_version = '26.0.2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Any help? Thanks a lot!
You should put apply plugin: 'com.google.gms.google-services' at the BOTTOM of your gradle file not the top.
https://developers.google.com/android/guides/google-services-plugin
For Instant Apps should be:
**implementation 'com.google.firebase:firebase-messaging:11.8.0'**
instead of
implementation 'com.google.firebase:firebase-messaging:11.8.0'
Related
My project was working. But when I tried to open the project, android studio gave error:
Could not find method compile() for arguments [com.google.gms:google-services:4.2.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Project gradle file are like below:
buildscript {
ext.kotlin_version = '1.2.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
compile 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven{url 'https://jitpack.io'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App gradle file are like below:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.asnus.moviefinder"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compile 'com.android.support:appcompat-v7:28.0.0-rc01'
compile 'com.android.support.constraint:constraint-layout:1.1.2'
compile 'com.android.support:support-v4:28.0.0-rc01'
compile 'com.android.support:design:28.0.0-rc01'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:1.0.2'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
//cardview
compile "com.android.support:cardview-v7:28.0.0-rc01"
//recylerview
compile 'com.android.support:recyclerview-v7:28.0.0-rc01'
//picasso
compile 'com.squareup.picasso:picasso:2.71828'
//retrofit
compile 'com.squareup.retrofit2:retrofit:2.4.0'
compile 'com.squareup.retrofit2:converter-gson:2.4.0'
//Firebase
compile 'com.google.firebase:firebase-auth:16.0.3'
compile 'com.google.android.gms:play-services-auth:16.0.0'
compile 'com.google.firebase:firebase-firestore:17.1.0'
//Seekbar
compile 'com.crystal:crystalrangeseekbar:1.0.0'
//Search Dialog
compile 'com.github.mirrajabi:search-dialog:1.1'
//Fab Button
compile 'com.github.dimorinny:floating-text-button:0.0.4'
//Circle ImageView
compile 'de.hdodenhof:circleimageview:2.1.0'
}
apply plugin: 'com.google.gms.google-services'
Add maven { url 'https://dl.bintray.com/android/android-tools' } in your project's build.gradle like this:
buildscript {
repositories {
maven { url 'https://dl.bintray.com/android/android-tools' }
...
}
}
For more information see this answer
Move the compile 'com.google.gms:google-services:4.2.0' dependency from project's build.gradle to the app's build.gradle file.
From
repositories {
google()
mavenCentral()
}
To
repositories {
google()
maven {
url "https://maven.google.com"
}
}
I am facing this error while gradle building
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
despite all my google versions are same
app.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.iviewlabs.mrmint"
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'
}
}
}
repositories {
mavenCentral()
}
dependencies {
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 'com.android.support:appcompat-v7:26.+'
testCompile 'junit:junit:4.12'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.android.support:design:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.squareup.okhttp:okhttp:2.6.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'id.zelory:compressor:2.1.0'
compile 'com.google.firebase:firebase-messaging:11.0.4'
}
while my project level gradle is
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please help me find the solution I have tried many solutions
in app.gradle
apply plugin: 'com.google.gms.google-services'
ADD THIS LINE AT THE END NOT AT THE TOP AS YOU HAVE DONE.
like this:-
dependencies {
}
apply plugin: 'com.google.gms.google-services'
version conflict either by updating the version of the google-services plugin or updating the version of com.google.android.gms to 11.0.4.
i tried this(Conflict with firebase 11.8.0 and google-services plugin 3.1.2) solution but failed
Messages Gradle Build
build.Gradle(Project Level)
build.Gradle(App level)
App level gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.shadow.pakistannetcafe"
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 'com.android.support.constraint:constraint-layout:1.0.2'
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 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:support-v4:26.0.2'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-auth:9.2.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Project Level Gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Keep all the firebase dependencies same version so use (in app-level gradle )
compile 'com.google.firebase:firebase-auth:11.8.0'
instead of
compile 'com.google.firebase:firebase-auth:9.2.1'
My build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.3-2'
ext.realm_version = '3.7.2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
classpath "io.realm:realm-gradle-plugin:$realm_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
maven { url 'https://dl.bintray.com/jetbrains/anko' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
repositories {
mavenCentral()
}
My app/build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
realm {
syncEnabled = true;
}
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
dexOptions {
jumboMode = true
}
defaultConfig {
applicationId "com.my.project"
minSdkVersion 15
targetSdkVersion 23
versionCode 54
versionName "1.3.54"
multiDexEnabled true
}
}
def AAVersion = '4.3.1'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.0#aar') {
transitive = true;
}
compile('com.digits.sdk.android:digits:1.11.0#aar') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.code.gson:gson:2.7'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.3'
compile 'com.squareup.okhttp:okhttp:2.7.3'
compile 'com.theartofdev.edmodo:android-image-cropper:2.2.5'
compile 'commons-codec:commons-codec:1.9'
compile 'commons-io:commons-io:2.4'
compile 'io.realm:android-adapters:2.0.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'us.feras.mdv:markdownview:1.1.0'
compile 'org.jetbrains.anko:anko-sdk15:0.9.1'
compile "org.androidannotations:androidannotations-api:$AAVersion"
// for annotaions
kapt "io.realm:realm-android-library:$realm_version"
kapt "org.androidannotations:androidannotations:$AAVersion"
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile "com.android.support:design:26.1.0"
compile "com.android.support:customtabs:26.1.0"
compile "com.android.support:cardview-v7:26.1.0"
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
When I build I get error:
Error:Execution failed for task ':app:processDevGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
com\my_project\app\src\dev\google-services.json
com\my_project\\app\google-services.json
OK.In Android Studio select menu: Tools->Friebase
Firebase-> Authentification
Click on Email and password authentification
Connect to your app to Firebase
and get error:
Could not parse the Android Application module
I've just resolve this problem.
I was upgrading the old GCM to FCM, and the Firebase Assistant shows the same error message as yours.
Solved by:
Go to Firebase console, in the Settings of my project, download google-servics.json to app/ folder. (Replace my old GCM's json file)
doing Add Firebase to your app again,
Then I can use the Firebase Assistans of AndroidStudio, again.
For me, the issue was classpath 'com.google.gms:google-services:4.3.0' was giving error, then I changed to classpath 'com.google.gms:google-services:4.2.0', resync'd Project with Gradle Files', then pressed Connect to firebase, :D
You might want to try 'Sync Project with Gradle Files'.
Sometimes I forget to sync the implementations after adding them to the gradle file.
I am trying to add the library into the Kotlin but it is not getting proper install in it.
Following error I am getting while importing the library, please check it
Error: Could not find com.android.tools.build:gradle:2.3.1.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio Preview/gradle/m2repository/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.pom
file:/C:/Program Files/Android/Android Studio Preview/gradle/m2repository/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.jar
Required by:
project: slidingmenulib
I am using the following project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha9'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my module build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.zargow.kotlin"
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(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:26.0.0-beta2'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile 'org.jetbrains.anko:anko-design:0.8.3'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.android.support:cardview-v7:26.0.0-beta2'
compile 'com.android.support:design:26.0.0-beta2'
compile 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.android.support:design:26.0.0-beta2'
}
I am using the library for sliding menu, please check this. I need to import this library into my kotlin project but getting error.
In progect gradle file use
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "http://jzaccone.github.io/SlidingMenu-aar" }
}
}
and in app gradle add
dependencies {
....
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
}