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

NoSuchMethodError (No static method empty()Lj$/util/stream/Stream) occured in EventsFileHelper.readFile since ver 8.2.2. #1213

Open
11 tasks done
kouroku-room opened this issue Nov 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kouroku-room
Copy link

kouroku-room commented Nov 26, 2024

‼️ Required data ‼️

Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

There are a lot of things that can contribute to things not working. Having a very basic understanding of your environment will help us understand your issue faster!

Environment

  • Output of flutter doctor
flutter doctor -v
flutter doctor -v
[√] Flutter (Channel stable, 3.24.5, on Microsoft Windows [Version 10.0.22631.4460], locale ja-JP)
    • Flutter version 3.24.5 on channel stable at C:\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (13 days ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\sugur\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.1)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.10.34928.147
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio Koala Feature Drop
    • 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 version "17.0.11" 2024-04-16

[√] Android Studio (version 2024.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 version "21.0.3" 2024-04-16

[√] VS Code (version 1.95.2)
    • VS Code at C:\Users\sugur\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.100.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.4460]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 131.0.6778.86
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 131.0.2903.63

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

• No issues found!
  • Version of purchases-flutter
  purchases_flutter: ^8.2.2
  purchases_ui_flutter: ^8.2.2
The issue does not occur with 8.2.1 version.
  purchases_flutter: 8.2.1
  purchases_ui_flutter: 8.2.1
  • Testing device version e.g.: iOS 15.5, Android API 30, etc.
  • Google Play Console pre-launch report
    • Crashed
      • Android 12(SDK 31)google Pixel 6
    • Test devices without issues
      • Android 11(SDK 30)motorola Motorola G20
      • Android 11(SDK 30)google Pixel 5
      • Android 12L(SDK 32)Generic Small Desktop (x86) (Virtual)
      • Android 13(SDK 33)samsung Galaxy Tab S8 Ultra
      • Android 13(SDK 33)google Pixel 5 64-bit only
      • Android 13(SDK 33)google Pixel 7
      • Android 14(SDK 34)google Pixel 8
      • Android 14(SDK 34)samsung Galaxy S23 Ultra
      • Android 14(SDK 34)google Pixel 5 64-bit only
  • Product Environment
    • Crashed
      • Android 13 Galaxy Tab S8 Ultra
      • Android 14 Galaxy S23 Ultra
      • Android 11 Moto G(20)
      • Android 13 Pixel 7
      • Android12 Sdk_goog3_gpc_x86_64
      • etc.
  • How often the issue occurs- every one of your customers is impacted? Only in dev?

6% crushed in Product Environment.

I am putting the Crashlytics logs because I could not reproduce this in my environment, even with the Release build.

    Fatal Exception: java.lang.NoSuchMethodError: No static method empty()Lj$/util/stream/Stream; in class Lj$/util/stream/Stream; or its super classes (declaration of 'j$.util.stream.Stream' appears in /data/app/~~8vjc2X15kCZB5Fx8_BiSlw==/androidx.test.tools.crawler-LbIIr6wdJSdr132BzP7deQ==/base.apk!classes3.dex)
 at com.revenuecat.purchases.utils.EventsFileHelper.readFile(EventsFileHelper.kt:30)
 at com.revenuecat.purchases.paywalls.events.PaywallEventsManager.getEventsToSync(PaywallEventsManager.kt:82)
 at com.revenuecat.purchases.paywalls.events.PaywallEventsManager.access$getEventsToSync(PaywallEventsManager.kt:16)
 at com.revenuecat.purchases.paywalls.events.PaywallEventsManager$flushEvents$1.invoke(PaywallEventsManager.kt:49)
 at com.revenuecat.purchases.paywalls.events.PaywallEventsManager$flushEvents$1.invoke(PaywallEventsManager.kt:43)
 at com.revenuecat.purchases.paywalls.events.PaywallEventsManager.enqueue$lambda$0(PaywallEventsManager.kt:90)
 at com.revenuecat.purchases.common.Dispatcher.enqueue$lambda$2$lambda$1(Dispatcher.kt:67)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
 at java.util.concurrent.FutureTask.run(FutureTask.java:264)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
 at com.revenuecat.purchases.PurchasesFactory$LowPriorityThreadFactory.newThread$lambda$1(PurchasesFactory.kt:357)
 at java.lang.Thread.run(Thread.java:1012)
  • Steps to reproduce, with a description of expected vs. actual behavior

I was not able to occur this issue on the device I have.
And I could not find the specific error point because the place where it occurs is not Dart.

Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

I thought it might be caused by this issue with the Android Studio Lady Bug, so I built using Android Studio Koala Feature Drop, but the crash still occurred.

Using JavaVersion.VERSION_1_8, so I tried JavaVersion.VERSION_17, but the crash still occurs.

Describe the bug

A crash is reported in the pre-launch report when the android app upload to the Google Play Console.

It doesn't happen on my device, but some devices sends Clashlytics a crash log.

Additional context

multiDexEnabled is true.

android/app/build.gradle
plugins {
    id "com.android.application"
    // START: FlutterFire Configuration
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
    // END: FlutterFire Configuration
    id "kotlin-android"
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    namespace "XXXXXXXXXXXXXXXXXXXXX"
    // for flutter_local_notifications
    compileSdk 34
    ndkVersion = "27.0.12077973"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
        // for flutter_local_notifications
        coreLibraryDesugaringEnabled true
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        applicationId "XXXXXXXXXXXXXXXXXXXXX"
        // for purchases_flutter Paywalls
        // https://www.revenuecat.com/docs/tools/paywalls
        minSdk = 24
        targetSdk = flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        // for flutter_local_notifications
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        // FirebaseでSHA 証明書フィンガープリントが登録できてるか確認するためdebugもreleaseと同じ証明書を使う
        debug {
            signingConfig signingConfigs.release
        }
        release {
            signingConfig signingConfigs.release

            // ProGuardの設定ファイル
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            // Google Play Consoleでの警告「デバッグシンボルがアップロードされていません」の対応
            ndk {
                debugSymbolLevel 'SYMBOL_TABLE'
            }
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    // for flutter_local_notifications
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
    implementation 'androidx.window:window:1.0.0'
    implementation 'androidx.window:window-java:1.0.0'
    // for Platform View
    // https://docs.flutter.dev/deployment/android#enabling-material-components
    implementation 'com.google.android.material:material:1.11.0'
}
android/app/proguard-rules.pro
# from https://github.com/google/gson/blob/main/examples/android-proguard-example/proguard.cfg
##---------------Begin: proguard configuration for Gson  ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
}

# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken

##---------------End: proguard configuration for Gson  ----------

# for in_app_review
# https://github.com/britannio/in_app_review/issues/68#issuecomment-1250256853
-keep class com.google.android.play.core.review.** { *; }
-keep class com.google.android.gms.tasks.** { *; }

# for flutter_file_picker
# https://github.com/miguelpruivo/flutter_file_picker/wiki/Setup
-keep class androidx.lifecycle.DefaultLifecycleObserver

# for device_calendar
-keep class com.builttoroam.devicecalendar.** { *; }
@kouroku-room kouroku-room added the bug Something isn't working label Nov 26, 2024
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants