-
Notifications
You must be signed in to change notification settings - Fork 146
MSBuild\Xamarin\Android\Xamarin.Android.D8.targets(79,5): error MSB6006: "java.exe" exited with code 1. #379
Comments
My Analysis of the problems seems to have been wrong at the beginning, the issue seems to have been caused by the Firebase.Firestore Plugin and the 'Plugin.LocalNotifications', removal of any of these two plug-ins the error goes away. |
Can you attach diagnosic logs, please? |
Can I see your project file, please? OR at least ProjectReferences? |
|
I have the same issue, found by installing the same components (Xamarin.Firebase.Firestore and Plugin.LocalNotification). I did some further tests and can conclude that there's some incompatibility between Xamarin.Firebase.Firestore (or a dependency) and Xamarin.AndroidX.Work.Runtime. There seems to be no version combination of the two that works. Is there any new info available about this? EDIT: It is easily reproducible by installing VS Enterprise 2019 16.7.4, creating a new Xamarin.Forms project, installing e.g. Xamarin.Firebase.Firestore 120.2.0 and Xamarin.AndroidX.Work.Runtime 2.3.4.6 into the Android project, and trying to build the project/solution. |
Could you provide binlogs please. Those are smaller and easier to investigate. Thanks |
Sure. Here is a binlog of the sample scenario I described (plus targeted Android to API level 30 and removed iOS project so as not to flood the logs with Mac connection attempts): msbuild.zip |
I get the same error but using different libraries. When I tried upgrading all Firebase libraries i get the issue. When I looked through the msbuild command output I saw this:
Also switching from d8 to dx compiler produces this error after waiting over 30 minutes for the build to complete:
|
@moljac, @jpobst, since I was looking at another conflicting Java type issue today (dotnet/android#5237), I was curious if this was related and took a quick look at this too. This case looks like something a little different. Example error message for reference:
Investigation notes: I noticed that according to https://mvnrepository.com/artifact/com.google.firebase/firebase-firestore/21.4.3, Xamarin.Firebase.Firestore version 121.4.3 might not need the dependency that it currently has on Xamarin.Google.Guava. I can stop the build error with the following steps:
That is, if I intentionally exclude the assets from the Xamarin.Google.Guava package so the __reference__guava.jar isn't extracted or used at all during the build, the build is successful. Admittedly, I haven't tested the behavior of Xamarin.Firebase.Firestore at run time on device with this work around. But if this sounds right, then maybe the Xamarin.Google.Guava dependency can be removed from the latest versions of the Xamarin.Firebase.Firestore NuGet package? |
Hello everyone, I have a similar problem and tried everything. Here's my detailed log:
And here is my PackageReferences:
|
@felipechavez, that looks similar to dotnet/android#5237, but involving a different type, so I suspect it might be caused by a different outdated NuGet package. I tried a quick experiment with copying and pasting the list of An idea for a next step is that you can try the "Manual investigation approach" from dotnet/android#5237 (comment) to identify which two NuGet packages are causing the conflict and see if one looks outdated. If that doesn't reveal a way to solve the problem by updating or removing an old NuGet package, then if you can submit a new issue with all the details you've collected so the team can take a look, that would be perfect. Thanks in advance! |
@brendanzagaeski thanks very much for the answer, i figured it out uninstalling Xamarin.Firebase.Crash v116.2.1 in the android projects (what an irony). Works fine now after cleaning bin/obj and compiling (action that triggered the error before) |
Excellent. Glad you found a solution, and thanks for sharing the information on how you solved it! |
@felipechavez PT-BR |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
OMG! It worked! I followed the steps you told me in the first comment. I added the PackageReference to the .csproj file. Thank you!! |
Perfect. Glad it worked for you too! |
@brendanzagaeski your solutions seem to make this error go away, but eventually, guava introduces this runtime error
do you perhaps know maybe how i can get through this? |
@Mataboge (and @EduardoReisDev and @gioggio79 too, so you can fix the incorrect workarounds for your projects), oh shoot. You're absolutely right. The previous candidate workarounds were both invalid. Luckily, there are a couple different workaround options. Corrected candidate workaround option A
Corrected candidate workaround option BIf the project needs to use a Xamarin.AndroidX.Browser version higher than 1.0.0, this is another option.
Explanation of candidate workaround option AIn Android Studio, the output of the
These same dependencies exist even for the more recent com.google.firebase:firebase-firestore:22.0.0, so the Xamarin project needs to use the assets from the Xamarin.Google.Guava NuGet package, and the original candidate workarounds were invalid. That said, unlike in the Xamarin.Android project, in the Android Studio project, adding com.google.android.gms:play-services-ads:19.1.0 doesn't add a dependency on com.google.guava:listenablefuture. Dependency output for com.google.android.gms:play-services-ads:19.1.0
The difference is that the Xamarin project is using androidx.browser:browser:1.2.0 instead of androidx.browser:browser:1.0.0. androidx.browser:browser:1.2.0 has a dependency on com.google.guava:listenablefuture, while androidx.browser:browser:1.0.0 does not. The new candidate workaround option A forces the androidx.browser:browser version to 1.0.0 to avoid the com.google.guava:listenablefuture dependency. Explanation of candidate workaround option BWhat happens if Android Studio is forced to use the "problematic" newer androidx.browser:browser:1.2.0 instead of androidx.browser:browser:1.0.0? In that case, there is a special dependency that avoids the conflict:
That is, the com.google.guava:guava artifact has a dependency on a special strange artifact version com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava that overrides other versions of com.google.guava:listenablefuture and provides an empty placeholder library that avoids conflicts with the full Guava library. Because there is no corresponding special version "9999.0-empty-to-avoid-conflict-with-guava" of the Xamarin.Google.Guava.ListenableFuture NuGet package, the corrected candidate workaround option B takes a different approach to achieve a similar result. That NuGet package uses |
@brendanzagaeski thank you for your explanations and solutions. Candidate B gave an Error saying Candidate A worked for me. Thank you very much. |
@brendanzagaeski really thanks for your assistance (and sorry for the delay in my response) Candidate A don't work for me (I tried with v. 1.0.0 and 1.0.0.1 required for xamarin 4.8.0.1687) Candidate B works like a charm, now I can build without java exit code 1. I try to retrieve the database fields with
and application crash
below the packages I'm using for Candidate A
|
Just to add that solution B) worked for me. |
I have the same problem after installing the following nuget packages in an Android project: Xamarin.Firebase.Analytics (118.0.0) This is the error I get: Type com.google.android.gms.internal.measurement.zzu is defined multiple times: obj\Debug\100\lp\109\jl\classes.jar:com/google/android/gms/internal/measurement/zzu.class, obj\Debug\100\lp\123\jl\classes.jar:com/google/android/gms/internal/measurement/zzu.class (TaskId:185) Workaround by downgrading to: Xamarin.Firebase.Analytics (71.1630.4) ...and also installing: Xamarin.Android.Support.Core.Utils (28.0.0.3) Don't know if it actually works yet, but I don't get the build error anymore. Repro steps: Make new Xamarin Forms solution with Android project. Add latest versions of the two packages above. Build. |
Thanks a lot @greg84 |
Removing |
Thanks, this was the solution for me! |
the solution from @greg84 worked for me as well. Thanks for posting that, saved me a bunch of wasted time. For what it's worth, I didn't need to install the support libs. My issue was fixed by simply downgrading the following Xamarin.Firebase.Analytics (71.1630.4) |
Thanks! This also worked for me |
@brendanzagaeski solution B its work!! Tnaks |
Tried every single solution... the closest one was to downgrade Analytics to 71.1630.4 but that requires downgrading every firebase dependency in the project which in turn brings a world of new problems. |
@brendanzagaeski Hi Mr.Zagaeski, I have been trying every solution about this topic but I couldnt fix the issue. here is the page When I double clicked:
` Here is my package references which I am using: `
Please help me. |
In my Android project, I am only using Xamarin.Firebase.Auth (120.0.2) and Xamarin.Firebase.Firestore (122.1.0) and get the "java.exe" exited with code 1 error as well. Attached build log set to Diagnostic here. Unlike the solutions mentioned above, I don't have any of the analytics, googleplayservices, nor the guava packages installed. Very minimal package references:
The issues seem to be at the Xamarin.Firebase.Firestore package because if that is removed the build works fine. I have tried downgrading the Firestore package to 71.1705.4 and below and still get the same issue. UPDATE: I added the Xamarin.Google.Guava package and the project does seem to build without the error now. UPDATE 2: With Xamarin.Google.Guava, now I am getting a different error when actually trying to access a Firestore Collection: Failed resolution of: Lcom/google/common/io/BaseEncoding; UPDATE 3: The above helped me to bypass some error messages, but kept propping up new errors. At this point it looks like I'm at a standstill with no resolution. For what it's worth, it looks like the errors are around here, but I am not sure how to interepret the following message: |
For those finding this issue, note that |
"java.exe" exited with code 1 Hi All, I started getting this error after I updated my App for the first time in about 6 months. I find that to solve it I have to reverse my nugets to Xamarin.GooglePlayServices.Measurement,base v 71.1630.4 Then my App builds again, I really dont know for sure which nuget of the above is failing, Cheers Ola |
@OladotunO I have seen this and similar bugs many times and the solution has always been one and so far works. For each package used in the solution I've checked the list of their dependencies (recurrently). If there were any "google" dependency I referenced this "google" package directly (to force latest stable version). When all "google" packages were updated to their lates versions everything works again :) I know it may be problematic if there were some breaking changes in google but it is more common to see problem between google packages it selfs when they are from different versions. |
@brendanzagaeski Thank you! You saved my weekend. |
I got the same problem by all NuGet packages update to latest. Xamarin.GooglePlayServices.Ads 120.0.0 I don't use firebase in the project. |
Unfortunately there's a secondary problem. Some packages also shipped the The one and only reliable workaround in that case is
It removes all instances of the problematic .aar after the packages are resolved. For reference, the packages that hit this problem are:
with |
I
I've tried both workarounds and still end up with this error. |
Hi Most of your problems are because of real-world (complex) samples/apps, mostly due to transitive dependencies and some problems we caused (in the past) and google caused and is still causing. Here Guava is very specific and fun set of libraries. For example new problems (FYI - from my notes): Currently AndroidX (AX) and Google.PlayServices/Firebase/MLKit updates are blocked ... because more and more libraries bring in weird dependencies, like:
2 problems:
google releases more and more packages that depend on previews: |
some Tips and tricks for most of your problems and issues:
this is how I usually solve similar issues in complex projects |
I'm starting to get this error withe the latest preview. There's not much code, just a bunch of packages in each solution. Maybe someone will have better luck than i tracking down the offending package. Also seems to be source generator warnings popping up. |
Note that this is a completely generic error and may or may not be related to other people hitting the same error.
You will need to enable diagnostic logs to see the actual error java is returning. It may be something similar to:
|
error MSB6006: "java.exe" exited with code 1. I took the sample from - https://github.com/Azure-Samples/active-directory-xamarin-native-v2/tree/main/1-Basic More error details with Diagnostic logs. |
Hi, has this issue been fixed yet? |
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.D8.targets(5,5): Error: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj/Debug/lp/312/jl/classes.jar : com/google/android/gms/ads/internal/zzc.class I am facing a similar issue can anyone have an idea how to resolve it? |
I fix this by completly removing the |
Xamarin.Android Version (eg: 6.0):
Android 10
Operating System & Version (eg: Mac OSX 10.11):
Windows 10, visual studio 19 16.7.2
Google Play Services Version
Xamarin.Firebase.Firestore v121.4.3-preview02
also tried (71.1705.4)
Describe your Issue
Immediately after adding this package, I get the build error MSB6006: "java.exe" exited with code 1. Which points to the Xamarin.Android.D8.targets(79,5) file and line 79 is the beginning D8 compiler code.
Edit:
after some investigation, i found that the issue is caused by having these packages at the same time:
<PackageReference Include="Xamarin.GooglePlayServices.Ads"> <Version>119.1.0-preview02</Version> </PackageReference>
and
<PackageReference Include="Xamarin.Firebase.Firestore"> <Version>121.4.3-preview02</Version> </PackageReference>
These two packages seem to be referencing different versions on
Xamarin.GoogleplayServices.Base
and that causes this error. I am forced to use that Xamarin.GooglePlayServices.Ads version because other versions cause this error ( #369 ). Any other version ofXamarin.Firebase.Firestore
isn't working wellRelevant information
Add relevant project settings from
*.csproj
file:Packages used:
Build settings (tools)
Steps to Reproduce (with link to sample solution if possible):
install these two packages in the project then build & deploy.
<PackageReference Include="Xamarin.GooglePlayServices.Ads"> <Version>119.1.0-preview02</Version> </PackageReference>
and
<PackageReference Include="Xamarin.Firebase.Firestore"> <Version>121.4.3-preview02</Version> </PackageReference>
Include any relevant Exception Stack traces, build logs, adb logs:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.D8.targets(79,5): error MSB6006: "java.exe" exited with code 1.
The text was updated successfully, but these errors were encountered: