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

Upgrade gradle (for compatibility) and upgrade location services (fixes crashes) #183

Merged
merged 3 commits into from
Jul 17, 2023

Conversation

cadivus
Copy link
Contributor

@cadivus cadivus commented Mar 10, 2023

Hi!

This library unfortunately doesn't work with newer Gradle versions anymore, what is fixed by the first commit.

The second commit fixes problems on some Android devices that happen because of the old play-services-location library. This was the message when it crashed:

E/AndroidRuntime( 7137): java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/######/base.apk)
E/AndroidRuntime( 7137): 	at com.almoullim.background_location.LocationUpdatesService.getLastLocation(LocationUpdatesService.kt:188)
E/AndroidRuntime( 7137): 	at com.almoullim.background_location.LocationUpdatesService.onCreate(LocationUpdatesService.kt:125)
E/AndroidRuntime( 7137): 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4515)
E/AndroidRuntime( 7137): 	at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
E/AndroidRuntime( 7137): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2162)
E/AndroidRuntime( 7137): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 7137): 	at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime( 7137): 	at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime( 7137): 	at android.app.ActivityThread.main(ActivityThread.java:7898)
E/AndroidRuntime( 7137): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7137): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime( 7137): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

With these two commits, everything works fine.
The changes are tested for Android and iOS.

@cadivus cadivus changed the title Upgrade gradle (for compatibility) and upgrade location services (fixes crashed) Upgrade gradle (for compatibility) and upgrade location services (fixes crashes) Mar 10, 2023
@Some1Somewhere
Copy link

Some1Somewhere commented Mar 10, 2023

This seems to close #177

@cadivus
Copy link
Contributor Author

cadivus commented Mar 10, 2023

@Some1Somewhere I'm not sure whether this helps you, but the first commit fixes this for me:

$ flutter run
Using hardware rendering with device sdk gphone64 x86 64. If you notice graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':background_location' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

* 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 10s
Running Gradle task 'assembleDebug'...                             11.8s
Exception: Gradle task assembleDebug failed with exit code 1

@MoralCode
Copy link
Collaborator

can confirm this PR helped me resolve the issue in the previous comment (The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher). Looking forward to seeing this get merged - let me know if there's anything I can help with to get this merged and released to pub.dev!

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

Successfully merging this pull request may close these issues.

6 participants