Switching From VS Mac To VS Windows got “java.exe”

2020-02-02 03:56发布

问题:

Hello Guys

I got an issue when switching my Xamarin.Forms project from VSMac to VsWindows! "java.exe" exited with code 2 when deploying.

I already try:

  • delete bin/ obj/ folders
  • remove all packages and re-add them
  • MultiDex
  • Verify the path (removing special char "!@#$%ˆ&*(-_" etc..)

If you got an idea, tell me ;)

Regards,

回答1:

If G Clovs solution doesn't work, then:

  1. make sure the netstandard on your mac is exactly the same on your Windows pc.
  2. Make sure you have the same Android SDK downloaded on your Windows - through Tools Menu > SDK manager.
  3. If you are using stable channel for vs for mac updates, then make sure you are not suing the preview of budget packages on your Windows.
  4. Apply the same logic in 3 for preview channel.

To avoid all these issues:

  1. Simply go to vs for mac 2019, change to stable build and update the vs for mac to latest.
  2. Update all android SDK and build tools to say v28
  3. Update all nugget packages for the two projects and build successfully.
  4. Go to vs 2019 and update vs to latest.
  5. Repeat step 2 for vs.
  6. Deselect preview in nugget package manager, and update nugget packages in the two projects.
  7. Build successful.


回答2:

Try the below steps, it was working for me.

  1. Open Visual Studio in Windows
  2. Open your Solution
  3. Find for "Resource.designer.cs" file in Android Project and delete it
  4. Remove obj and debug folders form PCL and Android project
  5. Clean and Rebuild

Happy Coding :)

Kishore Kumar



回答3:

With turning third page of google, I didn't find any answer.
But I found the answer by my own.

The issue was comming from the Android.csproj and the Keystore Path.

It was set to my Mac Path even if I had already changed it on

VSWindows AndroidProject => Properties => Signin

So I removed this lines on Android.csproj (edited with third text editor):

<AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>YourMacPath/Alias.keystore</AndroidSigningKeyStore>
<AndroidSigningStorePass>Password</AndroidSigningStorePass>
<AndroidSigningKeyAlias>Alias</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>AliasPassword</AndroidSigningKeyPass>

On debug & release Part.

Then you can edit them on VS Windows.

Hope I helped someone. See ya