question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: gradle add dependency to some lib project instead of app

See original GitHub issue

Bug Report

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 2.4.0
  @capacitor/core: 2.4.0
  @capacitor/android: 2.4.0
  @capacitor/electron: 2.4.0
  @capacitor/ios: 2.4.0

Installed Dependencies:

  @capacitor/ios not installed
  @capacitor/cli 2.4.0
  @capacitor/core 2.4.0
  @capacitor/android 2.4.0
  @capacitor/electron not installed

[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

yarn add cordova-plugin-firebasex npx cap sync android npx cap open android -> return error

Applying the Firebase Crashlytics plugin to a library project is unsupported.
It should only be applied to the application module of your project to enable automatic upload of obfuscation mapping files for your application.

Expected Behavior

npm install cordova-plugin-firebasex npx cap sync android build app -> sucessful build

Code Reproduction

GitHub

Other Technical Details

npx cap open android output: error in android studio

Additional Context

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:37 (6 by maintainers)

github_iconTop GitHub Comments

25reactions
wnabilcommented, Oct 7, 2020

I successfully managed to fix it doing the following

  1. go to file node_modules/cordova-plugin-firebasex/src/android/build.gradle and comment out line 10 and from line 20 to 36 image

  2. go to android/build.gradle and add classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1' in the dependencies image

  3. go to android/app/capacitor.build.gradle and add the commented code from firebase plugin and change apply plugin to apply plugin: 'com.google.firebase.crashlytics' image

  4. copy google-services.json file to android/app image

  5. add accent color by creating color.xml file in android/app/main/res/values/ image

  6. Build the project

Source: https://firebase.google.com/docs/crashlytics/get-started?platform=android

6reactions
felipecaparellicommented, Sep 5, 2020

Is there any way to just make my code compile? I need to complete the migration. If you can suggest just a workaround I’ll be glad… at least for a while. I’ve migrated to the capacitor because the File API doesn’t work as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: gradle add dependency to some lib project instead of ...
bug : gradle add dependency to some lib project instead of app · Issue #3376 · ionic-team/capacitor · Bug Report Capacitor Version Capacitor...
Read more >
Add build dependencies - Android Developers
Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file).
Read more >
How do I add a library project to Android Studio?
Right click on the app folder -> Open Module settings -> go to the dependencies tab -> Click on the '+' button ->...
Read more >
Declaring dependencies - Gradle User Manual
Every dependency declared for a Gradle project applies to a specific scope. For example some dependencies should be used for compiling source code...
Read more >
Downgrading versions and excluding dependencies
Gradle resolves any dependency version conflicts by selecting the latest version found in the dependency graph. Some projects might need to divert from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found