flutter_keyboard_visibility icon indicating copy to clipboard operation
flutter_keyboard_visibility copied to clipboard

fix: Android Namespace error

Open robotoss opened this issue 1 year ago • 5 comments

Summary

This PR updates the build.gradle file to improve compatibility with the latest Android Gradle Plugin (AGP) and Kotlin version, while also enhancing the project’s structure and testing capabilities.

Changes

  1. Updated Plugin and Library Versions:

    • Gradle Plugin: Upgraded from 7.4.2 to 8.1.0.
  2. Project Group and Version:

    • Converted group and version syntax from Groovy-style to Kotlin-style (= syntax).
  3. Repositories:

    • Added mavenCentral() alongside google() in both buildscript and allprojects for broader dependency resolution.
  4. Android Configuration:

    • Namespace Definition: Modified the namespace configuration to use the Kotlin-style assignment (=) syntax for AGP compatibility.
    • SDK Versions:
      • Increased compileSdk from 31 to 34.
      • Raised minSdk from 16 to 21 for improved compatibility with newer libraries.
  5. Source Sets Configuration:

    • Updated sourceSets to include Kotlin-specific directories:
      • main.java.srcDirs += "src/main/kotlin"
      • test.java.srcDirs += "src/test/kotlin"
  6. Code Quality and Compatibility:

    • Added kotlinOptions with jvmTarget = JavaVersion.VERSION_1_8 for consistency with compileOptions.

Impact

  • Improves compatibility with newer versions of Android and Kotlin.
  • Facilitates better test management with JUnitPlatform and standard logging configurations.
  • Aligns project structure with modern Android development practices by adding Kotlin support and increasing minimum SDK version.

robotoss avatar Nov 04 '24 11:11 robotoss

Hey @MisterJimson ,

Could you take a quick look at PR #166r? It support new version Android studio with java

Thanks a lot!

robotoss avatar Nov 06 '24 18:11 robotoss

LGTM, while I'm not a maintainer of this repo, what is the issue you're encountering, Is it Java 8 warnings after updating to Android Ladybug?

I understand I just wanted to clarify so that maintenrea would have fewer questions if he opens a merge request =)

From the experience of current projects i just used the fix on Mac OS

  1. brew install openjdk@17
  2. flutter config --jdk-dir /opt/homebrew/opt/openjdk@17
  3. restart Terminal and Android Studio

to avoid problems with JAVA using LadyBag

robotoss avatar Jan 26 '25 09:01 robotoss

flutter config --jdk-dir /opt/homebrew/opt/openjdk@17

It's better to update AGP, Gradle, and the dependencies instead of changing the default Android Studio JDK.

EchoEllet avatar Jan 26 '25 11:01 EchoEllet

This fixed it for me, it is causing issue with most packages, so instead of changing in all packages, this should work https://github.com/justsoft/video_thumbnail/issues/174#issuecomment-2482641854

gh-ranjanKiran avatar Apr 03 '25 08:04 gh-ranjanKiran

could you please make a fork of this to add it to pubspec.yaml?

kururu-abdo avatar May 25 '25 09:05 kururu-abdo