ZacSweers / MoshiX

Extensions for Moshi including IR plugins, moshi-sealed, and more.
Apache License 2.0
516 stars 37 forks source link

moshi-ksp not working with Proguard/R8. Fails to find JsonAdapters at runtime #121

Closed ursusursus closed 3 years ago

ursusursus commented 3 years ago
2021-05-31 15:41:32.070 27708-27708/sk.foo.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
    Process: sk.foo.myapplication, PID: 27708
    java.lang.RuntimeException: Unable to start activity ComponentInfo{sk.foo.myapplication/sk.foo.myapplication.MainActivity}: java.lang.RuntimeException: Failed to find the generated JsonAdapter class for class e.a.a.a
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3431)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7660)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.RuntimeException: Failed to find the generated JsonAdapter class for class e.a.a.a
        at b.b.a.t.b.d(:579)
        at b.b.a.r$b.a(:61)
        at b.b.a.q.f(:145)
        at b.b.a.q.e(:105)
        at b.b.a.q.c(:79)
        at sk.foo.myapplication.MainActivity.onCreate(:15)
        at android.app.Activity.performCreate(Activity.java:8000)
        at android.app.Activity.performCreate(Activity.java:7984)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3404)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7660) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
     Caused by: java.lang.ClassNotFoundException: e.a.a.aJsonAdapter
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at b.b.a.t.b.d(:553)
        at b.b.a.r$b.a(:61) 
        at b.b.a.q.f(:145) 
        at b.b.a.q.e(:105) 
        at b.b.a.q.c(:79) 
        at sk.foo.myapplication.MainActivity.onCreate(:15) 
        at android.app.Activity.performCreate(Activity.java:8000) 
        at android.app.Activity.performCreate(Activity.java:7984) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3404) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7660) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
     Caused by: java.lang.ClassNotFoundException: Didn't find class "e.a.a.aJsonAdapter" on path: DexPathList[[zip file "/data/app/~~tnIvr9zy7BPu8D2CgmGVGw==/sk.foo.myapplication-FIQk2jedNbCD9gSoMV93RQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~tnIvr9zy7BPu8D2CgmGVGw==/sk.foo.myapplication-FIQk2jedNbCD9gSoMV93RQ==/lib/arm64, /system/lib64, /system_ext/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:454) 
        at b.b.a.t.b.d(:553) 
        at b.b.a.r$b.a(:61) 
        at b.b.a.q.f(:145) 
        at b.b.a.q.e(:105) 
        at b.b.a.q.c(:79) 
        at sk.foo.myapplication.MainActivity.onCreate(:15) 
        at android.app.Activity.performCreate(Activity.java:8000) 
        at android.app.Activity.performCreate(Activity.java:7984) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3404) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7660) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 

Here is a repro project https://github.com/ursusursus/MoshiKspRepro

I setup minification in debug so you can see it right away. I also put in a keep rule in proguard-rules.pro, you need both of them.

Note that even cleaning is busted, since if you uncomment the keep rules, it will work; and if you comment them out again, it will work. Only manually deleting /build folders AND uninstalling the app causes the crash to manifest again (as it should)

ursusursus commented 3 years ago

Also, unsure if this is this library or a ksp itself

ZacSweers commented 3 years ago

Notes in testing

✅ Generated adapter at app/build/generated/ksp/release/kotlin/sk/foo/myapplication/InAppReviewConfigJsonAdapter.kt

// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "ClassName", "REDUNDANT_PROJECTION",
    "RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
    "PLATFORM_CLASS_MAPPED_TO_KOTLIN")

package sk.foo.myapplication

import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.emptySet
import kotlin.text.buildString

public class InAppReviewConfigJsonAdapter(
  moshi: Moshi
) : JsonAdapter<InAppReviewConfig>() {
  private val options: JsonReader.Options =
      JsonReader.Options.of("timeForReviewAfterActivationMillis", "timeForReviewAfterLoginMillis",
      "inAppReviewIntervalMillis")

  private val longAdapter: JsonAdapter<Long> = moshi.adapter(Long::class.java, emptySet(),
      "timeForReviewAfterActivationMillis")

  public override fun toString(): String = buildString(39) {
      append("GeneratedJsonAdapter(").append("InAppReviewConfig").append(')') }

  public override fun fromJson(reader: JsonReader): InAppReviewConfig {
    var timeForReviewAfterActivationMillis: Long? = null
    var timeForReviewAfterLoginMillis: Long? = null
    var inAppReviewIntervalMillis: Long? = null
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> timeForReviewAfterActivationMillis = longAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("timeForReviewAfterActivationMillis",
            "timeForReviewAfterActivationMillis", reader)
        1 -> timeForReviewAfterLoginMillis = longAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("timeForReviewAfterLoginMillis",
            "timeForReviewAfterLoginMillis", reader)
        2 -> inAppReviewIntervalMillis = longAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("inAppReviewIntervalMillis", "inAppReviewIntervalMillis",
            reader)
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    return InAppReviewConfig(
        timeForReviewAfterActivationMillis = timeForReviewAfterActivationMillis ?:
            throw Util.missingProperty("timeForReviewAfterActivationMillis",
            "timeForReviewAfterActivationMillis", reader),
        timeForReviewAfterLoginMillis = timeForReviewAfterLoginMillis ?:
            throw Util.missingProperty("timeForReviewAfterLoginMillis",
            "timeForReviewAfterLoginMillis", reader),
        inAppReviewIntervalMillis = inAppReviewIntervalMillis ?:
            throw Util.missingProperty("inAppReviewIntervalMillis", "inAppReviewIntervalMillis",
            reader)
    )
  }

  public override fun toJson(writer: JsonWriter, value_: InAppReviewConfig?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("timeForReviewAfterActivationMillis")
    longAdapter.toJson(writer, value_.timeForReviewAfterActivationMillis)
    writer.name("timeForReviewAfterLoginMillis")
    longAdapter.toJson(writer, value_.timeForReviewAfterLoginMillis)
    writer.name("inAppReviewIntervalMillis")
    longAdapter.toJson(writer, value_.inAppReviewIntervalMillis)
    writer.endObject()
  }
}

✅ Generated rules at app/build/generated/ksp/release/resources/META-INF/proguard/moshi-sk.foo.myapplication.InAppReviewConfig.pro

-if class sk.foo.myapplication.InAppReviewConfig
-keepnames class sk.foo.myapplication.InAppReviewConfig
-if class sk.foo.myapplication.InAppReviewConfig
-keep class sk.foo.myapplication.InAppReviewConfigJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}

🔴 Merged configuration does not contain the generated proguard rules at app/build/outputs/mapping/release/configuration.txt

# The proguard configuration file for the following section is /Users/zsweers/dev/scratch/MoshiKspRepro/app/build/intermediates/proguard-files/proguard-android-optimize.txt-4.2.1
# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
#
# Starting with version 2.2 of the Android plugin for Gradle, this file is distributed together with
# the plugin and unpacked at build-time. The files in $ANDROID_HOME are no longer maintained and
# will be ignored by new version of the Android plugin for Gradle.

# Optimizations: If you don't want to optimize, use the proguard-android.txt configuration file
# instead of this one, which turns off the optimization flags.
# Adding optimization introduces certain risks, since for example not all optimizations performed by
# ProGuard works on all versions of Dalvik.  The following flags turn off various optimizations
# known to have issues, but the list may not be complete or up to date. (The "arithmetic"
# optimization can be used if you are only targeting Android 2.0 or later.)  Make sure you test
# thoroughly if you go this route.
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizationpasses 5
-allowaccessmodification

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose

# Preserve some attributes that may be required for reflection.
-keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod

-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
-keep public class com.google.android.vending.licensing.ILicensingService
-dontnote com.android.vending.licensing.ILicensingService
-dontnote com.google.vending.licensing.ILicensingService
-dontnote com.google.android.vending.licensing.ILicensingService

# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames,includedescriptorclasses class * {
    native <methods>;
}

# Keep setters in Views so that animations can still work.
-keepclassmembers public class * extends android.view.View {
    void set*(***);
    *** get*();
}

# We want to keep methods in Activity that could be used in the XML attribute onClick.
-keepclassmembers class * extends android.app.Activity {
    public void *(android.view.View);
}

# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keepclassmembers class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

# Preserve annotated Javascript interface methods.
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

# The support libraries contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontnote android.support.**
-dontnote androidx.**
-dontwarn android.support.**
-dontwarn androidx.**

# This class is deprecated, but remains for backward compatibility.
-dontwarn android.util.FloatMath

# Understand the @Keep support annotation.
-keep class android.support.annotation.Keep
-keep class androidx.annotation.Keep

-keep @android.support.annotation.Keep class * {*;}
-keep @androidx.annotation.Keep class * {*;}

-keepclasseswithmembers class * {
    @android.support.annotation.Keep <methods>;
}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <methods>;
}

-keepclasseswithmembers class * {
    @android.support.annotation.Keep <fields>;
}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <fields>;
}

-keepclasseswithmembers class * {
    @android.support.annotation.Keep <init>(...);
}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <init>(...);
}

# These classes are duplicated between android.jar and org.apache.http.legacy.jar.
-dontnote org.apache.http.**
-dontnote android.net.http.**

# These classes are duplicated between android.jar and core-lambda-stubs.jar.
-dontnote java.lang.invoke.**

# End of content from /Users/zsweers/dev/scratch/MoshiKspRepro/app/build/intermediates/proguard-files/proguard-android-optimize.txt-4.2.1
# The proguard configuration file for the following section is /Users/zsweers/dev/scratch/MoshiKspRepro/app/proguard-rules.pro
#-keep class sk.foo.myapplication.InAppReviewConfig { *; }
#-keep class sk.foo.myapplication.InAppReviewConfigJsonAdapter { *; }
# End of content from /Users/zsweers/dev/scratch/MoshiKspRepro/app/proguard-rules.pro
# The proguard configuration file for the following section is /Users/zsweers/dev/scratch/MoshiKspRepro/app/build/intermediates/aapt_proguard_file/release/aapt_rules.txt
-keep class androidx.core.app.CoreComponentFactory { <init>(); }
-keep class sk.foo.myapplication.MainActivity { <init>(); }
-keep class android.widget.Space { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.app.AlertController$RecycleListView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.view.menu.ActionMenuItemView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.view.menu.ExpandedMenuView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.view.menu.ListMenuItemView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.ActionBarContainer { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.ActionBarContextView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.ActionBarOverlayLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.ActionMenuView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.ActivityChooserView$InnerLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.AlertDialogLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.ButtonBarLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.ContentFrameLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.DialogTitle { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.FitWindowsFrameLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.FitWindowsLinearLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.SearchView$SearchAutoComplete { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.Toolbar { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.appcompat.widget.ViewStubCompat { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.constraintlayout.widget.ConstraintLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.coordinatorlayout.widget.CoordinatorLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.core.widget.NestedScrollView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class androidx.recyclerview.widget.RecyclerView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.appbar.MaterialToolbar { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.button.MaterialButton { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.chip.Chip { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.chip.ChipGroup { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.datepicker.MaterialCalendarGridView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.internal.BaselineLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.internal.CheckableImageButton { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.internal.NavigationMenuItemView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.internal.NavigationMenuView { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.snackbar.Snackbar$SnackbarLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.snackbar.SnackbarContentLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.textfield.TextInputEditText { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.textfield.TextInputLayout { <init>(android.content.Context, android.util.AttributeSet); }

-keep class com.google.android.material.textview.MaterialTextView { <init>(android.content.Context, android.util.AttributeSet); }

# End of content from /Users/zsweers/dev/scratch/MoshiKspRepro/app/build/intermediates/aapt_proguard_file/release/aapt_rules.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/3fdfbc70439e428bb99fe48b98ecfb82/rules/lib/META-INF/proguard/moshi.pro
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

-keepclasseswithmembers class * {
    @com.squareup.moshi.* <methods>;
}

-keep @com.squareup.moshi.JsonQualifier interface *

# Enum field names are used by the integrated EnumJsonAdapter.
# values() is synthesized by the Kotlin compiler and is used by EnumJsonAdapter indirectly
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
    <fields>;
    **[] values();
}

# Keep helper method to avoid R8 optimisation that would keep all Kotlin Metadata when unwanted
-keepclassmembers class com.squareup.moshi.internal.Util {
    private static java.lang.String getKotlinMetadataClassName();
}

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/3fdfbc70439e428bb99fe48b98ecfb82/rules/lib/META-INF/proguard/moshi.pro
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/48a3731c1e6a117f615df9f653e4b491/rules/lib/META-INF/proguard/okio.pro
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/48a3731c1e6a117f615df9f653e4b491/rules/lib/META-INF/proguard/okio.pro
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/9a3c25ae8c28317781bda9f198b5ab34/material-1.2.1/proguard.txt
# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# CoordinatorLayout resolves the behaviors of its child components with reflection.
-keep public class * extends androidx.coordinatorlayout.widget.CoordinatorLayout$Behavior {
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>();
}

# Make sure we keep annotations for CoordinatorLayout's DefaultBehavior
-keepattributes RuntimeVisible*Annotation*

# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# AppCompatViewInflater reads the viewInflaterClass theme attribute which then
# reflectively instantiates MaterialComponentsViewInflater using the no-argument
# constructor. We only need to keep this constructor and the class name if
# AppCompatViewInflater is also being kept.
-if class androidx.appcompat.app.AppCompatViewInflater
-keep class com.google.android.material.theme.MaterialComponentsViewInflater {
    <init>();
}

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/9a3c25ae8c28317781bda9f198b5ab34/material-1.2.1/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/a83efe24ca6b1282abeaa41fc452dea4/appcompat-1.2.0/proguard.txt
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# aapt is not able to read app::actionViewClass and app:actionProviderClass to produce proguard
# keep rules. Add a commonly used SearchView to the keep list until b/109831488 is resolved.
-keep class androidx.appcompat.widget.SearchView { <init>(...); }

# Never inline methods, but allow shrinking and obfuscation.
-keepclassmembernames,allowobfuscation,allowshrinking class androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper$Impl* {
  <methods>;
}

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/a83efe24ca6b1282abeaa41fc452dea4/appcompat-1.2.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/93e659d712c053d8e646c5ceb8895582/coordinatorlayout-1.1.0/proguard.txt
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# CoordinatorLayout resolves the behaviors of its child components with reflection.
-keep public class * extends androidx.coordinatorlayout.widget.CoordinatorLayout$Behavior {
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>();
}

# Make sure we keep annotations for CoordinatorLayout's DefaultBehavior and ViewPager's DecorView
-keepattributes *Annotation*

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/93e659d712c053d8e646c5ceb8895582/coordinatorlayout-1.1.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/c0c018f65da9f58c43265830610b34d0/transition-1.2.0/proguard.txt
# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Keep a field in transition that is used to keep a reference to weakly-referenced object
-keepclassmembers class androidx.transition.ChangeBounds$* extends android.animation.AnimatorListenerAdapter {
  androidx.transition.ChangeBounds$ViewBounds mViewBounds;
}

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/c0c018f65da9f58c43265830610b34d0/transition-1.2.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/6f9ee4eeeb3f9e40fb682ca9e11b9c76/vectordrawable-animated-1.1.0/proguard.txt
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# keep setters in VectorDrawables so that animations can still work.
-keepclassmembers class androidx.vectordrawable.graphics.drawable.VectorDrawableCompat$* {
   void set*(***);
   *** get*();
}

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/6f9ee4eeeb3f9e40fb682ca9e11b9c76/vectordrawable-animated-1.1.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/86a96a5c570668f3fe46fb56de6e03b5/recyclerview-1.1.0/proguard.txt
# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# When layoutManager xml attribute is used, RecyclerView inflates
#LayoutManagers' constructors using reflection.
-keep public class * extends androidx.recyclerview.widget.RecyclerView$LayoutManager {
    public <init>(android.content.Context, android.util.AttributeSet, int, int);
    public <init>();
}

-keepclassmembers class androidx.recyclerview.widget.RecyclerView {
    public void suppressLayout(boolean);
    public boolean isLayoutSuppressed();
}
# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/86a96a5c570668f3fe46fb56de6e03b5/recyclerview-1.1.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/074ce62702a9a4f1812d96d107dc5842/core-1.3.1/proguard.txt
# Never inline methods, but allow shrinking and obfuscation.
-keepclassmembernames,allowobfuscation,allowshrinking class androidx.core.view.ViewCompat$Api* {
  <methods>;
}
-keepclassmembernames,allowobfuscation,allowshrinking class androidx.core.view.WindowInsetsCompat$Impl* {
  <methods>;
}
-keepclassmembernames,allowobfuscation,allowshrinking class androidx.core.view.WindowInsetsCompat$BuilderImpl* {
  <methods>;
}
# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/074ce62702a9a4f1812d96d107dc5842/core-1.3.1/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/e6e96508ddb38a629669b96ec7966667/versionedparcelable-1.1.0/proguard.txt
-keep public class * implements androidx.versionedparcelable.VersionedParcelable
-keep public class android.support.**Parcelizer { *; }
-keep public class androidx.**Parcelizer { *; }
-keep public class androidx.versionedparcelable.ParcelImpl

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/e6e96508ddb38a629669b96ec7966667/versionedparcelable-1.1.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/4cef1f988442f8d139e3446d201ee6a0/lifecycle-runtime-2.1.0/proguard.txt
-keepattributes *Annotation*

-keepclassmembers enum androidx.lifecycle.Lifecycle$Event {
    <fields>;
}

-keep !interface * implements androidx.lifecycle.LifecycleObserver {
}

-keep class * implements androidx.lifecycle.GeneratedAdapter {
    <init>(...);
}

-keepclassmembers class ** {
    @androidx.lifecycle.OnLifecycleEvent *;
}
# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/4cef1f988442f8d139e3446d201ee6a0/lifecycle-runtime-2.1.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/9a117490817e337400bdd0205c2cc59b/lifecycle-viewmodel-2.1.0/proguard.txt
-keepclassmembers,allowobfuscation class * extends androidx.lifecycle.ViewModel {
    <init>();
}

-keepclassmembers,allowobfuscation class * extends androidx.lifecycle.AndroidViewModel {
    <init>(android.app.Application);
}

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/9a117490817e337400bdd0205c2cc59b/lifecycle-viewmodel-2.1.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/7a96eede1b9c3190b084ed2b04ed5bec/savedstate-1.0.0/proguard.txt
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

-keepclassmembers,allowobfuscation class * implements androidx.savedstate.SavedStateRegistry$AutoRecreated {
    <init>();
}

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/7a96eede1b9c3190b084ed2b04ed5bec/savedstate-1.0.0/proguard.txt
# The proguard configuration file for the following section is /Users/zsweers/.gradle/caches/transforms-2/files-2.1/14f3b7368e2d69f07b27cc43bcc199ce/rules/lib/META-INF/proguard/androidx-annotations.pro
-keep,allowobfuscation @interface androidx.annotation.Keep
-keep @androidx.annotation.Keep class * {*;}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <methods>;
}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <fields>;
}

-keepclasseswithmembers class * {
    @androidx.annotation.Keep <init>(...);
}

# End of content from /Users/zsweers/.gradle/caches/transforms-2/files-2.1/14f3b7368e2d69f07b27cc43bcc199ce/rules/lib/META-INF/proguard/androidx-annotations.pro
# The proguard configuration file for the following section is <unknown>
-ignorewarnings
# End of content from <unknown>

I'm not sure if this is a bug with KSP or with AGP. I'll start by filing on KSP.

ZacSweers commented 3 years ago

Filed here https://github.com/google/ksp/issues/464

ZacSweers commented 3 years ago

Note the merged configuration does pick up your custom rules, and if I manually add the generated rules, it does appear to work correctly (the names of both InAppReviewConfig and its JsonAdapter are correctly preserved). b.c.a.v is also what Moshi.class is obfuscated to

image

efemoney commented 3 years ago

Just got hit by this too... :sad_parrot:

ZacSweers commented 3 years ago

I'm going to look at sharing a manual workaround for this, stay tuned. Should just be a matter of plumbing the KSP task output files to the R8Task inputs and filtering on proguard files

ZacSweers commented 3 years ago

Here's a workaround. I've tested this with the repro project and confirmed the merged configuration at the end then successfully included the generated rules. It's in groovy and you'd obviously need to adapt it as-needed for your own real-world projects, but you should be able to get off the mark with this snippet.

import com.google.devtools.ksp.gradle.KspGradleSubplugin
import com.google.devtools.ksp.gradle.KspTask
import com.android.build.gradle.internal.tasks.R8Task

// Other build file stuff

afterEvaluate {
  // Get the KSP task's outputs as a provider, map it to proguard files
  def kspGeneratedProguardFiles = tasks.named("kspReleaseKotlin", KspTask)
      .flatMap {
        it.destinationDirectory.map {
          it.getAsFileTree().matching {
            include("**/META-INF/proguard/*")
          }
        }
      }

  // Wire it into the R8Task's configurationFiles property
  tasks.named("minifyReleaseWithR8", R8Task) {
    it.configurationFiles.from(kspGeneratedProguardFiles)
  }
}

Confirmed merged configuration includes it

# The proguard configuration file for the following section is /Users/zsweers/dev/scratch/MoshiKspRepro/app/build/generated/ksp/release/resources/META-INF/proguard/moshi-sk.foo.myapplication.InAppReviewConfig.pro
-if class sk.foo.myapplication.InAppReviewConfig
-keepnames class sk.foo.myapplication.InAppReviewConfig
-if class sk.foo.myapplication.InAppReviewConfig
-keep class sk.foo.myapplication.InAppReviewConfigJsonAdapter {
    public <init>(com.squareup.moshi.Moshi);
}

# End of content from /Users/zsweers/dev/scratch/MoshiKspRepro/app/build/generated/ksp/release/resources/META-INF/proguard/moshi-sk.foo.myapplication.InAppReviewConfig.pro
efemoney commented 3 years ago

Thanks @ZacSweers, I also just added this same workaround 👍🏽, confirmed its working fine with this.

ZacSweers commented 3 years ago

This is now fixed in KSP as of beta03

ursusursus commented 3 years ago

Btw I tried the beta03 even the beta04, and project won't compile with

Execution failed for task ':user:contract:kspKotlin'.
> Extension of type 'KspExtension' does not exist. Currently registered extension types: [ExtraPropertiesExtension]

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':user:contract:kspKotlin'.
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
    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:411)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:398)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:391)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:377)
    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 org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.UnknownDomainObjectException: Extension of type 'KspExtension' does not exist. Currently registered extension types: [ExtraPropertiesExtension]
    at org.gradle.internal.extensibility.ExtensionsStorage.getHolderByType(ExtensionsStorage.java:88)
    at org.gradle.internal.extensibility.ExtensionsStorage.getByType(ExtensionsStorage.java:74)
    at org.gradle.internal.extensibility.DefaultConvention.getByType(DefaultConvention.java:159)
    at org.gradle.internal.extensibility.DefaultConvention.getByType(DefaultConvention.java:154)
    at com.google.devtools.ksp.gradle.KspTask$DefaultImpls.getApOptions(KspSubplugin.kt:344)
    at com.google.devtools.ksp.gradle.KspTaskJvm.getApOptions(KspSubplugin.kt:354)
    at com.google.devtools.ksp.gradle.KspTaskJvm_Decorated.getApOptions(Unknown Source)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$BeanPropertyValue$1$1.create(AbstractNestedRuntimeBeanNode.java:77)
    at org.gradle.internal.deprecation.DeprecationLogger.whileDisabled(DeprecationLogger.java:236)
    at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$BeanPropertyValue$1.get(AbstractNestedRuntimeBeanNode.java:73)
    at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:167)
    at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$BeanPropertyValue.call(AbstractNestedRuntimeBeanNode.java:133)
    at org.gradle.api.internal.tasks.properties.AbstractValidatingProperty.validate(AbstractValidatingProperty.java:39)
    at org.gradle.api.internal.tasks.properties.DefaultTaskProperties.validate(DefaultTaskProperties.java:193)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.validate(ExecuteActionsTaskExecuter.java:431)
    at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:50)
    at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:88)
    at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:88)
    at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
    at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:46)
    at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:34)
    at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:43)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$3.withWorkspace(ExecuteActionsTaskExecuter.java:286)
    at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:43)
    at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:33)
    at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:40)
    at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:30)
    at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:54)
    at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:40)
    at org.gradle.internal.execution.impl.DefaultExecutionEngine.execute(DefaultExecutionEngine.java:41)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:183)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:183)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
    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:411)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:398)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:391)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:377)
    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 org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)

Is this related to moshi? Do I have to wait for moshi-ksp to update to beta04? Or some upstream bug?

ZacSweers commented 3 years ago

I don't see anything related to this processor in that trace. Please file on KSP

ursusursus commented 3 years ago

K sorry, https://github.com/google/ksp/issues/496