GithubHelp home page GithubHelp logo

Comments (18)

Dev-hwang avatar Dev-hwang commented on August 19, 2024 1

It's most likely a problem with the ForegroundService class. The service may have been restarted by returning the START_STICKY value from the onStartCommand function and calling the setRestartAlarm function from the onDestroy function.

But it's weird. When testing and releasing, there were no problems, and when set the stopWithTask option, it ended properly. Looks like we need some more testing. It's hard to check right away because I have other work to do, but I'll give you an answer as soon as possible.

Geofence plugin and Foreground plugin are separate. So try editing the code by forking the foreground plugin git.

  1. Comment out the START_STICKY return value or change it to START_NOT_STICKY.
  2. Comment out the code that calls the setRestartAlarm function.
	override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
		super.onStartCommand(intent, flags, startId)
		
                 // ...

		when (serviceAction) {
			ForegroundServiceAction.START,
			ForegroundServiceAction.UPDATE -> {
				startForegroundService()
				if (sharedPreferences.contains(ForegroundServicePrefsKey.CALLBACK_HANDLE)) {
					val callback = sharedPreferences.getLong(ForegroundServicePrefsKey.CALLBACK_HANDLE, 0L)
					executeDartCallback(callback)
				}

				return START_NOT_STICKY // here
			}
			ForegroundServiceAction.REBOOT,
			ForegroundServiceAction.RESTART -> {
				startForegroundService()
				if (sharedPreferences.contains(ForegroundServicePrefsKey.CALLBACK_HANDLE_ON_BOOT)) {
					val callback = sharedPreferences.getLong(ForegroundServicePrefsKey.CALLBACK_HANDLE_ON_BOOT, 0L)
					executeDartCallback(callback)
				}

				return START_NOT_STICKY  // here
			}
			ForegroundServiceAction.STOP -> stopForegroundService()
		}

		return START_NOT_STICKY
	}

	override fun onBind(p0: Intent?): IBinder? {
		return null
	}

	override fun onDestroy() {
		super.onDestroy()
		destroyForegroundTask()
		if (serviceAction != ForegroundServiceAction.STOP) {
			Log.d(TAG, "The foreground service was terminated due to an unexpected problem. Set a restart alarm.")
			// setRestartAlarm() // here
		}
	}

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024 1

Try this!

Add the following line to your pubspec.yaml file.

dependency_overrides:
  flutter_foreground_task: ^3.1.0

Run the command.

flutter clean
flutter pub get

Set isSticky value to false in AndroidNotificationOptions settings.

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: WillStartForegroundTask(
        onWillStart: () => _polyGeofenceService.isRunningService,
        androidNotificationOptions: AndroidNotificationOptions(
          channelId: 'geofence_service_notification_channel',
          channelName: 'Geofence Service Notification',
          channelDescription: 'This notification appears when the geofence service is running in the background.',
          isSticky: false,
          channelImportance: NotificationChannelImportance.LOW,
          priority: NotificationPriority.LOW,
        ),
        iosNotificationOptions: IOSNotificationOptions(),
        notificationTitle: 'Geofence Service is running',
        notificationText: 'Tap to return to the app',
        child: Scaffold(
          appBar: AppBar(
            title: const Text('Poly Geofence Service'),
            centerTitle: true,
          ),
          body: _buildContentView(),
        ),
      ),
    );
  }

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024 1

Could you please provide a project with the private code removed? Thanks for posting it on Git.

I will continue to check for problems.

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024 1

@kamami

Would you like to test with this branch? I hope the problem is resolved.

dependency_overrides:
  flutter_foreground_task:
    git:
      url: https://github.com/Dev-hwang/flutter_foreground_task.git
      ref: fix_remote_service_exception

Run the command.

flutter clean
flutter pub get

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024 1

This plugin has been upgraded to version 3.4.2. You no longer need to use dependency_overrides. If you encounter any other issues, please open a new issue.

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024

Did you set the android:stopWithTask option value to true?

<service
    android:name="com.pravera.flutter_foreground_task.service.ForegroundService"
    android:foregroundServiceType="location"
    android:stopWithTask="true" />

And set the notification importance and priority to LOW.

from geofence_service.

kamami avatar kamami commented on August 19, 2024

Yes, android:stopWithTask is set to true.
Also I changed the priority to LOW and cleaned the build, but it did not fix the issue,
Do you need any more information from my code? What could it be? Everything is working as expected, except that I can not kill the background service at all.

from geofence_service.

kamami avatar kamami commented on August 19, 2024

Ok I will try my best. Never forked a plugin before... Please let me know if you have an update for your awesome plugin - I will let you know if your suggestion works!

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024

Tell me the os version of the device you tested (Android 10?) and I'm curious about the flutter sdk version!

The 'flutter doctor' command allows you to check the flutter sdk version.

from geofence_service.

kamami avatar kamami commented on August 19, 2024

Device version of my emulators is 10.0 and 8.1. Both the same issue. My real device runs on Android 11.
This is the output of flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.18363.1766], locale de-DE)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1)
[√] VS Code (version 1.61.0)
[√] Connected device (2 available)

• No issues found!

from geofence_service.

kamami avatar kamami commented on August 19, 2024

The service seems to be closed by killing the app now!

Unfortunately the app immediately crashes when opening it afterwards again.

I/flutter (23014): LIFE: AppLifecycleState.inactive
I/flutter (23014): LIFE: AppLifecycleState.paused
I/flutter (23014): LIFE: AppLifecycleState.resumed
I/flutter (23014): true
I/flutter (23014): true
D/AndroidRuntime(23014): Shutting down VM
E/AndroidRuntime(23014): FATAL EXCEPTION: main
E/AndroidRuntime(23014): Process: com.example.aschaffenburger_geheimnisse, PID: 23014
E/AndroidRuntime(23014): android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{a5ef0ab u0 com.example.aschaffenburger_geheimnisse/com.pravera.flutter_foreground_task.service.ForegroundService}
E/AndroidRuntime(23014):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2005)
E/AndroidRuntime(23014):        at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(23014):        at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime(23014):        at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(23014):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(23014):        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(23014):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process (23014): Sending signal. PID: 23014 SIG: 9
Lost connection to device.

from geofence_service.

kamami avatar kamami commented on August 19, 2024

Could you please provide a project with the private code removed? Thanks for posting it on Git.

I will continue to check for problems.

Here you can find a repository where I tried to recreate the issue:
https://github.com/kamami/geofence_service_debugging

The issue is as follows:

  • The service keeps running in the background when closing the app ✔️
  • The background service seems to be killed, when exiting the app via task manager of android device ✔️
  • The service is not restarting when opening the app again (after killing via task manager) ❌
  • The app crashes sometimes completely when opening the app again (after killing via task manager) ❌

Hopefully this repository helps to find the issue!

from geofence_service.

kamami avatar kamami commented on August 19, 2024

Any news on the issue?

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024

I'm still trying to figure out the problem.

I'm testing it based on the project you submitted, but it's not easy to reproduce the problem. I've tested the project with real devices and simulators, but nothing happens.

The cause of the RemoteServiceException is when the Android system requested to start the foreground service, but it did not start properly. It means the problem is that the onStartCommand function of the service class is not called. So I'm testing to be able to start the foreground service from the onCreate function inside the service.

I still don't know why this is happening. I'd appreciate it if you let me know if you find a way.

from geofence_service.

kamami avatar kamami commented on August 19, 2024

@Dev-hwang
After testing it for a couple hours, it indeed seems to be working as expected now! I will test it the next days even further in detail and will let you know how it went. Thanks a lot so far!

What Kotlin Version are you using? I am getting this error while bulding the debug-apk:

Compilation with Kotlin compile daemon was not successful
java.lang.Exception: Unknown or invalid session 1
        at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:60)
        at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:59)
        at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:219)
        at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:151)
        at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:130)
        at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:200)
        at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:195)
        at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:96)
        at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:578)
        at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:429)
        at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(Tasks.kt:374)
        at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:342)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
        at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:47)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
        at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:555)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:540)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:523)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:271)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:260)
        at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:33)
        at java.util.Optional.map(Optional.java:215)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:42)
        at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
        at java.util.Optional.map(Optional.java:215)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
        at java.util.Optional.orElseGet(Optional.java:267)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:187)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.lang.Thread.run(Thread.java:748)

warning: runtime JAR files in the classpath have the version 1.3, which is older than the API version 1.5. Consider using the runtime of version 1.5, or pass '-api-version 1.3' explicitly to restrict the available APIs to the runtime of version 1.3. You can also pass '-language-version 1.3' instead, which will restrict not only the APIs to the specified v
ersion, but also the language features
C:\Users\seubem\.gradle\caches\transforms-2\files-2.1\1f08deae79879076bcac2b1f3626651f\jetified-kotlin-stdlib-jdk7-1.3.50.jar: warning: runtime JAR file has version 1.3 which is older than required for API version 1.5
C:\Users\seubem\.gradle\caches\transforms-2\files-2.1\2006d9cd975941c96726b05246bd81be\jetified-kotlin-stdlib-1.3.50.jar: warning: runtime JAR file has version 1.3 which is older than required for API version 1.5
C:\Users\seubem\.gradle\caches\transforms-2\files-2.1\3c9a39e1476d4457feec8f2326291fd7\jetified-kotlin-stdlib-common-1.3.50.jar: warning: runtime JAR file has version 1.3 which is older than required for API version 1.5
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\fl_location-1.0.1\android\src\main\kotlin\com\pravera\fl_location\service\LocationDataProvider.kt:137:24: warning: 'getter for isFromMockProvider: Boolean' is deprecated. Deprecated in Java
                                        isMock = location.isFromMockProvider

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024

For compatibility issues, I'm using the project default version 1.3.50

Here is the build.gradle content:

group 'com.pravera.flutter_foreground_task'
version '1.0-SNAPSHOT'

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

rootProject.allprojects {
    repositories {
        google()
        jcenter()
    }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 30

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    defaultConfig {
        minSdkVersion 16
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
}

from geofence_service.

Dev-hwang avatar Dev-hwang commented on August 19, 2024

If that doesn't work, try changing the ext.kotlin_version to 1.4.32 in your project.

buildscript {
    ext.kotlin_version = '1.4.32'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

from geofence_service.

kamami avatar kamami commented on August 19, 2024

Thanks it worked!

from geofence_service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.