Any (new/demo) project Deployment keeps failing! Visual Studio 2017

Hi all,

I'm trying to get VS with Xamarin working but I just can't get it working.

The problem:
If I try to build and deploy any Android project (HelloWorld, blank app etc.), it always fails deploying. I have tried different Android devices but also emulators. I have reinstalled VS, checked en reinstalled JDK, SDK, NDK, ran it as an administrator but it just keeps failing to deploy. This is my output:

1>------ Build started: Project: HelloWorld, Configuration: Debug Any CPU ------
1> HelloWorld -> D:\Downloads\HelloWorld\bin\Debug\HelloWorld.dll
2>Starting deploy Samsung SM-G935F ...
2>Deploying Samsung SM-G935F ...
2>Build started.
2>Project "HelloWorld.csproj" (Install target(s)):
2>D:\VisualStudio2017\MSBuild\15.07\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0
2>iels\AppData\Local\Temp\MonoAndroid,Version=v7.0.AssemblyAttributes.cs" obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
2>HelloWorld -> D:\Downloads\HelloWorld\bin\Debug\HelloWorld.dll
2>C:\Program Files\Java\jdk1.8.0_161\bin\keytool.exe -list -alias androiddebugkey -storepass android -keypass android -keystore "C:\Users
2>iels\AppData\Local\Xamarin\Mono for Android\debug.keystore"
2>C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\zipalign.exe 4 "D:\Downloads\HelloWorld\obj\Debug\android\bin\com.xamarin.helloworld.apk" "bin\Debug\com.xamarin.helloworld-Signed.apk"
2>C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\apksigner.BAT sign --ks "C:\Users
2>iels\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 4 --max-sdk-version 27 bin\Debug\com.xamarin.helloworld-Signed.apk
2>"apksigner.BAT" exited with code 1.
2>Done building project "HelloWorld.csproj" -- FAILED.
2>Build FAILED.
2>Deploy failed on Samsung SM-G935F
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

I don't know what else I could do, so I could really use some help.. Does anyone have some other ideas on what might cause the problem and what might work?

Thanks!

Posts

  • SimonWainwrightSimonWainwright GBMember ✭✭

    Same issue here after upgrading to Visual Studio 15.6.0/15.6.1

    Did you make any progress?

  • MarcoRossi.1122MarcoRossi.1122 USMember ✭✭
    edited March 2018

    +1 Does anybody have a workaround?

    UPDATING: I Enabled ProGuard In Android Options and its deploying right now!!!

  • I have the same problem. Please a solution

  • SimonWainwrightSimonWainwright GBMember ✭✭

    I've tried enabling ProGuard and still have the same issue.

    I can still Archive the solution and sign it with my keystore without any problems, it is only deploying to a device in Debug or Release that is a problem

  • Problem Caused by Incorrect JDK version. I have already installed JDK 8 32 bit.
    every thing is working fine. But after installing JDK 9 64 bit same error displayed.
    After uninstalling Newly install Java error Disappeared Automatically.

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai
  • SimonWainwrightSimonWainwright GBMember ✭✭

    Downgraded my VS2017 to 15.5.7 and my app is debugging again

  • GSalunkheGSalunkhe INMember ✭✭

    Hi

    After updating Xamarin to following version

    I am not able to create .APK. Nothing happens when clicked on "Distribute" button. Previously it used to open Dialog box asking for Signing Key and Path to create apk file.

    Any pointers will be great help

    Thanks
    gsalunkhe

  • GSalunkheGSalunkhe INMember ✭✭

    @GSalunkhe said:
    Hi

    After updating Xamarin to following version

    I am not able to create .APK. Nothing happens when clicked on "Distribute" button. Previously it used to open Dialog box asking for Signing Key and Path to create apk file.

    Any pointers will be great help

    Thanks
    gsalunkhe

    I am using Visual Studio 2015 Community Edition.

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    Nothing happens when clicked on "Distribute" button
    I am using Visual Studio 2015 Community Edition.

    That's a separate issue that is specific to Visual Studio 2015. I would recommend to vote on and follow https://github.com/xamarin/xamarin-android/issues/1372 for updates and fix notifications. That GitHub issue also includes information about how to get the previous version in case you'd like to temporarily switch back.

  • NielsdvNielsdv Member

    After removing SDK and uninstalling JDK 9 (although 9 was not selected in VS), it worked again. Thanks!

  • GSalunkheGSalunkhe INMember ✭✭

    @BrendanZagaeski said:

    Nothing happens when clicked on "Distribute" button
    I am using Visual Studio 2015 Community Edition.

    That's a separate issue that is specific to Visual Studio 2015. I would recommend to vote on and follow https://github.com/xamarin/xamarin-android/issues/1372 for updates and fix notifications. That GitHub issue also includes information about how to get the previous version in case you'd like to temporarily switch back.

    @BrendanZagaeski : Thanks for the input.

  • john82john82 ITMember ✭✭✭
    edited March 2018

    I'm having the same issue. No JDK 9 installed or JRE9 either.

    Using JDK 8 162 gives me this error

    2>C:\Program Files (x86)\Android\android-sdk\build-tools\27.0.3\apksigner.BAT sign --ks "C:\Users\Francesco\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 15 --max-sdk-version 27  bin\Debug\com.admaiorastudio.VeryCustomUI-Signed.apk 
    2>"apksigner.BAT" exited with code 1.
    2>Done building project "VeryCustomUI.Android.csproj" -- FAILED.
    2>Build FAILED.
    

    Using JDK 8 131 gives me this error

    1>Unexpected install output: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1664132260.tmp/base.apk: Attempt to get length of null array]
    1>
    1>   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A_work\61\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 337
    1>   at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass94_0.<InstallPackage>b__0(Task`1 t) in E:\A_work\61\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 746
    1>   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
    1>   at System.Threading.Tasks.Task.Execute()
    1>Done building project "VeryCustomUI.Android.csproj".
    1>Build succeeded.
    1>Unexpected install output: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1664132260.tmp/base.apk: Attempt to get length of null array]
    1>
    1>   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A_work\61\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 337
    1>   at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass94_0.<InstallPackage>b__0(Task`1 t) in E:\A_work\61\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 746
    1>   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
    1>   at System.Threading.Tasks.Task.Execute()
    1>
    
  • TaraTara Member

    While I didn't have JDK 9, I did have an older version of JRE 8 for both 32 and 64 bit, in addition to 662. After I removed those old versions, and rebooted, problem solved!

  • john82john82 ITMember ✭✭✭

    Finally I've made it works again. I've unistalled all old versions of JDK 8 (prior to 162)

  • GSalunkheGSalunkhe INMember ✭✭

    @BrendanZagaeski said:

    Nothing happens when clicked on "Distribute" button
    I am using Visual Studio 2015 Community Edition.

    That's a separate issue that is specific to Visual Studio 2015. I would recommend to vote on and follow https://github.com/xamarin/xamarin-android/issues/1372 for updates and fix notifications. That GitHub issue also includes information about how to get the previous version in case you'd like to temporarily switch back.

    @BrendanZagaeski : Thanks for the input.

  • ChristopherJacksonChristopherJackson INUniversity

    Thanks everyone.

    I logged in to say that uninstalling my old JDK versions resolved this issue for me also.

  • Same here, downgrade to JDK 8 u 162 and remove other versions fixed the problem (VS 15.6.4)

  • HymanZHANHymanZHAN Member

    Removed JDK9 and Java9 and problem solved.

  • SanderKSanderK USMember ✭✭
    edited March 2018

    After updating to Visual Studio 15.6.4 i had the same problem and solved it by installing Android SDK Build Tool 27.0.3, JDK 8u162 and made sure Visual Studio is targeting that version (in Visual Studio > Tools > Options > Xamarin > Java Development Kit Location). If you change the JDK Location, you will need to restart Visual Studio to apply these changes.

  • bipbipRichiebipbipRichie Member ✭✭

    Hi everyone, I'm facing the same issue. But I'm geting "apksigner.BAT" exited with code 2." I followed all the previous solutions, uninstalled JRE and JDK older versions updated my Build Tool to the latest and I'm going crazy. Any other suggestions?

  • KrisPetkovKrisPetkov BGMember ✭✭

    I managed to fix this problem only with JDK update to 8u162 (Visual Studio 15.6.4) and setting the new version of the JDK in Visual Studio > Tools > Options > Xamarin > Java Development Kit Location

  • LarsNymandLarsNymand DKMember ✭✭

    Also just faced this issue.. removed all installed JDKs -> installed 8u162 and it worked. (using visual studio 15.6.6)

Sign In or Register to comment.