google / bundletool

Bundletool is a command-line tool to manipulate Android App Bundles
https://g.co/androidappbundle
Apache License 2.0
3.53k stars 385 forks source link

Issue with Building and using bundletool locally #221

Closed shubham-s closed 3 years ago

shubham-s commented 3 years ago

Describe the bug I have a use case where I am building bundletool locally and using the commands for the bundletool. The code seemed to work fine on my machine till 2 days back when suddenly I have started running into classDefNotFoundErrors.

Bundletool version(s) affected Version: 1.5

Stacktrace 'com.google.protobuf.Descriptors$FileDescriptor com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom(java.lang.String[], com.google.protobuf.Descriptors$FileDescriptor[])' java.lang.NoSuchMethodError: 'com.google.protobuf.Descriptors$FileDescriptor com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom(java.lang.String[], com.google.protobuf.Descriptors$FileDescriptor[])' at com.android.aapt.ConfigurationOuterClass.<clinit>(ConfigurationOuterClass.java:5344) at com.android.aapt.Resources.<clinit>(Resources.java:48760) at com.android.aapt.Resources$ResourceTable.getDescriptor(Resources.java:2802) at com.android.aapt.Resources$ResourceTable.hashCode(Resources.java:3103) at java.base/java.util.Objects.hashCode(Objects.java:116) at java.base/java.util.Optional.hashCode(Optional.java:448) at com.android.tools.build.bundletool.model.$AutoValue_ModuleSplit.hashCode($AutoValue_ModuleSplit.java:215) at com.google.common.collect.ImmutableSet$RegularSetBuilderImpl.add(ImmutableSet.java:786) at com.google.common.collect.ImmutableSet$Builder.add(ImmutableSet.java:512) at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.Collections$2.tryAdvance(Collections.java:4747) at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4755) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at com.android.tools.build.bundletool.shards.Sharder.getMasterSplits(Sharder.java:143) at com.android.tools.build.bundletool.shards.Sharder.groupSplitsToShards(Sharder.java:77) at com.android.tools.build.bundletool.shards.StandaloneApksGenerator.generateStandaloneApks(StandaloneApksGenerator.java:92) at com.android.tools.build.bundletool.shards.ShardedApksFacade.generateSplits(ShardedApksFacade.java:63) at com.android.tools.build.bundletool.commands.BuildApksManager.execute(BuildApksManager.java:155) at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:694)

To Reproduce

  1. Download the bundletool source code from github
  2. Build the source code
  3. Start using it with your application

Expected behavior The above error should not occur.

Known workaround None

Environment: Linux

Additional context Add any other context about the problem here.

shubham-s commented 3 years ago

I am not sure if this is due to the change in the aapt compiler for the aapt2 dependancy added in the build.gradle file - https://mvnrepository.com/artifact/com.android.tools.build/aapt2-proto/4.1.0-alpha01-6193524/usages

ymakhno commented 3 years ago

Can you attach a project to reproduce the issue?