Open Paso opened 2 years ago
Hi @Paso,
have you added the following project variable to your variables.gradle
file (usually android/build.gradle
)?
ext {
+ rgcfaIncludeFacebook = true
}
Does the error only occur during lint or also during build?
Hi @robingenz ,
Yes i do, this is my full variables.gradle
:
ext {
minSdkVersion = 27
compileSdkVersion = 30
targetSdkVersion = 30
androidxActivityVersion = '1.2.0'
androidxAppCompatVersion = '1.3.0'
androidxCoordinatorLayoutVersion = '1.1.0'
androidxCoreVersion = '1.6.0'
androidxFragmentVersion = '1.3.0'
junitVersion = '4.13.2'
androidxJunitVersion = '1.1.2'
androidxEspressoCoreVersion = '3.3.0'
cordovaAndroidVersion = '7.0.0'
firebaseMessagingVersion = '23.0.5'
rgcfaIncludeGoogle = true
rgcfaIncludeFacebook = true
facebookLoginVersion = '14.0.0'
}
I get the same error when i run ./gradlew app:build
or any of the assemble commands. I find it strange that it works in Android Studio but not in the cli (which is run in the CI environment), but I have long given up on understanding everything Android Studio does 🤷♂️.
Please create a public repository with a minimal, reproducible example and GitHub Actions, so that i can understand the problem.
A minimal reproduction: https://github.com/Paso/fb-auth-repro
git clone https://github.com/Paso/fb-auth-repro
cd fb-auth-repro
npm i
npx cap sync
cd android
./gradlew app:lint
Thank you, i will look at it as soon as possible.
I tried your repo and was able to reproduce the error.
I compared your repo with https://github.com/robingenz/capacitor-firebase-authentication-demo and I noticed that we have the following diff in the android/build.gradle
file:
dependencies {
- classpath 'com.android.tools.build:gradle:7.2.0'
+ classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.gms:google-services:4.3.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
With classpath 'com.android.tools.build:gradle:4.2.1'
linting works without problems.
It looks like there hasn't been a reply in 30 days, so I'm closing this issue.
This probably needs to be fixed at some time.
My suggestion is to update the docs to say that you should manually add the facebook-login dependency. I have manually added it in my project and that makes it work for me.
Downgrading gradle doesn't work for me as I use a newer version of Java that the old gradle doesn't support.
I will look at it again.
Unfortunately I could not find out anything more. Waiting for https://github.com/gradle/gradle/issues/21462
I have unfortunately not received a tip either in the Gradle issue or in this discussion and have no more idea myself.
Since it is only a lint error and the project can be built normally, I will ignore the lint error in my projects with a baseline for now (see Creating a Baseline, example commit).
I will also add a note to the documentation.
Edit: Note added: https://github.com/capawesome-team/capacitor-firebase/commit/c9a5daada7d19f4631688d9ac585937a13bdfff5
I was only able to get the linting errors to resolve after also adding the implementation directly in the build.gradle
file as well.
ext {
facebookLoginVersion = "15.2.0"
}
dependencies {
implementation "com.facebook.android:facebook-login:$facebookLoginVersion"
}
I was only able to get the linting errors to resolve after also adding the implementation directly in the
build.gradle
file as well.variables.gradle
ext { facebookLoginVersion = "15.2.0" }
build.grade
dependencies { implementation "com.facebook.android:facebook-login:$facebookLoginVersion" }
I do not recommand this solutions since you now have to check the version manually with each update of @capacitor-firebase/authentication
and update it if necessary.
I recommend ignoring the lint error with a baseline.
Plugin(s): authentication
Platform(s): android
Current behavior: Linting the android project in CI environment fails when using the facebook provider because of missing dependency.
android { lint { baseline = file("lint-baseline.xml") } }
Expected behavior:
./gradle app:lint
should passSteps to reproduce: Implement authentication with the facebook provider according to documentation and run ./gradle app:lint
Related code:
Other information: The project builds and runs in Android Studio.
A workaround I have found is to add the dependency in my top level build.gradle
implementation "com.facebook.android:facebook-login:$facebookLoginVersion
My guess is that the linter doesn't like that the dependency is in a subpackage while
FacebookActivity
is used at the top level (inAndroidManifest.xml
). One solution is to change the documentation to say that the dependency should be added manually.Capacitor doctor: