Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] photo_manager 3.2.1: unable to build Android apk on Github Action #1163

Closed
thenartus opened this issue Jul 17, 2024 · 3 comments

Comments

@thenartus
Copy link

Version

3.2.1

Platforms

Android

Device Model

all models, unable to build on Github Action

flutter info

flutter doctor
  shell: /usr/bin/bash -e {0}
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Zulu_jdk/17.0.12-7/x64
    JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Zulu_jdk/17.0.12-7/x64
    FLUTTER_ROOT: /opt/hostedtoolcache/flutter/stable-3.19.5-x64
    PUB_CACHE: /opt/hostedtoolcache/flutter/stable-3.19.5-x64/.pub-cache
    ANDROID_HOME: /usr/local/lib/android/sdk
    ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
  ╔════════════════════════════════════════════════════════════════════════════╗
  ║                 Welcome to Flutter! - https://flutter.dev                  ║
  ║                                                                            ║
  ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
  ║ statistics and basic crash reports. This data is used to help improve      ║
  ║ Flutter tools over time.                                                   ║
  ║                                                                            ║
  ║ Flutter tool analytics are not sent on the very first run. To disable      ║
  ║ reporting, type 'flutter config --no-analytics'. To display the current    ║
  ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out    ║
  ║ event will be sent, and then no further information will be sent by the    ║
  ║ Flutter tool.                                                              ║
  ║                                                                            ║
  ║ By downloading the Flutter SDK, you agree to the Google Terms of Service.  ║
  ║ The Google Privacy Policy describes how data is handled in this service.   ║
  ║                                                                            ║
  ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and  ║
  ║ crash reports to Google.                                                   ║
  ║                                                                            ║
  ║ Read about data we send with crash reports:                                ║
  ║ https://flutter.dev/docs/reference/crash-reporting                         ║
  ║                                                                            ║
  ║ See Google's privacy policy:                                               ║
  ║ https://policies.google.com/privacy                                        ║
  ║                                                                            ║
  ║ To disable animations in this tool, use                                    ║
'flutter config --no-cli-animations'.                                      ║
  ╚════════════════════════════════════════════════════════════════════════════╝
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.5, on Ubuntu 22.04.4 LTS 6.5.0-1023-azure, locale C.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Chrome - develop for the web
[✗] Linux toolchain - develop for Linux desktop
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
    ✗ GTK 3.0 development libraries are required for Linux development.
      They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
[!] Android Studio (not installed)
[✓] Connected device (2 available)
[✓] Network resources
! Doctor found issues in 2 categories.

How to reproduce?

Unable to build android app after adding photo_manager into dependencies. Here is my Github Action file

name: PR Check

# Controls when the workflow will run
on:
  pull_request:
    branches:
      - dev
    types:
      - opened
      - edited
      - reopened
      - synchronize

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  validation:
    name: 'Run test and build android code'
    runs-on: ubuntu-latest
    concurrency:
      cancel-in-progress: true
      group: ${{ github.event.pull_request.number || github.event.pull_request_target.number || github.ref }}
    steps:
    - uses: actions/checkout@v2
      with:
        ref: ${{ github.event.pull_request_target.head.ref || github.event.pull_request.head.ref }}
        repository: ${{ github.event.pull_request_target.head.repo.full_name || github.event.pull_request.head.repo.full_name}}
    - name:  Setup Java
      uses: actions/setup-java@v3
      with:
        distribution: 'zulu'
        java-version: '17'
    - name: Install Flutter 
      uses: subosito/[email protected]
      with:
        flutter-version: '3.19.5'
        channel: 'stable'
    - name: Setup Android SDK Tools
      uses: android-actions/[email protected]
    - name: Flutter doctor
      run: flutter doctor
    - name: Format code
      run: dart format . --fix --set-exit-if-changed
    - name: analyse code
      run: |
        flutter pub get
        dart analyze --fatal-infos --fatal-warnings
    - name: Run tests
      run: |
        flutter test --coverage
    - name: build apk debug
      run: flutter build apk --debug --no-shrink

Logs

* What went wrong:
Execution failed for task ':app:mergeLibDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform debug (project :photo_manager) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, com.android.build.api.attributes.AgpVersionAttr=7.3.0, com.android.build.api.attributes.BuildTypeAttr=debug, com.android.build.gradle.internal.attributes.VariantAttr=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=28, org.gradle.category=library, org.gradle.jvm.environment=android, org.gradle.libraryelements=classes, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
      > Execution failed for DexingNoClasspathTransform: /home/runner/work/photoProb/photoProb/build/photo_manager/intermediates/runtime_library_classes_dir/debug.
         > Error while dexing.

Example code (optional)

no example, just add the dependencies then try to build apk using github action

Contact

No response

@AlexV525
Copy link
Member

You may enable verbose logs for Gradle to see what is happening.

@thenartus
Copy link
Author

turn out i just need to change java distribution to 'adopt' and issue is fixed. This is so weird 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants