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: capacitor's build gradle script does not get module's build script.

See original GitHub issue

Bug Report

Capacitor Version

❯ npx cap doctor
💊   Capacitor Doctor  💊 

Latest Dependencies:

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

Installed Dependencies:

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

[success] Android looking great! 👌
  Found 9 Capacitor plugins for ios:
    @capacitor-community/fcm (1.0.8)
    @capacitor-community/firebase-analytics (0.2.0)
    @capacitor-community/firebase-crashlytics (0.3.0)
    @capacitor-community/http (0.2.1)
    @capacitor-community/uxcam (0.0.3)
    @diachedelic/capacitor-background-geolocation (0.3.4)
    capacitor-firebase-auth (2.3.2)
    card.io.cordova.mobilesdk (2.1.0)
    cordova-plugin-inappbrowser (4.1.0)
[success] iOS looking great! 👌

Platform(s)

  • Android

Current Behavior

When the build task is launched, it just takes the main build script as base and from it, gradle just take the repositories:

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.uxcam:uxcam:3.3.4.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/uxcam/uxcam/3.3.4/uxcam-3.3.4.pom
       - https://jcenter.bintray.com/com/uxcam/uxcam/3.3.4/uxcam-3.3.4.pom
       - file:/Users/luisalaguna/Projects/geliver-ionic-react/android/capacitor-cordova-android-plugins/src/main/libs/uxcam-3.3.4.aar
       - file:/Users/luisalaguna/Projects/geliver-ionic-react/android/capacitor-cordova-android-plugins/src/main/libs/uxcam.aar
       - file:/Users/luisalaguna/Projects/geliver-ionic-react/android/app/libs/uxcam-3.3.4.aar
       - file:/Users/luisalaguna/Projects/geliver-ionic-react/android/app/libs/uxcam.aar
       - https://repo.maven.apache.org/maven2/com/uxcam/uxcam/3.3.4/uxcam-3.3.4.pom
     Required by:
         project :app > project :capacitor-community-uxcam

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Expected Behavior

It should not be needed to put the required repositories in the main build script file but it should get also repositories from its dependencies(plugins).

Code Reproduction

plugin’s build.gradle:

repositories {
    jcenter()
    maven {
        url 'https://sdk.uxcam.com/android/'
    }
}

Other Technical Details

npm --version output: 7.0.15

node --version output: v15.4.0

pod --version output (iOS issues only): 1.10.0

Additional Context

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
SalahAdDincommented, Jan 15, 2021

@jcesarmobile At first it does not show any problem at building time, but later, the plugin’s class cannot find the UXCam java class from the compiled aar; hence, i had to revert it:

Caused by java.lang.NoClassDefFoundError: Failed resolution of: Lcom/uxcam/UXCam;
       at com.getcapacitor.community.uxcam.UXCamPlugin.startWithKey(UXCamPlugin.java:48)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
       at com.getcapacitor.Bridge$1.run(Bridge.java:542)
       at android.os.Handler.handleCallback(Handler.java:914)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:224)
       at android.os.HandlerThread.run(HandlerThread.java:67)
0reactions
jcesarmobilecommented, Jan 14, 2021

try using compileOnly 'com.uxcam:uxcam:3.3.4@aar' instead of implementation 'com.uxcam:uxcam:3.3.4@aar', that way only your plugin compiles the aar and other modules don’t need to know about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

capacitor.settings.gradle' as it does not exist - Stack Overflow
So the build folder is not "build", it is "out". Just go to the capacitor.config.json and change the webDir property to out.
Read more >
Cannot finish Capacitor 4 migration due to build error
There was a bug on the migrate command that has been fixed but not released yet that causes the variables.gradle to be broken...
Read more >
Troubleshooting Android Issues | Capacitor Documentation
This error is often due to Gradle needing to be synced, something you'll need to do periodically after updating dependencies and changing project...
Read more >
Troubleshooting builds - Gradle User Manual
You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.
Read more >
Add build dependencies - Android Developers
Gradle adds the dependency to the compile classpath only (that is, it is not added to the build output). This is useful when...
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