fix: Android Namespace error
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
-
Updated Plugin and Library Versions:
- Gradle Plugin: Upgraded from
7.4.2to8.1.0.
- Gradle Plugin: Upgraded from
-
Project Group and Version:
- Converted
groupandversionsyntax from Groovy-style to Kotlin-style (=syntax).
- Converted
-
Repositories:
- Added
mavenCentral()alongsidegoogle()in bothbuildscriptandallprojectsfor broader dependency resolution.
- Added
-
Android Configuration:
- Namespace Definition: Modified the
namespaceconfiguration to use the Kotlin-style assignment (=) syntax for AGP compatibility. - SDK Versions:
- Increased
compileSdkfrom31to34. - Raised
minSdkfrom16to21for improved compatibility with newer libraries.
- Increased
- Namespace Definition: Modified the
-
Source Sets Configuration:
- Updated
sourceSetsto include Kotlin-specific directories:main.java.srcDirs += "src/main/kotlin"test.java.srcDirs += "src/test/kotlin"
- Updated
-
Code Quality and Compatibility:
- Added
kotlinOptionswithjvmTarget = JavaVersion.VERSION_1_8for consistency withcompileOptions.
- Added
Impact
- Improves compatibility with newer versions of Android and Kotlin.
- Facilitates better test management with
JUnitPlatformand standard logging configurations. - Aligns project structure with modern Android development practices by adding Kotlin support and increasing minimum SDK version.
Hey @MisterJimson ,
Could you take a quick look at PR #166r? It support new version Android studio with java
Thanks a lot!
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
- brew install openjdk@17
- flutter config --jdk-dir /opt/homebrew/opt/openjdk@17
- restart Terminal and Android Studio
to avoid problems with JAVA using LadyBag
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.
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
could you please make a fork of this to add it to pubspec.yaml?