react-native and firebase native: Could not find method plugins - firebase

I am trying to configure a project that uses react-native and google firebase native.
The set up for react-native worked fine, but I ran into a problem with google firebase native.
I followed the instructions at rnfirebase.io.
When I try to sync My project with gradle files from Android Studio, I get the following error:
Build file 'C:\github\flashcards\flashcards\android\app\build.gradle' line: 139
A problem occurred evaluating project ':app'.
> Could not find method plugins() for arguments [build_2psolmxgn6smlx7165ef739cv$_run_closure1$_closure5#1b639892] on extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
...
Here is the relevant portion of my /android/build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
...
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath('com.google.gms:google-services:4.3.14')
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}
I added the following two lines to the top of my /android/app/build.gradle file:
apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'
Any suggesions for how to fix this problem?
I expected the Sync Project with Gradle files command to complete successfully, but I receive the error described above.

Related

How to automatically add the necessary dependencies in Android Studio?

I have a Kotlin Android Studio project I am making that integrates with Firebase. I added all the lines required listed in Firebase's instructions into build.gradle for both the Project level and the App level.
But this doesn't include any of the dependencies my project seems to need, I get an error when trying to build and these warnings:
The Declared Dependencies list for my app module only has the two Firebase dependencies, and not any of the dependencies as listed by the above warnings:
I noticed there are some dependencies I assume I need in All Modules:
Is there a way I can add those into my app module folder? I am not sure if that's how it works so let me know.
If this is not the way, please let me know how I can add all these required dependencies quickly onto my Project (preferrably without manually searching each one's repository url and such) so that I can Sync and Build without any errors.
The Gradle Sync was just now successful, here's what happened:
During the editing of the build.gradle files, Google Firebase's instructions were to add this line of code to the Project level's build.gradle file:
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
...
// Add this line
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
...
}
}
When Syncing the files through Gradle, an error occurred stating that settings.gradle was prefered to build.gradle, as it also contains repositories and dependencies. The fix was to remove the dependencyResolutionManagement code block in settings.gradle.
Here's what I did to fix all the Sync Warnings and Build errors:
Added the same dependencies found in settings.gradle to build.gradle in the Project level:
gradlePluginPortal()
google()
mavenCentral()
It did not work yet, so then I noticed you also need to add it under the allprojects code block. It will then look something like this:
buildscript {
repositories {
// Check that you have the following line (if not, add it):
gradlePluginPortal()
google() // Google's Maven repository
mavenCentral()
}
dependencies {
...
// Add this line
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
...
repositories {
// Check that you have the following line (if not, add it):
gradlePluginPortal()
google() // Google's Maven repository
mavenCentral()
...
}
}
And that was all. After that the Gradle Sync took a long time this time and completed successfully without any errors, and the Build worked as well and ran fine as expected.

Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`. Use the `CompileOptions.annotationProcessorPath` property instead

I'm cloning an android course project from GitHub, and facing a series of errors, I've manged to solve some of them till I stuck in last one, the scenario as follows:
1- error: Could not find com.android.support:appcompat-v7:25.1.0. (Solved).
2- error: File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.(solved)
3-error: Cannot specify -processorpath or --processor-path via CompileOptions.compilerArgs. Use the CompileOptions.annotationProcessorPath property instead.
This one that I can't fixError snip
and after adding this implementation (
implementation 'com.google.firebase:firebase-core:17.4.3'), I get that error as well.
error: This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
Error snip
I've found that link that has exact fix to the errors mentioned in the question.
Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`
solution.
Delete “apply plugin: ‘android-apt’” line from your app module build.gradle file.
(Not necessary to work) Delete “classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.2’” from your top-level build.gradle file.
In “dependencies” section in build.gradle rename
apt ‘net.simonvt.schematic:schematic-compiler:0.6.3’
to
annotationProcessor ‘net.simonvt.schematic:schematic-compiler:0.6.3’
I’m using newest 26.0.2 buildToolsVersion as well as newest support libraries and everything works like a charm.
Remember to use newest gradle (4.1-all for now) and gradle plugin (3.0.0 for now). Add google repository to download newest support libraries. Sync and rebuild project. Now when you go to your manifest file, there should be no more red android:name=".provider.generated.SquawkProvider"
My top-level 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:3.0.0’
// Google Services plugin
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Let me know if it works.

Couldn't sync after adding depenency to gradle in VScode

I tried to configure my flutter project in order to use firebase. I added all the dependency and couldn't sync after adding the lines mentioned in the firebase to Gradle build.
How do I sync in vscode.
added depenency for firebase:
In project -> android -> app -> build.gradle :
apply plugin: 'com.google.gms.google-services'
In project -> gradle -> build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
**classpath 'com.google.gms:google-services:4.3.3'**
}
IN project -> pubspec.yaml
firebase_auth: ^0.14.0+5
Also ran flutter pub get
Error log:
* Error running Gradle:
ProcessException: Process "C:\Users\LENOVO\Documents\flutter_apps\time_tracker_flutter_course\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\LENOVO\Documents\flutter_apps\time_tracker_flutter_course\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 23s
Command: C:\Users\LENOVO\Documents\flutter_apps\time_tracker_flutter_course\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)
When using Firebase, you need to download the google-services.json file and add it to your project:
Where do I place Googleservices.json in Flutter app in order to solve 'google-services.json is missing'
Then in the android/build.gradle, you need to add the google() maven repository:
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
...
// Add this line
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
...
}
}
and inside android\app\build.gradle, you need to add the google-service plugin:
apply plugin: 'com.google.gms.google-services'
Check this:
https://firebase.google.com/docs/flutter/setup?platform=android

Error in flutter gradle after adding firebase messaging

A have the following error and searched a lot to solve it, but can't get hold of what versions to use and what to do.
The library com.google.firebase:firebase-iid is being requested by various other libraries at [[16.2.0,16.2.0]], but resolves to 15.1.0.
remove
implementation 'com.google.firebase:firebase-messaging:17.0.0'
from your app gradle
and if someone is facing error like
'com.android.support:appcompat-v7' has different version for the compile (26.1.0) and runtime (27.0.1) classpath
then
under your project level gradle file
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
}
}
add above lines to bottom of Project level gradle file

dependency resolution issue in gradle

i developed project in gradle using hadoop and hive dependencies below are the dependencies of project
org.apache.hive:hive-common:1.2.1'
'org.apache.hive:hive-service:1.2.1'
'org.apache.hive:hive-metastore:1.2.1'
'org.apache.derby:derby:10.11.1.1'
'org.apache.hive:hive-jdbc:1.2.1'
but i am facing below error which i am unable to resolve wonderful thing is that if i build the project using maven and added same dependencies in maven project its working fine could you please let me know problem associated with gradle
error:
Could not resolve all dependencies for configuration ':compile'.
> Could not find org.pentaho:pentaho-aggdesigner-algorithm:5.1.5-jhyde.
Searched in the following locations:
https://jcenter.bintray.com/org/pentaho/pentaho-aggdesigner-algorithm/5.1.5-jhyde/pentaho-aggdesigner-algorithm-5.1.5-jhyde.pom
https://jcenter.bintray.com/org/pentaho/pentaho-aggdesigner-algorithm/5.1.5-jhyde/pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar
Required by:
:HiveUnit:unspecified > org.apache.hive:hive-service:1.2.1 > org.apache.hive:hive-exec:1.2.1 > org.apache.calcite:calcite-core:1.2.0-incubating
You need to add the suggested hack in your build.gradle file
repositories {
mavenCentral()
maven {
url "http://conjars.org/repo"
}
}
As hack could be used
repositories {
mavenCentral()
maven {
url "http://conjars.org/repo"
}
}

Resources