Open RedChops opened 4 years ago
Trying to figure out the last working version of Guava:
CREATEMULTIDEXMAINDEXCLASSLIST : error : Can't read [C:\Users\danor\source\repos\ContractPlanner\ContractPlanner\ContractPlanner.Android\obj\Debug\100\lp\73\jl\__reference__guava.jar(;;;;;;!META-INF/MANIFEST.MF)] (invalid entry size (expected 67324752 but got 2367 bytes))
Actually, I came up with an extremely minimal reproduction, basically just added the Firebase nugets to the bare Xamarin.Android template. Test308.zip The app wont load beyond GetInstance(app) so I'm not sure how much of the play services json or signing keys are needed, but PM me if you need the test ones I used.
Hm so it looks like with this commit: https://github.com/xamarin/XamarinComponents/commit/14a3ada30e508c0340e5c2144ceb91336481eac8, the Guava nuget package moved to the build target/transitive system. Nice for smaller dll's, but that jar never seems to end up anywhere outside of the package. I tried compiling it both with the target set to ReferenceJar (what it's currently set to) and EmbeddedReferenceJar, both to no effect.
I pulled the Guava jar down from Maven, removed the ListenableFuture class just as the build.cake suggests https://github.com/xamarin/XamarinComponents/blob/master/Android/Guava/build.cake#L77, and added it to my test project as an AndroidJavaLibrary. This allows me to remove the hard Guava dependency and have my app work, but it's definitely not ideal. I tried setting the build target of the nuget package to AndroidJavaLibrary, but that didn't have an effect either. referenceguava.zip
It looks as though the breaking change was made here: https://github.com/xamarin/XamarinComponents/commit/14a3ada30e508c0340e5c2144ceb91336481eac8#diff-de6c324ea8efa9973accbabba02f3f09L64. I don't really know anything about this build target system for jar files, but it seems as though it's not playing nicely with Guava, maybe it's due to Guava not actually providing any managed types at all?
@RedChops Try 27.1.0.4 released few hours ago.
We faced the similar issues with AndroidX updates (and GPS-FB with AndroidX dependencies). Now it is EmbeddedReferenceJar
.
And there is also 28.2.0.0 I bound in parallel with 27.1.0.4
And please share feedback here. Thanks for the info. I'll take a look.
@moljac I've added 27.1.0.4 as a hard dependency, removed the jar, and hey, it works! Fantastic!
Thanks a ton. I'll let you close this, since it looks like the config.json is still pulling .0.3 as a dep
@RedChops
I'm glad it worked. Thanks for your analysis.
I'll let it open for few days. I want to publish AndroidX updates (and some older packages), before I prepare GPS-FB.
Actually shoot, I was wrong. I thought that I had set the build options to none, but I guess that didn't stick. When I finally went to go clean out my project and rebuild, I found that the error unfortunately still persists.
Without that guava.jar file in the project and marked as AndroidJavaLibrary, the project wont run. I tried both 27.1.0.4 and 28.2.0
Not sure what happened with above. I cleared my nuget cache and it seems to work. Sorry about the confusion!
@RedChops Hi, can you explain how you were able to resolve this issue.. All the trouble seemed to have started in my recent package update and for some reason reverting the changes seems not to be effective..
@ifecdr I wish I could tell you more. I had to clear all NuGet caches, and I removed my obj and bin folders, and both 27.1.0.4 and 28.2.0 started building for me. I think you may also need Xamarin.Build.Download >0.8.0, but I've been building packages from this repo by hand for a while now so I don't know if that would be the case with the released versions.
You also have to make sure that you are in no way using R8, neither by specifying it explicitly, or by having it run implicitly by using D8 and having 'EnableMultiDex' enabled (this is a very dumb change, don't know why that became the default). If R8 runs, the build will almost certainly fail in some way or another. I intend on filing a bug about this once the AndroidX versions are published.
Xamarin.Android Version (eg: 6.0):
Xamarin.Android 10.1.3.7
Operating System & Version (eg: Mac OSX 10.11):
Windows 10, Mac Catalina
Google Play Services Version (eg: 8.4.0):
Build from master_based_androidx branch, re-pulled around an hour ago
Describe your Issue:
Guava libraries seem to be getting stripped out during dex compilation and only the 'dx' compiler gets close to working. With the latest Firestore library and Guava 27.1.0.3, the app will crash on runtime with the stack trace below.
If I create a hard dependency on Guava 27.1.0, my app will run perfectly fine.
Changing the dex compiler to 'd8' seems to strip everything out of the Guava package, so pretty unusable there.
Adding or removing
<uses-library android:name="org.apache.http.legacy" android:required="false" />
from AndroidManifest.xml doesn't make any difference on either version of Guava.N.B: I've bumped the Firestore library version to the latest from Google, as seen in the stack trace, but the error still happens on the version from the branch with a clean pull, no difference. On Guava 27.1.0, both versions work fine.
Steps to Reproduce (with link to sample solution if possible):
Given that Firebase Firestore needs to be authenticated, I'm not sure how I could make a reproduction. If needed I can make something most likely. The basic steps would be:
Include any relevant Exception Stack traces, build logs, adb logs: