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

Fails to build on Android #80

Closed
SaxPlayer opened this issue Nov 22, 2024 · 4 comments
Closed

Fails to build on Android #80

SaxPlayer opened this issue Nov 22, 2024 · 4 comments

Comments

@SaxPlayer
Copy link

Builds fine on iOS but following error when compiling for Android:

`
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':background_location_tracker:compileDebugKotlin'.

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (21).

Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation

  • 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 2s
Error: Gradle task assembleDebug failed with exit code 1

Exited (1).
`

Using Gradle version 8.9
flutter.minSdkVersion=21
flutter.targetSdkVersion=34
flutter.compileSdkVersion=34

flutter doctor (verbose):

`
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.1.1 24B2091 darwin-arm64, locale en-GB)
• Flutter version 3.24.5 on channel stable at /Users/andyclayton/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision dec2ee5c1f (9 days ago), 2024-11-13 11:13:06 -0800
• Engine revision a18df97ca5
• Dart version 3.5.4
• DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/andyclayton/development/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] VS Code (version 1.95.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.100.0

[✓] Connected device (4 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 15 (API 35) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.1.1 24B2091 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.1.1 24B2091 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.86
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
• All expected network resources are available.

• No issues found!
`

@SaxPlayer
Copy link
Author

SaxPlayer commented Nov 22, 2024

Further information. More detailed log on compile that may help:

`
e: file:///Users/saxplayer/.pub-cache/hosted/pub.dev/background_location_tracker-1.4.3/android/src/main/kotlin/com/icapps/background_location_tracker/BackgroundLocationTrackerPlugin.kt:115:21 'lifecycle' hides member of supertype 'LifecycleOwner' and needs an 'override' modifier.
e: file:///Users/saxplayer/.pub-cache/hosted/pub.dev/background_location_tracker-1.4.3/android/src/main/kotlin/com/icapps/background_location_tracker/BackgroundLocationTrackerPlugin.kt:167:9 'getLifecycle' overrides nothing.
3 warnings

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':background_location_tracker:compileDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Compilation error. See log for more details

  • 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 12s
Error: Gradle task assembleDebug failed with exit code 1

Exited (1).
`

@SaxPlayer
Copy link
Author

SaxPlayer commented Nov 22, 2024

The fork mentioned in another bug report made by @ jeferson505 fixes this issue, so that fork needs merging. Glad there's a workaround for the time being!

dependencies: background_location_tracker: git: url: https://github.com/jeferson505/flutter-background-location-tracker.git

@12people
Copy link

Unfortunately, the fork doesn't seem to solve the Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (21) issue for me, not sure why.

@ikbendewilliam
Copy link
Contributor

This should be fixed now in version 1.5.0

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

No branches or pull requests

3 participants