Skip to content

Android build fails with network errors after adding Capacitor media and camera plugins #2419

@tjucaokun

Description

@tjucaokun

Bug Report

Plugin(s)

"@capacitor-community/media": "^8.0.1",
"@capacitor/camera": "^7.0.2",

Capacitor Version

   Capacitor Doctor   

Latest Dependencies:

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

Installed Dependencies:

  @capacitor/cli: 7.4.3
  @capacitor/core: 7.4.3
  @capacitor/android: 7.4.3
  @capacitor/ios: 7.4.1

[success] Android looking great! 👌
[error] Xcode is not installed

Platform(s)

npx cap build android
× Running Gradle build - failed!
[error] 
        > Configure project :app
        WARNING: The option setting 'android.overridePathCheck=true' is experimental.
        The current default is 'false'.
        WARNING: Using flatDir should be avoided because it doesn't support any meta-data       
        formats.

        > Configure project :capacitor-cordova-android-plugins
        WARNING: Using flatDir should be avoided because it doesn't support any meta-data       
        formats.

        > Task :app:preBuild UP-TO-DATE
        > Task :app:preReleaseBuild UP-TO-DATE
        > Task :app:generateReleaseResValues
        > Task :capacitor-android:preBuild UP-TO-DATE
        > Task :capacitor-android:preReleaseBuild UP-TO-DATE
        > Task :capacitor-android:generateReleaseResValues
        > Task :capacitor-android:generateReleaseResources
        > Task :capacitor-android:packageReleaseResources
        > Task :capacitor-camera:preBuild UP-TO-DATE
        > Task :capacitor-camera:preReleaseBuild UP-TO-DATE
        > Task :capacitor-camera:generateReleaseResValues
        > Task :capacitor-camera:generateReleaseResources
        > Task :capacitor-camera:packageReleaseResources
        > Task :capacitor-community-media:preBuild UP-TO-DATE
        > Task :capacitor-community-media:preReleaseBuild UP-TO-DATE
        > Task :capacitor-community-media:generateReleaseResValues
        > Task :capacitor-community-media:generateReleaseResources
        > Task :capacitor-community-media:packageReleaseResources
        > Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:preReleaseBuild UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:generateReleaseResValues
        > Task :capacitor-cordova-android-plugins:generateReleaseResources
        > Task :capacitor-cordova-android-plugins:packageReleaseResources
        > Task :app:mapReleaseSourceSetPaths
        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':app:mapReleaseSourceSetPaths'.
        FAILED
        > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
        > Could not resolve com.squareup.okhttp3:okhttp-bom:4.12.0.
        Required by:
        project :app > project :capacitor-community-media
        > Could not resolve com.squareup.okhttp3:okhttp-bom:4.12.0.
        > Could not get resource
        'https://maven.aliyun.com/repository/google/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/google/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.squareup.okhttp3:okhttp-bom:4.12.0.
        > Could not get resource
        'https://maven.aliyun.com/repository/central/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/central/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.squareup.okhttp3:okhttp-bom:4.12.0.
        > Could not get resource
        'https://maven.aliyun.com/repository/gradle-plugin/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/gradle-plugin/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.squareup.okhttp3:okhttp-bom:4.12.0.
        > Could not get resource
        'https://dl.google.com/dl/android/maven2/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        > Could not GET
        'https://dl.google.com/dl/android/maven2/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.squareup.okhttp3:okhttp-bom:4.12.0.
        > Could not get resource
        'https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        > Could not GET
        'https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp-bom/4.12.0/okhttp-bom-4.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not find com.squareup.okhttp3:okhttp:.
        Searched in the following locations:
        -
        file:/C:/Users/22969/Desktop/%E5%B7%A5%E4%BD%9C%E9%A1%B9%E7%9B%AE/%E9%9A%A7%E9%81%93Ar/%E9%9A%A7%E9%81%93%E5%B9%B3%E6%9D%BFdemo/android/capacitor-cordova-android-plugins/src/main/libs/okhttp.jar
        -
        file:/C:/Users/22969/Desktop/%E5%B7%A5%E4%BD%9C%E9%A1%B9%E7%9B%AE/%E9%9A%A7%E9%81%93Ar/%E9%9A%A7%E9%81%93%E5%B9%B3%E6%9D%BFdemo/android/app/libs/okhttp.jar
        Required by:
        project :app > project :capacitor-community-media
        > Could not resolve androidx.exifinterface:exifinterface:1.3.7.
        Required by:
        project :app > project :capacitor-camera
        > Could not resolve androidx.exifinterface:exifinterface:1.3.7.
        > Could not get resource
        'https://maven.aliyun.com/repository/google/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/google/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve androidx.exifinterface:exifinterface:1.3.7.
        > Could not get resource
        'https://maven.aliyun.com/repository/central/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/central/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve androidx.exifinterface:exifinterface:1.3.7.
        > Could not get resource
        'https://maven.aliyun.com/repository/gradle-plugin/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/gradle-plugin/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve androidx.exifinterface:exifinterface:1.3.7.
        > Could not get resource
        'https://dl.google.com/dl/android/maven2/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        > Could not GET
        'https://dl.google.com/dl/android/maven2/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve androidx.exifinterface:exifinterface:1.3.7.
        > Could not get resource
        'https://repo.maven.apache.org/maven2/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        > Could not GET
        'https://repo.maven.apache.org/maven2/androidx/exifinterface/exifinterface/1.3.7/exifinterface-1.3.7.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.google.android.material:material:1.12.0.
        Required by:
        project :app > project :capacitor-camera
        > Could not resolve com.google.android.material:material:1.12.0.
        > Could not get resource
        'https://maven.aliyun.com/repository/google/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/google/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.google.android.material:material:1.12.0.
        > Could not get resource
        'https://maven.aliyun.com/repository/central/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/central/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.google.android.material:material:1.12.0.
        > Could not get resource
        'https://maven.aliyun.com/repository/gradle-plugin/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        > Could not GET
        'https://maven.aliyun.com/repository/gradle-plugin/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.google.android.material:material:1.12.0.
        > Could not get resource
        'https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        > Could not GET
        'https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        Received status code 400 from server: Bad Request
        > Could not resolve com.google.android.material:material:1.12.0.
        > Could not get resource
        'https://repo.maven.apache.org/maven2/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        > Could not GET
        'https://repo.maven.apache.org/maven2/com/google/android/material/material/1.12.0/material-1.12.0.pom'.
        Received status code 400 from server: Bad Request

        * 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 30s
        14 actionable tasks: 14 executed

Current Behavior

When adding the packages "@capacitor-community/media": "^8.0.1" and "@capacitor/camera": "^7.0.2" to the project, the Android build process fails with network errors. The build succeeds when these two packages and their related code are removed from the project.

The specific behavior includes:

  • Network errors occur during the Android build process when these Capacitor plugins are included
  • Adding mirror repositories to gradle configuration does not resolve the issue
  • The build completes successfully only when both packages are completely removed

Expected Behavior

The Android build should complete successfully even with @capacitor-community/media and @capacitor/camera packages included in the project. The build process should be able to download and integrate these Capacitor plugins without network-related failures.

Other Technical Details

Project configuration:

  • Capacitor version: 7.4.3
  • Problematic packages:
    • @capacitor-community/media@8.0.1
    • @capacitor/camera@7.0.2
      Steps to reproduce:
  1. Install dependencies: npm install
  2. Add the two packages to package.json dependencies
  3. Build frontend: npm run build-only
  4. Sync to Android: npx cap sync android
  5. Attempt Android build: npx cap build android

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions