#android #xamarin #xamarin.forms #deployment
#Android #xamarin #xamarin.forms #развертывание
Вопрос:
Используя последнюю версию VS2019, Windows10 Home. Просто ничего не сделал, но создал пустой Xamarin.Приложение Forms. Сборка выполнена успешно, развертывание завершается ошибкой. Пробовал использовать разные эмуляторы Android Oreo8.1 и Pie 9.0. Ничего не получалось. Получение той же ошибки Подробный вывод ниже:
Waiting for runtime checks to complete
Detecting installed packages...
Detecting installed packages...
Creating C:UsersonlymAppDataLocalXamarin.AndroidCacheMono.Android.Platform.ApiLevel_28.apk
Creating C:UsersonlymAppDataLocalXamarin.AndroidCacheMono.Android.Platform.ApiLevel_28.apk
Copying platform assemblies...
Copying platform assemblies...
Copying file: C:Program Files (x86)Microsoft Visual
Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv4.4Mono.Android.Export.dll
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv4.4OpenTK-1.0.dll
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv4.4Mono.Android.Export.pdb
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv4.4OpenTK-1.0.pdb
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv9.0mono.android.dex
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv9.0Mono.Android.dll
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv9.0mono.android.jar
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv9.0Mono.Android.pdb
Copying platform assemblies...
Creating: C:UsersonlymAppDataLocalTempvt2chgrb.04sAndroidManifest.xml
Creating: C:UsersonlymAppDataLocalTempvt2chgrb.04sunaligned.apk
Executing: C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2aapt.exe package -f -0 .dll -0 .mdb -M "C:UsersonlymAppDataLocalTempvt2chgrb.04sAndroidManifest.xml" -I "C:Program Files (x86)Androidandroid-sdkplatformsandroid-29android.jar" -F "C:UsersonlymAppDataLocalTempvt2chgrb.04sunaligned.apk" -k "C:UsersonlymAppDataLocalTempvt2chgrb.04sr"
Aapt
C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2aapt.exe exited with value: 0
Aapt
Creating: C:UsersonlymAppDataLocalTempvt2chgrb.04sunsigned.apk
Executing: C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2zipalign.exe 4 "C:UsersonlymAppDataLocalTempvt2chgrb.04sunaligned.apk" "C:UsersonlymAppDataLocalTempvt2chgrb.04sunsigned.apk"
zipalign
C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2zipalign.exe exited with value: 0
zipalign
Creating: C:UsersonlymAppDataLocalTempvt2chgrb.04sMono.Android.Platform.ApiLevel_28.apk
Executing: C:Program FilesAndroidJdkmicrosoft_dist_openjdk_1.8.0.25binjava.EXE -jar "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\apksigner.jar" sign --ks "C:\Users\onlym\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-key-alias "androiddebugkey" --out "C:\Users\onlym\AppData\Local\Temp\vt2chgrb.04s\Mono.Android.Platform.ApiLevel_28.apk" --ks-pass "pass:android" --key-pass "pass:android" "C:\Users\onlym\AppData\Local\Temp\vt2chgrb.04s\unsigned.apk"
Removing temporary directory: C:UsersonlymAppDataLocalTempvt2chgrb.04s
Creating C:UsersonlymAppDataLocalXamarin.AndroidCacheMono.Android.Platform.ApiLevel_28.apk
1>Starting deployment to pixel_2_oreo_8_1_-_api_27 ...
1>Deploying to pixel_2_oreo_8_1_-_api_27 ...
Build started.
Project "AwApp.Android.csproj" (Install target(s)):
Found Java SDK version 1.8.0.
Found Java SDK version 1.8.0.
PackageName: com.companyname.awapp
Dex Fast Deployment Enabled: False
MonoAndroid Tools: C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildXamarinAndroid
Android Platform API level: 28
TargetFrameworkVersion: v9.0
Android NDK:
Android SDK: C:Program Files (x86)Androidandroid-sdk
Android SDK Build Tools: C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2
Java SDK: C:Program FilesAndroidJdkmicrosoft_dist_openjdk_1.8.0.25
Application Java class: android.app.Application
Project "AwApp.csproj" (GetTargetFrameworks target(s)):
Done building project "AwApp.csproj".
Project "AwApp.csproj" (GetTargetPath target(s)):
Done building project "AwApp.csproj".
Project "AwApp.csproj" (GetNativeManifest target(s)):
Done building project "AwApp.csproj".
Skipping target "_VerifyXamarinAndroidSupportVersions" because all output files are up-to-date with respect to the input files.
Skipping target "_ResolveLibraryProjectImports" because all output files are up-to-date with respect to the input files.
Skipping target "_BuildLibraryImportsCache" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateAndroidResourceDir" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateLayoutBindings" because it has no outputs.
Skipping target "_ConvertResourcesCases" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileResources" because all output files are up-to-date with respect to the input files.
Skipping target "_PrepareUpdateAndroidResgen" because all output files are up-to-date with respect to the input files.
Checking Android SDK Build-tools version...
Selected Android SDK Build Tools Path: C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2
Selected Android SDK Build Tools Version: 29.0.2
Android SDK Build Tools Version: 29.0.2 meets minimum requirements for Vector Drawables. OK.
Finished Checking Android SDK Build-tools version.
Skipping target "_UpdateAndroidResgen" because all output files are up-to-date with respect to the input files.
Adding assembly reference for AwApp.Android, recursively...
Adding assembly reference for System.Net.Http, recursively...
Adding assembly reference for System.Runtime.Serialization, recursively...
Adding assembly reference for System.ServiceModel.Internals, recursively...
Adding assembly reference for AwApp, recursively...
Adding assembly reference for netstandard, recursively...
Adding assembly reference for System.Data, recursively...
Adding assembly reference for System.Transactions, recursively...
Adding assembly reference for System.Data.DataSetExtensions, recursively...
Adding assembly reference for System.Drawing.Common, recursively...
Adding assembly reference for System.IO.Compression, recursively...
Adding assembly reference for System.IO.Compression.FileSystem, recursively...
Adding assembly reference for System.ComponentModel.Composition, recursively...
Adding assembly reference for System.Web.Services, recursively...
Adding assembly reference for FormsViewGroup, recursively...
Adding assembly reference for Java.Interop, recursively...
Adding assembly reference for Mono.Android, recursively...
Adding assembly reference for mscorlib, recursively...
Adding assembly reference for System.Core, recursively...
Adding assembly reference for System, recursively...
Adding assembly reference for Mono.Security, recursively...
Adding assembly reference for System.Numerics, recursively...
Adding assembly reference for System.Numerics.Vectors, recursively...
Adding assembly reference for System.Runtime, recursively...
Adding assembly reference for System.Xml, recursively...
Adding assembly reference for System.Xml.Linq, recursively...
Adding assembly reference for Xamarin.Android.Arch.Core.Common, recursively...
Adding assembly reference for Xamarin.Android.Arch.Core.Runtime, recursively...
Adding assembly reference for Xamarin.Android.Arch.Lifecycle.Common, recursively...
Adding assembly reference for Xamarin.Android.Arch.Lifecycle.LiveData.Core, recursively...
Adding assembly reference for Xamarin.Android.Arch.Lifecycle.LiveData, recursively...
Adding assembly reference for Xamarin.Android.Arch.Lifecycle.Runtime, recursively...
Adding assembly reference for Xamarin.Android.Arch.Lifecycle.ViewModel, recursively...
Adding assembly reference for Xamarin.Android.Support.Animated.Vector.Drawable, recursively...
Adding assembly reference for Xamarin.Android.Support.Annotations, recursively...
Adding assembly reference for Xamarin.Android.Support.AsyncLayoutInflater, recursively...
Adding assembly reference for Xamarin.Android.Support.Collections, recursively...
Adding assembly reference for Xamarin.Android.Support.Compat, recursively...
Adding assembly reference for Xamarin.Android.Support.CoordinaterLayout, recursively...
Adding assembly reference for Xamarin.Android.Support.Core.UI, recursively...
Adding assembly reference for Xamarin.Android.Support.Core.Utils, recursively...
Adding assembly reference for Xamarin.Android.Support.CursorAdapter, recursively...
Adding assembly reference for Xamarin.Android.Support.CustomTabs, recursively...
Adding assembly reference for Xamarin.Android.Support.CustomView, recursively...
Adding assembly reference for Xamarin.Android.Support.Design, recursively...
Adding assembly reference for Xamarin.Android.Support.DocumentFile, recursively...
Adding assembly reference for Xamarin.Android.Support.DrawerLayout, recursively...
Adding assembly reference for Xamarin.Android.Support.Fragment, recursively...
Adding assembly reference for Xamarin.Android.Support.Interpolator, recursively...
Adding assembly reference for Xamarin.Android.Support.Loader, recursively...
Adding assembly reference for Xamarin.Android.Support.LocalBroadcastManager, recursively...
Adding assembly reference for Xamarin.Android.Support.Media.Compat, recursively...
Adding assembly reference for Xamarin.Android.Support.Print, recursively...
Adding assembly reference for Xamarin.Android.Support.SlidingPaneLayout, recursively...
Adding assembly reference for Xamarin.Android.Support.SwipeRefreshLayout, recursively...
Adding assembly reference for Xamarin.Android.Support.Transition, recursively...
Adding assembly reference for Xamarin.Android.Support.v4, recursively...
Adding assembly reference for Xamarin.Android.Support.v7.AppCompat, recursively...
Adding assembly reference for Xamarin.Android.Support.v7.CardView, recursively...
Adding assembly reference for Xamarin.Android.Support.v7.RecyclerView, recursively...
Adding assembly reference for Xamarin.Android.Support.Vector.Drawable, recursively...
Adding assembly reference for Xamarin.Android.Support.VersionedParcelable, recursively...
Adding assembly reference for Xamarin.Android.Support.ViewPager, recursively...
Adding assembly reference for Xamarin.Essentials, recursively...
Adding assembly reference for Xamarin.Forms.Core, recursively...
Adding assembly reference for Xamarin.Forms.Platform.Android, recursively...
Adding assembly reference for Xamarin.Forms.Platform, recursively...
Adding assembly reference for Xamarin.Forms.Xaml, recursively...
Skipping target "_CopyConfigFiles" because it has no inputs.
Skipping target "_ConvertPdbFiles" because it has no outputs.
Skipping target "_LinkAssembliesNoShrink" because all output files are up-to-date with respect to the input files.
Skipping target "_CopyConfigFiles" because it has no inputs.
Skipping target "_ConvertPdbFiles" because it has no outputs.
Skipping target "_GenerateJavaStubs" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertCustomView" because all output files are up-to-date with respect to the input files.
Skipping target "_AddStaticResources" because all output files are up-to-date with respect to the input files.
Skipping target "_GeneratePackageManagerJava" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateAndroidAssetsDir" because it has no outputs.
Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileNativeAssemblySources" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateApplicationSharedLibraries" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileToDalvik" because all output files are up-to-date with respect to the input files.
Copying file from "C:PersonalProjectsAwAppAwApp.AndroidobjDebug90androidbincom.companyname.awapp.apk" to "C:PersonalProjectsAwAppAwApp.AndroidbinDebugcom.companyname.awapp.apk".
C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2zipalign.exe -p 4 "C:PersonalProjectsAwAppAwApp.AndroidobjDebug90androidbincom.companyname.awapp.apk" "binDebug\com.companyname.awapp-Signed.apk"
C:Program FilesAndroidJdkmicrosoft_dist_openjdk_1.8.0.25binjava.exe -jar "C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildXamarinAndroidapksigner.jar" sign --ks "C:UsersonlymAppDataLocalXamarinMono for Androidxample2048DSA.keystore" --ks-pass pass:keypass --ks-key-alias publishingdoc --key-pass pass:keypass --min-sdk-version 26 --max-sdk-version 28 C:PersonalProjectsAwAppAwApp.AndroidbinDebugcom.companyname.awapp-Signed.apk
Signed android package 'binDebugcom.companyname.awapp-Signed.apk'
Detecting installed packages...
Creating C:UsersonlymAppDataLocalXamarin.AndroidCacheMono.Android.Platform.ApiLevel_28.apk
Copying platform assemblies...
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv4.4Mono.Android.Export.dll
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv4.4OpenTK-1.0.dll
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv4.4Mono.Android.Export.pdb
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv4.4OpenTK-1.0.pdb
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv9.0mono.android.dex
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv9.0Mono.Android.dll
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv9.0mono.android.jar
Copying file: C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7IDEReferenceAssembliesMicrosoftFrameworkMonoAndroidv9.0Mono.Android.pdb
Creating: C:UsersonlymAppDataLocalTempw2wxsblr.h5kAndroidManifest.xml
Creating: C:UsersonlymAppDataLocalTempw2wxsblr.h5kunaligned.apk
Executing: C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2aapt.exe package -f -0 .dll -0 .mdb -M "C:UsersonlymAppDataLocalTempw2wxsblr.h5kAndroidManifest.xml" -I "C:Program Files (x86)Androidandroid-sdkplatformsandroid-29android.jar" -F "C:UsersonlymAppDataLocalTempw2wxsblr.h5kunaligned.apk" -k "C:UsersonlymAppDataLocalTempw2wxsblr.h5kr"
C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2aapt.exe exited with value: 0
Creating: C:UsersonlymAppDataLocalTempw2wxsblr.h5kunsigned.apk
Executing: C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2zipalign.exe 4 "C:UsersonlymAppDataLocalTempw2wxsblr.h5kunaligned.apk" "C:UsersonlymAppDataLocalTempw2wxsblr.h5kunsigned.apk"
C:Program Files (x86)Androidandroid-sdkbuild-tools29.0.2zipalign.exe exited with value: 0
Creating: C:UsersonlymAppDataLocalTempw2wxsblr.h5kMono.Android.Platform.ApiLevel_28.apk
Executing: C:Program FilesAndroidJdkmicrosoft_dist_openjdk_1.8.0.25binjava.EXE -jar "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\apksigner.jar" sign --ks "C:\Users\onlym\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-key-alias "androiddebugkey" --out "C:\Users\onlym\AppData\Local\Temp\w2wxsblr.h5k\Mono.Android.Platform.ApiLevel_28.apk" --ks-pass "pass:android" --key-pass "pass:android" "C:\Users\onlym\AppData\Local\Temp\w2wxsblr.h5k\unsigned.apk"
Removing temporary directory: C:UsersonlymAppDataLocalTempw2wxsblr.h5k
ADB1000: Deployment failed
Xamarin.AndroidTools.AndroidSdkToolException: Exception in thread "main" java.security.InvalidKeyException: Failed to sign using signer "ANDROIDD"
at com.android.apksig.internal.apk.v1.V1SchemeSigner.signManifest(V1SchemeSigner.java:295)
at com.android.apksig.internal.apk.v1.V1SchemeSigner.sign(V1SchemeSigner.java:256)
at com.android.apksig.DefaultApkSignerEngine.outputJarEntries(DefaultApkSignerEngine.java:657)
at com.android.apksig.ApkSigner.sign(ApkSigner.java:442)
at com.android.apksig.ApkSigner.sign(ApkSigner.java:193)
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:340)
at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:83)
Caused by: java.security.InvalidKeyException: Failed to sign using SHA1withDSA
at com.android.apksig.internal.apk.v1.V1SchemeSigner.generateSignatureBlock(V1SchemeSigner.java:519)
at com.android.apksig.internal.apk.v1.V1SchemeSigner.signManifest(V1SchemeSigner.java:293)
... 6 more
Caused by: java.security.InvalidKeyException: The security strength of SHA-1 digest algorithm is not sufficient for this key size
at sun.security.provider.DSA.checkKey(DSA.java:111)
at sun.security.provider.DSA.engineInitSign(DSA.java:143)
at java.security.Signature$Delegate.init(Signature.java:1155)
at java.security.Signature$Delegate.chooseProvider(Signature.java:1115)
at java.security.Signature$Delegate.engineInitSign(Signature.java:1179)
at java.security.Signature.initSign(Signature.java:530)
at com.android.apksig.internal.apk.v1.V1SchemeSigner.generateSignatureBlock(V1SchemeSigner.java:515)
... 7 more
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.AndroidTools.PlatformPackage.<GetPlatformPackagePathAsync>d__5.MoveNext() in C:A177sExternalandroidtoolsXamarin.AndroidToolsPlatformPackage.cs:line 139
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.<InstallSharedPlatformAsync>d__114.MoveNext() in C:A177sExternalandroidtoolsXamarin.AndroidToolsSessionsAndroidDeploySession.cs:line 349
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.<EnsureCorrectSharedRuntimes>d__111.MoveNext() in C:A177sExternalandroidtoolsXamarin.AndroidToolsSessionsAndroidDeploySession.cs:line 270
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.<RunAsync>d__110.MoveNext() in C:A177sExternalandroidtoolsXamarin.AndroidToolsSessionsAndroidDeploySession.cs:line 198
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.<RunLoggedAsync>d__108.MoveNext() in C:A177sExternalandroidtoolsXamarin.AndroidToolsSessionsAndroidDeploySession.cs:line 123
Done building project "AwApp.Android.csproj" -- FAILED.
Build FAILED.
1> Сбой развертывания в pixel_2_ore_ore_8_1_-_api_27.
========== Развертывание: 0 выполнено успешно, 1 не выполнено, 0 пропущено ==========
Комментарии:
1. Эта ошибка вызвана кодом или нет? Вы можете создать новый проект для проверки. А если код вызывает ошибку? Не могли бы вы предоставить код?
2. @WendyZang-MSFT не написал ни одной строки кода. Просто пустой проект по умолчанию в соответствии с руководством
3. Вы пытались восстановить VS? Это работало раньше?
4. Это никогда не работало. Пробовал много чего. Обновлено VS2019. Попытался создать собственный файл signed.apk, но та же ошибка. Похоже, jdk каким-то образом не настраивается должным образом каждый раз, когда я переустанавливал VS2019 с помощью Mobile Developemt.
5. Работает ли переустановленный vs2019?