【问题标题】:Android Studio R8 NullPointerExceptionAndroid Studio R8 NullPointerException
【发布时间】:2020-03-22 08:52:39
【问题描述】:

当我更新到 classpath 'com.android.tools.build:gradle:3.6.1' 时,我遇到了这个无法理解的错误。

R8: The method `java.util.concurrent.Flow$Subscriber org.reactivestreams.FlowAdapters.toFlowSubscriber(org.reactivestreams.Subscriber)` does not type check and will be assumed to be unreachable.
R8: The method `java.util.concurrent.Flow$Processor org.reactivestreams.FlowAdapters.toFlowProcessor(org.reactivestreams.Processor)` does not type check and will be assumed to be unreachable.
R8: The method `java.util.concurrent.Flow$Publisher org.reactivestreams.FlowAdapters.toFlowPublisher(org.reactivestreams.Publisher)` does not type check and will be assumed to be unreachable.

> Task :MXApp:minifyAdminReleaseWithR8 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':MXApp:minifyAdminReleaseWithR8'.
> java.lang.NullPointerException (no error message)

* 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 2m 9s

也许有人暗示我要摆脱它?

【问题讨论】:

  • 看起来好像您使用 R8 无法正确处理的库 reactive-streams-flow-adapters(类 org.reactivestreams.FlowAdapters)。你能解释一下在你的代码中是如何使用它的吗?您能否使用--stacktrace 运行./gradlew 命令并提供详细的输出?我已经打开issuetracker.google.com/152163747 来跟踪这个。请在那里跟进。

标签: android android-r8 android-studio-3.6.1


【解决方案1】:

这原来是 https://issuetracker.google.com/150325706 的副本,请参阅 https://issuetracker.google.com/150325706#comment25 了解如何使用 R8 版本 1.6.82 进行修复。

这应该在 Android Studio 3.6.2(发布时)中解决。

【讨论】:

    【解决方案2】:

    是的,我可以确认,这有帮助

    buildscript {
        repositories {
            maven {
                url 'https://storage.googleapis.com/r8-releases/raw'
            }
        }
    
        dependencies {
            classpath 'com.android.tools:r8:1.6.82' // Must be before the Gradle Plugin for Android.
            classpath 'com.android.tools.build:gradle:3.6.1' 
        }
    }
    
    

    谢谢@sgjesse

    【讨论】:

      猜你喜欢
      • 2020-06-09
      • 2020-07-16
      • 1970-01-01
      • 2021-02-23
      • 1970-01-01
      • 2021-10-06
      • 2023-04-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多