Home > Mobile >  Flutter Android build not working in existing app on fresh Linux install
Flutter Android build not working in existing app on fresh Linux install

Time:06-21

I have an existing flutter app (on GitHub here) that is working fine on my Windows 11 and MacOS machines, and was previously working on my Linux machine.

I installed a new distro a few days ago (OpenSUSE Tumbleweed) and now can't get the Android build to work. It fails with various errors depending on what stage of trying out different SDK version, etc., but the current error I'm on (after deleting everything and pulling it all down fresh) is:

Execution failed for task ':app:dependencies'.
> Could not resolve all dependencies for configuration ':app:androidApis'.
   > Could not create task ':app:generateDebugLintModel'.
      > java.lang.NullPointerException (no error message)

and also the below error a bit further down:

* Where:
Script '/home/jackv/bin/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 157

* What went wrong:
Execution failed for task ':tasks'.
> Could not create task ':generateLockfiles'.
   > Process 'command '/home/jackv/Development/ComicWrap-F/android/gradlew'' finished with non-zero exit value 1

The weird thing is that creating a new project with flutter create --platform=android test_project results in a project that can build, but even if I go line by line and make sure all the build.gradle, .properties files, etc. are all the same it still doesn't work for my existing app.

I'm at a loss because the exact project files in the git repo were working totally fine on all platforms until I tried to start fresh on OpenSUSE.

My flutter doctor -v:

[✓] Flutter (Channel stable, 3.0.2, on openSUSE Tumbleweed 5.18.4-1-default, locale en_AU.UTF-8)
    • Flutter version 3.0.2 at /home/jackv/bin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (10 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/jackv/Android/Sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /home/jackv/bin/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12 0-b1504.28-7817840)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang   is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
    ✗ 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
    • pkg-config version 1.8.0
    ✗ 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 (version 2021.2)
    • Android Studio at /home/jackv/bin/android-studio
    • Flutter plugin version 68.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12 0-b1504.28-7817840)

[✓] VS Code (version 1.68.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.42.0

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • openSUSE Tumbleweed 5.18.4-1-default

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.

CodePudding user response:

So turns out I didn't follow my own README, my local.properties file was missing the required adMob.appId entry.

I found the error by opening the AndroidManifest.xml project in Android Studio and looking at the errors in the "Merged" tab!

  • Related