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

desugar_java8 failed on executing kapt dependencies #19

Open
jeraldsun opened this issue May 27, 2022 · 0 comments
Open

desugar_java8 failed on executing kapt dependencies #19

jeraldsun opened this issue May 27, 2022 · 0 comments

Comments

@jeraldsun
Copy link

jeraldsun commented May 27, 2022

I got the following error when I ran bazelisk mobile-install:

ERROR: /private/var/tmp/*/738fc54fee5051b993b283099c23f8de/external/maven/BUILD:9056:11: Desugaring external/maven/v1/https/repo1.maven.org/maven2/com/google/auto/auto-common/0.10/auto-common-0.10.jar for Android failed: (Exit 1): desugar_java8 failed: error executing command 
  (cd /private/var/tmp/*/738fc54fee5051b993b283099c23f8de/execroot/doc_android_client && \
  exec env - \
    PATH=/Users/*/Library/Caches/bazelisk/downloads/bazelbuild/bazel-5.1.1-darwin-x86_64/bin:/Users/*/.bytebm/bin:/Users/*/.rvm/gems/ruby-2.5.0/bin:/Users/*/.rvm/gems/ruby-2.5.0@global/bin:/Users/*/.rvm/rubies/ruby-2.5.0/bin:/Users/*/.nvm/versions/node/v12.21.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/puppetlabs/bin:/Library/Apple/usr/bin:/Users/*/.rvm/bin:/Users/*/library/android/sdk/tools/bin:/Users/*/library/android/sdk/platform-tools:/Users/*/Library/Android/sdk/tools:/Users/*/Tools/gradle-profiler/bin:/Users/*/bin:/Users/*/Tools:/Users/*/as.sh:/Users/*/.rvm/bin \
  bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/bazel_tools/tools/android/desugar_java8 @bazel-out/android-armeabi-v7a-fastbuild/bin/external/maven/_dx/com_google_auto_auto_common/auto-common-0.10.jar_desugared.jar-0.params)
# Configuration: 3d1e1e8c918685c3805362c4c2aea87c66c0efef8a46a537f832c4b02b91eb91
# Execution platform: @local_config_platform//:host
java.lang.IllegalStateException: Couldn't desugar invokedynamic for com/google/auto/common/GeneratedAnnotationSpecs.apply using java/lang/invoke/LambdaMetafactory.metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; (6) with arguments [(Ljava/lang/Object;)Ljava/lang/Object;, com/squareup/javapoet/AnnotationSpec$Builder.build()Lcom/squareup/javapoet/AnnotationSpec; (5), (Lcom/squareup/javapoet/AnnotationSpec$Builder;)Lcom/squareup/javapoet/AnnotationSpec;]
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:474)
	at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn(MethodVisitor.java:461)
	at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn(MethodVisitor.java:461)
	at com.google.devtools.build.android.desugar.strconcat.IndyStringConcatDesugaring$IndifiedStringConcatInvocationConverter.visitInvokeDynamicInsn(IndyStringConcatDesugaring.java:141)
	at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn(MethodVisitor.java:461)
	at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2444)
	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1487)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:717)
	at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:542)
	at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:319)
	at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:239)
	at com.google.devtools.build.android.desugar.Desugar.processRequest(Desugar.java:1012)
	at com.google.devtools.build.android.desugar.Desugar.runPersistentWorker(Desugar.java:972)
	at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:950)
Caused by: java.lang.ClassNotFoundException: Class com.squareup.javapoet.AnnotationSpec$Builder not found
	at com.google.devtools.build.android.desugar.io.HeaderClassLoader.findClass(HeaderClassLoader.java:53)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at com.google.devtools.build.android.desugar.LambdaDesugaring.loadFromInternal(LambdaDesugaring.java:337)
	at com.google.devtools.build.android.desugar.LambdaDesugaring.access$500(LambdaDesugaring.java:56)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.toMethodHandle(LambdaDesugaring.java:655)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.toJvmMetatype(LambdaDesugaring.java:644)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:408)
	... 13 more
Target //assemble/doc-sdk-demo:doc-sdk-demo failed to build

I think desugar should only process runtime dependencies. Is anything wrong with my grazel configuration?

grazel {
    android {
        ndkEnable = false
    }
    rules {
        bazelCommon {
            gitRepository {
                commit = "3568b6190f4f805d2c18af243e79b506dd99bfce"
                remote = "https://github.com/grab/grab-bazel-common.git"
            }
        }
        mavenInstall {
            httpArchiveRepository {
                sha256 = "f36441aa876c4f6427bfb2d1f2d723b48e9d930b62662bf723ddfb8fc80f0140"
                stripPrefix = "rules_jvm_external-4.1"
                url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.1.zip"
            }
            resolveTimeout = 5400
            artifactPinning {
                enabled.set(true)
            }
            versionConflictPolicy = "pinned"
        }
        kotlin {
            gitRepository {
                commit = "eae21653baad4b403fee9e8a706c9d4fbd0c27c6"
                remote = "https://github.com/bazelbuild/rules_kotlin.git"
            }
            compiler {
                version = "1.4.20"
                sha = "46720991a716e90bfc0cf3f2c81b2bd735c14f4ea6a5064c488e04fd76e6b6c7"
            }
            kotlinC {
                useIr = false
            }
            toolchain {
                enabled = true
                apiVersion = "1.4"
                reportUnusedDeps = "off"
                strictKotlinDeps = "off"
                abiJars = true
                multiplexWorkers = true
                languageVersion = "1.4"
                jvmTarget = "1.8"
            }
        }
    }
}

Look forward to your kind reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant