This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.5.31 - android-studio

I'm using the latest Android Studio and I'm able to build and run my app fine with compose_version set to 1.0.5. However, I'd like to use the latest stable compose version 1.1.1.
I try to simply update the project build.gradle so it contains the following pointing to the desired compose version and the corresponding compatible kotlin version. These values are referenced in the app's build.gradle.
buildscript {
ext {
compose_version = '1.1.1'
kotlin_version = '1.6.10'
}
And in Android Studio, I go to Tools > Kotlin > Configure Kotlin Plugin Updates and download the latest Kotlin plugin (Early Access).
If I open Tools > Kotlin > Kotlin REPL, I see Welcome to Kotlin version 1.7.0-RC2-release-258 (JRE 11.0.12+0-b1504.28-7817840).
Now, I try to Rebuild Project.
I get the error:
This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.5.31 which is not known to be compatible. Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!).
I don't wish to suppressKotlinVersionCompatibilityCheck given the warning, but I even tried that option and got other build errors.
Why is Kotlin version 1.5.31 being used? Shouldn't updating the Kotlin plugin have gotten Android Studio to switch to a more recent Kotlin version (as suggested by the Kotlin REPL message)? How can I make it such that Kotlin 1.6.10 is used and I stop getting the error?

Got the same error when using Compose 1.1.1. and Kotlin 1.7.0.
Task :app:compileDebugKotlin FAILED
e: This version (1.1.1) of the Compose Compiler requires
Kotlin version 1.6.10 but you appear to be using Kotlin version 1.7.0
which is not known to be compatible. Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!).
Changed the below block in my build.gradle (app module)
composeOptions {
kotlinCompilerExtensionVersion 1.2.0
}
This is my plugins block in build.gradle (project):
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
id 'org.jetbrains.kotlin.jvm' version '1.7.0' apply false
}
This Android developers page helped with picking the compatible versions :-
Compose to Kotlin Compatibility Map
Don't forget to sync and rebuild.

Compose uses the kotlin compiler defined in your buildscript block:
buildscript {
ext.kotlin_version = '1.6.10'
//....
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
If you are using the plugins block in settings.gradle or build.gradle:
pluginManagement {
plugins {
id 'org.jetbrains.kotlin.android' version '1.6.10'
}
}

Using this help me.
build.gradle (:app)
composeOptions {
kotlinCompilerExtensionVersion = "1.2.0-beta03"
}

There are 3 things you need to ensure are in sync(compatible with the other) for kotlin to work properly.
1)compose_ui_version='1.2.1' of buildscript in build.gradle(project)
2)plugin 'org.jetbrains.kotlin.android' version '1.7.10' in build.gradle(project)
3)kotlinCompilerExtensionVersion '1.3.1' in composeOptions in build.gradle(app)
To get the latest version of compose compiler and its corresponding kotlin version check here.

for me what I had to edit is to locate build graddle(Project):
first load compose_version to see the latest stable compose_version.
buildscript {
ext {
//2. change here to the latest stable (compose_version) that you got in step 1
compose_version = '1.3.0'
}
repositories {
google()
mavenCentral()
}
dependencies {
//when you run you app, The next error will tell you the version of Kotlin that the latest compose_version needs, edit as below to the version required in the error
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10'
}

buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
}
}
plugins {
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
and build.gradle(Module)
composeOptions {
kotlinCompilerExtensionVersion '1.1.1'
}

Go to your project level build.gradle file
There in the plugin section below mentioned 2 libraries has to be in the same version to remove this error:
{
...
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'org.jetbrains.kotlin.jvm' version '1.6.10' apply false
}
If required, change:
compileSdk 33
&
targetSdk to 33
. (inside app level build.gradle file).
Now sync the project & reload the priview. It will work fine.

Related

Node Build fail after upgrade to Gradle 7.3

We have upgrade gradle from 4.8 to 7.3 after that nodeSetup build gets fail with below error.
Could not find method layout() for arguments [pattern, com.moowork.gradle.node.task.SetupTask$_addRepository_closure5$_closure7#25995910] on object of type org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository.
Below are code snippet of build.gradle.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.moowork.gradle:gradle-node-plugin:1.3.1"
classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
}
}
apply plugin: "com.moowork.node"
apply plugin: "io.spring.dependency-management"
node {
version = "16.13.12"
npmVersion = "6.12.0"
download = true
nodeModulesDir = file("/XXX")
}
Cause:
There is a breaking change in gradle 6.8 which is you can checkout here:
https://docs.gradle.org/current/userguide/upgrading_version_6.html#configuring_the_layout_of_an_ivy_repository
"The 'layout' method taking a configuration block has been removed and
is replaced by 'patternLayout'
Your plugin "com.moowork.gradle:gradle-node-plugin:1.3.1" is using that method which not upgraded in this library.
Solution:
You can use this gradle-node-plugin instead of "com.moowork.gradle:gradle-node-plugin:1.3.1"
Installation:
https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/installation.md
Installing the node-related plugins can be done in multiple ways. The easiest is to use the plugins-closure in your build.gradle file:
plugins {
id "com.github.node-gradle.node" version "3.1.1"
}
You can also install the plugins by using the traditional Gradle way:
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath "com.github.node-gradle:gradle-node-plugin:3.1.1"
}
}
apply plugin: 'com.github.node-gradle.node'

Hilt Unsupported metadata version in Kotlin

I was tried to run my code in Kotlin 1.5.10
With plugin as
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
and dependencies as below
dependencies {
...
//Dagger - Hilt
implementation "com.google.dagger:hilt-android:2.33-beta"
kapt "com.google.dagger:hilt-android-compiler:2.33-beta"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
kapt "androidx.hilt:hilt-compiler:1.0.0-beta01"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha01'
implementation 'com.android.support:palette-v7:28.0.0'
When I migrate to kotlin_version = "1.5.10", it just errors out stating
error: [Hilt]
Unsupported metadata version. Check that your Kotlin version is >= 1.0: java.lang.IllegalStateException: Unsupported metadata version. Check that your Kotlin version is >= 1.0
at dagger.internal.codegen.kotlin.KotlinMetadata.metadataOf(KotlinMetadata.java:206)
at dagger.internal.codegen.kotlin.KotlinMetadata.from(KotlinMetadata.java:186)
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1133)
...
Can anyone help me? I spent a lot of time on it, your answer will help me a lot
Go to https://dagger.dev/hilt/gradle-setup check Hilt currently version
Update: For now, you can use the newest version.
Kotlin:1.7.0 with Hilt:2.42
Update: kotlin:1.6.0 is compatible with hilt:2.40.5, thanks #Nazanin Nasab
Currently, Kotlin 1.5.21 is compatible with Hilt 2.38.
dependencies {
...
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.42"
}
I got the same error. I changed two gradle files and It worked for me.
Project Gradle
plugins {
// dependencies for dagger hilt
id 'com.google.dagger.hilt.android' version '2.42' apply false
}
Module Gradle
dependencies {
implementation 'com.google.dagger:hilt-android:2.42'
kapt 'com.google.dagger:hilt-compiler:2.42'
implementation("androidx.hilt:hilt-navigation-fragment:1.0.0")
}
Adding this line to build.gradle dependencies helped me:
kapt("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.3.0")
https://youtrack.jetbrains.com/issue/KT-45885
Thanks for the answer , i had to do a slight tweak in order to work for me because i'm using Arctic Fox, hopefully this answer will help as well
Build.gradle (project)
buildscript {
ext {
compose_version = '1.0.0'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0-alpha05'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.37"
}
}
Build.gradle (app)
//Dagger - Hilt
implementation "com.google.dagger:hilt-android:2.34-beta"
kapt "com.google.dagger:hilt-android-compiler:2.34-beta"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
kapt "androidx.hilt:hilt-compiler:1.0.0"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
For Kotlin 1.7.10, you just need to make the hilt versions 2.42.
in Project-level build.gradle change hilt version
id 'com.google.dagger.hilt.android' version '2.44' apply false
in App-Level build.gradle
implementation "com.google.dagger:hilt-android:2.44"
kapt "com.google.dagger:hilt-compiler:2.44"
general solution - in AS build console click link at bottom - build with -stacktrace param and find which annotation processor (KAPT) is causing error - then try to update dependency - if you are lucky new version should be available and supporting your gradle version
message in build output you should lookin for
Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output. Run with --scan to get full insights.
I got same here. I was using dagger:hilt-android:2.33-beta with Kotlin 1.5.10.Please try this
Project gradle
implementation "com.google.dagger:hilt-android:2.33-beta"
Module gradle
plugins {
...
id 'dagger.hilt.android.plugin'
}
dependencies {
...
//dagger-hilt
implementation "com.google.dagger:hilt-android:2.35.1"
kapt "com.google.dagger:hilt-android-compiler:2.35.1"
}
If any solution solved your problem. Go to https://dagger.dev/hilt/gradle-setup, in Using Hilt with Kotlin section, copy the version mentioned in dependencies and update your build.gradle accordingly
I have an issue when upgrading kotlin-gradle-plugin:1.7.x for fulfill requirement of compose. I revert them to org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21 and kotlinCompilerExtensionVersion value
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
kotlinCompilerExtensionVersion compose_version
in my case, the problem was in the different versions that I specified in the dependencies.
"2.40" in classpath 'com.google.dagger:hilt-android-gradle-plugin'
and
"2.43.2" in implementation 'com.google.dagger:hilt-android'
Firstly check helt dependency versions with below url
https://dagger.dev/hilt/gradle-setup
Check you kotlin versions
Kotlin version 1.6.0
Project level gradle
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.40"
App level gradle
def hilt_version="2.40"
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-compiler:$hilt_version"
Kotlin version 1.7.0
Project level gradle
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.42"
App level gradle
def hilt_version="2.42"
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-compiler:$hilt_version"

Plugin with id 'androidx.navigation.safeargs' not found

When I try to add Safe Args (Android Navigation) to my app's as following
( using this guide : https://developer.android.com/topic/libraries/architecture/navigation/navigation-pass-data ) :
apply plugin: 'com.android.application'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {...
I receive this error :
Plugin with id 'androidx.navigation.safeargs' not found.
To add androidx.navigation.safeargsplugin follow below step's
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha09"
(latest)
Add above to your Project Gradel file inside dependency block
Then add apply plugin: 'androidx.navigation.safeargs' to your app/Module gradle file
You can use dependencies as below in Project level bulild.gradle in Android Studio bumblebee
id 'androidx.navigation.safeargs' version '2.4.2' apply false
Just add this line in your build.gradle project level :
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.2.0-rc02"
In newer version of Android Studio 3.2+, below dependency need to add in both build.gradle file
Project-Level build.gradle
dependencies {
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5'
}
App-Level build.gradle
plugins {
id 'androidx.navigation.safeargs'
}
Add
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0-alpha05"
In your project-level dependencies
For eg :
dependencies {
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0-alpha05"
}
Don't forget to add the latest version
It appears because you are declaring it in the wrong build.gradle file. You have to place it in the build.gradle that looks like this
buildscript {
repositories {
google()
}
dependencies {
def nav_version = "2.1.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
}
}
This link explain how it is added https://developer.android.com/jetpack/androidx/releases/navigation#safe_args
as per this https://developer.android.com/jetpack/androidx/releases/navigation
Add above to your Project Gradel file inside dependency block
`classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:2.2.1`
then add
apply plugin: androidx.navigation.safeargs
to your app/Module gradle file
Add this line in Project-level build gradle
id 'androidx.navigation.safeargs' version '2.4.2' apply false
Add this in App-level build gradle
plugins {
id 'androidx.navigation.safeargs'
}
I had to add it to the top level build.gradle, not sure if you've just added it to your app level build.gradle instead
FYI: I had to add it in this manner in order for it to work in Android Studio Dolphin | 2021.3.1:
Gradle Scripts > build.gradle (Project: YourProject)
plugins {
id blah
.
.
.
id 'androidx.navigation.safeargs' version '2.4.2' apply false
}
And also here:
Gradle Scripts > build.gradle (Module: YourProject.app)
dependencies {
implementation blah
.
.
implementation 'androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0-alpha02'
testImplementation blah
androidTestImplementation blah
}
I hope this may help others. I followed the directions at developer.android.com and all the instructions here. None of them solved the issue for me.
Mine was a simple order of operation in my modules build.gradle file.
I had:
id 'androidx.navigation.safeargs.kotlin'
listed as the first line in my plugins block.
moving to the end of the block solved my issue

Could not execute build using Gradle distribution

I have the following error: "Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.4-all.zip'."
It only occurs if I have this in my gradle file:
"classpath 'com.android.tools.build:gradle:3.1.2'"
if I switch it back to:
"classpath 'com.android.tools.build:gradle:3.0.1'"
everything works again. This started after I updated gradle and android studio today.
I have tried just about every solution in this question but nothing helped:
Gradle error: could not execute build using gradle distribution
from above:
-I tried deleting the .gradle in the user folder, and restarting android studio (I also restarted my computer after several other attempts)
-gradle build is successful, I tried invalidate caches and restart. (I tried this before deleting the .gradle, would it make a difference doing it again?)
-I tried setting gradle home to several other paths but nothing helped. If I go to my android studio folder/gradle theres a gradle-4.4 folder but not any of the previous versions that work. .gradle has both 4.4 and 4.1 though.
I tried the following gradle home paths:
C:/Program Files/Android/Android Studio/gradle/gradle-4.4
C:/Users/Joseph/.gradle/wrapper/dists/gradle-4.4-all/9br9xq1tocpiv8o6njlyu5op1/gradle-4.4
/usr/local/opt/gradle/libexec/
and path/to/gradle/libexec/
as well as the default wrapper. (which I have it set to now)
It's possible my jdk/jre are set wrong but they have been working up until now.
my project gradle:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "IdlePortalDefense"
gdxVersion = '1.9.6'
roboVMVersion = '2.3.1'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
google()
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
}
}
project(":ios") {
apply plugin: "java"
apply plugin: "robovm"
dependencies {
implementation project(":core")
implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
implementation "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
}
}
project(":core") {
apply plugin: "java"
dependencies {
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
my graddle wrapper:
#Wed Apr 25 00:05:44 EDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Thanks FF7Squirrelman for sharing the problem the solution.
For me I have also fixed the problem by updating gradle distribution from gradle-4.4-all.zip to gradle-4.7-all.zip
The problem I got is I can "Build APK" and run it on my mobile via Android Studio. However, when I generate signed APK, i got the error same as above.
Looking around the web, it sounds like there is bug on gradle-4.4 which causes the issue and I have proceed below to solve the issue as F7Squirrelman suggested:
updating gradle-wrapper.properties:
distributionUrl=https://services.gradle.org/distributions/gradle-4.7-all.zip
Go to File -> Setting -> Build,Execution and Deployment -> Compiler
Uncheck the box: Configure on Demand
It will allow the project built in gradle 4.7 and finally it solves the issue.

Ionic Android : Error of version conflict of gcm services while adding FCM plugin

Execution failed for task ':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.
In case of Cordova OR Ionic App
I have the similar problem with my ionic 1 cordova build after Integrating the Firebase Cloud Messaging ( FCM )
Error Message
What went wrong:
Execution failed for task ':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.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.605 secs
Error: /Users/beo-administrator/Documents/projects/Apps/Ionic/psc/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':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.
Solution
I fixed this issue by the following steps
So one fix will be: inside platforms/android open project.properties (Its a file ) , you will have something like this
cordova.system.library.1=com.google.android.gms:play-services-ads:+
cordova.system.library.2=com.google.firebase:firebase-core:+
cordova.system.library.3=com.google.firebase:firebase-messaging:+
Replace the
+
Sign with your target version number - like the following
cordova.system.library.1=com.google.android.gms:play-services-ads:9.0.0
cordova.system.library.2=com.google.firebase:firebase-core:9.0.0
cordova.system.library.3=com.google.firebase:firebase-messaging:9.0.0
Save the file
Then take build using
ionic cordova run android
Go to platforms > android > android build.gradle and add below three lines in dependencies area
compile "com.google.firebase:firebase-core:9.0.0"
compile "com.google.firebase:firebase-messaging:9.0.0"
compile "com.google.android.gms:play-services-gcm:9.0.0"
Now your update dependencies looks like as-
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
// SUB-PROJECT DEPENDENCIES START
debugCompile project(path: 'CordovaLib', configuration: 'debug')
releaseCompile project(path: 'CordovaLib', configuration: 'release')
compile 'com.android.support:support-v4:23.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.14.+'
// compile 'com.google.firebase:firebase-core:+'
// compile 'com.google.firebase:firebase-messaging:+'
// SUB-PROJECT DEPENDENCIES END
compile files('libs/twitter4j-core-4.0.2.jar')
compile 'com.google.code.gson:gson:2.8.0'
compile "com.google.firebase:firebase-core:9.0.0"
compile "com.google.firebase:firebase-messaging:9.0.0"
compile "com.google.android.gms:play-services-gcm:9.0.0"
}
Go to platforms > android > cordova-plugin-fcm. Find file that look like something-FCMPlugin.gradle.
Then change to:
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:3.0.0' // change this line
}
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
source:
https://stackoverflow.com/a/44039853/8037833
Had the same problem and the other answers didn't work for me.(as on build the build.gradle get's edited and the version nr return to the previous nr.)
I've fixed it by editing the project.properties file in platforms/android/
target=android-25
android.library.reference.1=CordovaLib
cordova.gradle.include.1=com-sarriaroman-photoviewer/starter-photoviewer.gradle
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.android.support:support-v13:25.1.0
cordova.system.library.3=me.leolin:ShortcutBadger:1.1.17#aar
cordova.system.library.4=com.google.firebase:firebase-messaging:11.0.1
cordova.gradle.include.2=phonegap-plugin-push/starter-push.gradle
cordova.system.library.5=com.google.android.gms:play-services-base:11.0.1
cordova.system.library.6=com.google.android.gms:play-services-ads:11.0.1
Make sure that there is the same version of com.google.android.gms

Resources