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

jvm target incompatibility #43

Open
SpirikleOfficial opened this issue Aug 25, 2024 · 27 comments
Open

jvm target incompatibility #43

SpirikleOfficial opened this issue Aug 25, 2024 · 27 comments
Labels
awaiting response Waiting for response bug Something isn't working platform:android Issue related to Android

Comments

@SpirikleOfficial
Copy link

Getting this error:

Execution failed for task ':update_available_android:compileDebugKotlin'.

'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.

if we have in android/settings.gradle the following config then it works:

    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
    id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

but if the above are changed to:

    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "8.0.2" apply false
    id "org.jetbrains.kotlin.android" version "1.9.0" apply false
}

then the error is recieved.

update_available version: 3.1.0+1

@mateusfccp
Copy link
Owner

Thank you for your report.

Can you provide a minimal reproduction sample?

@mateusfccp mateusfccp added awaiting response Waiting for response platform:android Issue related to Android in triage The issue is being triaged labels Aug 25, 2024
@SpirikleOfficial
Copy link
Author

Open the default flutter project and add the lines mentioned previously. Also in the gradle-wrapper.properties file change the distributionURL to:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip

The above changes gave us the error.

@mateusfccp
Copy link
Owner

Open the default flutter project and add the lines mentioned previously. Also in the gradle-wrapper.properties file change the distributionURL to:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip

The above changes gave us the error.

What version of Flutter are you using? Did it used to work in previous versions?

@SpirikleOfficial
Copy link
Author

Yes it did used to work previously. It seems the flutter version is not the culprit but the gradle versions are. As we tried to run on latest flutter default project and there it ran perfectly but with old gradle versions.

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [Version 10.0.22631.4037], locale en-CA)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.1)
[√] Android Studio (version 2024.1)
[√] VS Code (version 1.89.1)
[√] Connected device (3 available)
[√] Network resources

@mateusfccp mateusfccp added bug Something isn't working and removed awaiting response Waiting for response in triage The issue is being triaged labels Aug 26, 2024
@SpirikleOfficial
Copy link
Author

any update on how long this is going to take? We need to use it before 29 Aug.

@mateusfccp
Copy link
Owner

any update on how long this is going to take? We need to use it before 29 Aug.

Hello, @SpirikleOfficial.

Could you open a PR with a fix?

I'm not sure I'll be able to do it myself before tomorrow, as I'm a little busy this week, but I could definitely review your PR.

mateusfccp added a commit that referenced this issue Aug 29, 2024
Signed-off-by: Mateus Felipe C. C. Pinto <[email protected]>
@mateusfccp
Copy link
Owner

@SpirikleOfficial Can you test against master? I just committed a potential solution.

In my personal tests, it should now emit a warning but compile nonetheless.

@SpirikleOfficial
Copy link
Author

Will check and let you know

@mateusfccp
Copy link
Owner

@SpirikleOfficial I don't want to bother you, but could you test it?

I want to release a new version after this has been solved.

@SpirikleOfficial
Copy link
Author

Used this in our pubspec.yaml:

dependency_overrides:
  update_available:
    git:
      url: https://github.com/mateusfccp/update_available
      ref: master
      path: update_available
  update_available_ios:
    git:
      url: https://github.com/mateusfccp/update_available
      ref: master
      path: update_available_ios
  update_available_android:
    git:
      url: https://github.com/mateusfccp/update_available
      ref: master
      path: update_available_android

Compiled with success. However, our debug app had old version and Google play store shows update available but we are getting UnknownAvailability() everytime. The same code worked previously when your package was able to compile but not now. The code is:

 final updateAvailability = await getUpdateAvailability();
    switch (updateAvailability) {
      case UpdateAvailable():
        {
          print('update available');
        }
      case NoUpdateAvailable():
        {
          
          print('no update available');
        }
      case UnknownAvailability():
        {
          print('unknown update available');
        }
    }

Are we doing something wrong in our code or there is a problem in the package?

@mateusfccp
Copy link
Owner

@SpirikleOfficial

That's interesting (and weird).

Does anything appear in the Java logs?

@SpirikleOfficial
Copy link
Author

These are the logs after the getUpdateAvailablity() is called:

I/PlayCore(18318): UID: [10926]  PID: [18318] AppUpdateService : requestUpdateInfo(com.spirikle.scanclan)
I/PlayCore(18318): UID: [10926]  PID: [18318] AppUpdateService : Initiate binding to the service.
W/System  (18318): Ignoring header X-Firebase-Locale because its value was null.
I/PlayCore(18318): UID: [10926]  PID: [18318] AppUpdateService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.installservice.DevTriggeredUpdateService})
I/PlayCore(18318): UID: [10926]  PID: [18318] AppUpdateService : linkToDeath
W/DynamiteModule(18318): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
I/DynamiteModule(18318): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
W/ProviderInstaller(18318): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
D/TrafficStats(18318): tagSocket(123) with statsTag=0xffffffff, statsUid=-1
W/ProviderInstaller(18318): Failed to report request stats: com.google.android.gms.common.security.ProviderInstallerImpl.reportRequestStats [class android.content.Context, long, long]
I/irikle.scanclan(18318): Waiting for a blocking GC ClassLinker
I/irikle.scanclan(18318): WaitForGcToComplete blocked ClassLinker on NativeAlloc for 47.732ms
V/NativeCrypto(18318): Registering com/google/android/gms/org/conscrypt/NativeCrypto's 305 native methods...
W/irikle.scanclan(18318): Accessing hidden method Ldalvik/system/VMStack;->getStackClass2()Ljava/lang/Class; (unsupported, reflection, allowed)
W/irikle.scanclan(18318): Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (unsupported, reflection, allowed)
I/ProviderInstaller(18318): Installed default security provider GmsCore_OpenSSL
W/OnBackInvokedCallback(18318): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback(18318): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
D/TrafficStats(18318): tagSocket(265) with statsTag=0xffffffff, statsUid=-1
I/PlayCore(18318): UID: [10926]  PID: [18318] OnRequestInstallCallback : onRequestInfo
I/PlayCore(18318): UID: [10926]  PID: [18318] AppUpdateService : Unbind from service.
W/irikle.scanclan(18318): Accessing hidden field Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (unsupported, reflection, allowed)

@mateusfccp
Copy link
Owner

UnknownAvailability means specifically that something happened that prevented the plugin from discovering the availability, probably an error.

It's weird that it didn't happen before and is happening now.

The log doesn't show anything relevant.

@mateusfccp
Copy link
Owner

@SpirikleOfficial

Please, update your code to the latest master.

I exposed the PlatformException from the method channel to the UnknownAvailability object.

Please, test your code again and check whether the error and stackTrace object are non-null. They may give us more insight about what's happening.

@SpirikleOfficial
Copy link
Author

after running pub get:

! update_available 3.1.0 from git https://github.com/mateusfccp/update_available at d46125 in update_available (overridden)
! update_available_android 3.1.0 from git https://github.com/mateusfccp/update_available at d46125 in update_available_android (overridden)
! update_available_ios 3.1.0 from git https://github.com/mateusfccp/update_available at d46125 in update_available_ios (overridden)
+ update_available_platform_interface 4.0.1

Not able to compile:

../../AppData/Local/Pub/Cache/git/update_available-d46125c3cd537c1a1f45d179e0669c170a56d365/update_available_android/lib/update_available_android.dart:25:9: Error: No named parameter with the name 'error'.
        error: error,
        ^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/update_available_platform_interface-4.0.1/lib/src/availability.dart:28:9: Context: Found this candidate, but the arguments don't match.
  const UnknownAvailability();
        ^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot_program failed: Exception

@mateusfccp
Copy link
Owner

mateusfccp commented Sep 11, 2024

Right, I forgot about pubspec_overrides.

@mateusfccp
Copy link
Owner

I just released 3.2.0-dev.1. Can you test against it?

@SpirikleOfficial
Copy link
Author

pub get:

! update_available 3.1.0 from git https://github.com/mateusfccp/update_available at b1c960 in update_available (overridden)
! update_available_android 3.1.0 from git https://github.com/mateusfccp/update_available at b1c960 in update_available_android (overridden)
! update_available_ios 3.1.0 from git https://github.com/mateusfccp/update_available at b1c960 in update_available_ios (overridden)

no compilation as before:

../../AppData/Local/Pub/Cache/git/update_available-b1c960ba037824afacdaabf91ee70a8c0186b6ad/update_available_android/lib/update_available_android.dart:25:9: Error: No named parameter with the name 'error'.
        error: error,
        ^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/update_available_platform_interface-4.0.1/lib/src/availability.dart:28:9: Context: Found this candidate, but the arguments don't match.
  const UnknownAvailability();
        ^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot_program failed: Exception

@mateusfccp
Copy link
Owner

pub get:

! update_available 3.1.0 from git https://github.com/mateusfccp/update_available at b1c960 in update_available (overridden)
! update_available_android 3.1.0 from git https://github.com/mateusfccp/update_available at b1c960 in update_available_android (overridden)
! update_available_ios 3.1.0 from git https://github.com/mateusfccp/update_available at b1c960 in update_available_ios (overridden)

no compilation as before:

../../AppData/Local/Pub/Cache/git/update_available-b1c960ba037824afacdaabf91ee70a8c0186b6ad/update_available_android/lib/update_available_android.dart:25:9: Error: No named parameter with the name 'error'.
        error: error,
        ^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/update_available_platform_interface-4.0.1/lib/src/availability.dart:28:9: Context: Found this candidate, but the arguments don't match.
  const UnknownAvailability();
        ^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot_program failed: Exception

Your packages are wrong for some reason.

update_available_platform_interface should be 4.1.0-dev.1 instead of 4.0.1.

Are you sure you removed all overrides?

@SpirikleOfficial
Copy link
Author

Please tell the code to write in pubspec.yaml

@mateusfccp
Copy link
Owner

mateusfccp commented Sep 12, 2024

dependencies:
  update_available: 3.2.0-dev.1

You shouldn't have anything related to update_available in dependency_overrides.

@SpirikleOfficial
Copy link
Author

Got it. Below is the console output:

I/PlayCore(12753): UID: [10926]  PID: [12753] AppUpdateService : requestUpdateInfo(com.spirikle.scanclan)
I/PlayCore(12753): UID: [10926]  PID: [12753] AppUpdateService : Initiate binding to the service.
I/PlayCore(12753): UID: [10926]  PID: [12753] AppUpdateService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.installservice.DevTriggeredUpdateService})
I/PlayCore(12753): UID: [10926]  PID: [12753] AppUpdateService : linkToDeath
W/DynamiteModule(12753): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
I/PlayCore(12753): UID: [10926]  PID: [12753] OnRequestInstallCallback : onRequestInfo
I/PlayCore(12753): UID: [10926]  PID: [12753] AppUpdateService : Unbind from service.
I/DynamiteModule(12753): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
W/ProviderInstaller(12753): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
W/ProviderInstaller(12753): Failed to report request stats: com.google.android.gms.common.security.ProviderInstallerImpl.reportRequestStats [class android.content.Context, long, long]
V/NativeCrypto(12753): Registering com/google/android/gms/org/conscrypt/NativeCrypto's 305 native methods...
W/irikle.scanclan(12753): Accessing hidden method Ldalvik/system/VMStack;->getStackClass2()Ljava/lang/Class; (unsupported, reflection, allowed)
W/irikle.scanclan(12753): Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (unsupported, reflection, allowed)
I/ProviderInstaller(12753): Installed default security provider GmsCore_OpenSSL
W/OnBackInvokedCallback(12753): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback(12753): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.

@mateusfccp
Copy link
Owner

Can you see if any error is returned in the UnknownAvailability object?

Notice that now it has two fields, error and stackTrace. They should have a PlatformException and it's exception.

@SpirikleOfficial
Copy link
Author

used this code:

 case UnknownAvailability():
        {
          print(
              'error from updateAvailability object: ${updateAvailability.error}');
          print(
              'stackTrace from updateAvailability object: ${updateAvailability.stackTrace}');
        }

Output:

I/PlayCore(30456): UID: [10926]  PID: [30456] AppUpdateService : requestUpdateInfo(com.spirikle.scanclan)
I/PlayCore(30456): UID: [10926]  PID: [30456] AppUpdateService : Initiate binding to the service.
I/PlayCore(30456): UID: [10926]  PID: [30456] AppUpdateService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.installservice.DevTriggeredUpdateService})
I/PlayCore(30456): UID: [10926]  PID: [30456] AppUpdateService : linkToDeath
I/PlayCore(30456): UID: [10926]  PID: [30456] OnRequestInstallCallback : onRequestInfo
I/PlayCore(30456): UID: [10926]  PID: [30456] AppUpdateService : Unbind from service.
W/OnBackInvokedCallback(30456): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback(30456): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
I/flutter (30456): error from updateAvailability object: PlatformException(INITIALIZATION_FAILURE, Failed to get appUpdateInfoTask, null, null)
I/flutter (30456): stackTrace from updateAvailability object: #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7)
I/flutter (30456): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
I/flutter (30456): <asynchronous suspension>
I/flutter (30456): #2      UpdateAvailableAndroidPlugin.getUpdateAvailability (package:update_available_android/update_available_android.dart:16:25)
I/flutter (30456): <asynchronous suspension>
I/flutter (30456): #3      _HomeScreenState.checkUpdate (package:scanclan/screens/home_screen.dart:309:32)
I/flutter (30456): <asynchronous suspension>

@pro100svitlo
Copy link

Hi guys,
any update on this issue?
I am facing the same one

@mateusfccp
Copy link
Owner

@pro100svitlo I can't reproduce with the example.

If you can reproduce the problem with the example or provide a PR, I would gladly review it.

@mateusfccp mateusfccp added the awaiting response Waiting for response label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response Waiting for response bug Something isn't working platform:android Issue related to Android
Projects
None yet
Development

No branches or pull requests

3 participants