ionic-team / capacitor-plugins

Official plugins for Capacitor ⚡️

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android 14 targetted build fails with RECEIVER_EXPORTED variable error

NorthFred opened this issue · comments

commented

Bug Report

Plugin(s)

Share Plugin @capacitor/share": "^6.0.0

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0

Platform(s)

Android 14 (target API level 34)

Current Behavior

Android build fails with output:

C:\.........\node_modules\@capacitor\share\android\src\main\java\com\capacitorjs\plugins\share\SharePlugin.java:49: error: cannot find symbol
            ContextCompat.RECEIVER_EXPORTED
                         ^
  symbol:   variable RECEIVER_EXPORTED
  location: class ContextCompat

Expected Behavior

Android build is successful.

Other Technical Details

Additional Context

same here

update: I do not get this issue with a fresh app, running npx cap add android, updating Android Studio and making sure the latest sdks are installed.

commented

The error disappears when using updated variables.gradle file during building:

ext {
    minSdkVersion = 24
    compileSdkVersion = 34
    targetSdkVersion = 34
    androidxActivityVersion = '1.7.0'
    androidxAppCompatVersion = '1.6.1'
    androidxCoordinatorLayoutVersion = '1.2.0'
    androidxCoreVersion = '1.10.0'
    androidxFragmentVersion = '1.5.6'
    coreSplashScreenVersion = '1.0.0'
    androidxWebkitVersion = '1.6.1'
    junitVersion = '4.13.2'
    androidxJunitVersion = '1.1.5'
    androidxEspressoCoreVersion = '3.5.1'
    cordovaAndroidVersion = '10.1.1'
}
commented

Closing this.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.