我创建了一个Xamarin表单应用程序,当它构建在我的计算机上时,它会生成一个AAB。当我启用签名时,Google Play商店就会接受AAB文件,并且可以发布。
当我查看构建日志时,它似乎确实构建了Android应用程序包:
...
##[section]Finishing: Build Xamarin.Android project
##[section]Starting: Sign Android App Bundle
==============================================================================
Task : Android Signing
Description : Sign and align Android APK files
Version : 1.122.0
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613717)
==============================================================================
(node:1767) Warning: Use Cipheriv for counter mode of aes-256-ctr (repeated 11 times)
[command]/usr/bin/jarsigner -keystore /Users/runner/runners/2.170.0/work/1/s/.certs/keystore.jks -storepass *** -keypass *** -verbose -sigalg SHA256withRSA -digestalg SHA-256 -signedjar /Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/bin/Release/com.example.test-Signed.aab /Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/bin/Release/com.example.test-Signed.aab.unsigned ***
adding: META-INF/CPANDROI.SF
adding: META-INF/CPANDROI.RSA
signing: BundleConfig.pb
... (removed a lot of files from the logging)
signing: base/manifest/AndroidManifest.xml
signing: base/native.pb
signing: base/resources.pb
>>> Signer
X.509, CN="REMOVED, O=REMOVED, L=REMOVED, S=REMOVED, C=NL"
[trusted certificate]
jar signed.
Warning:
The signer's certificate is self-signed.
[command]/Users/runner/Library/Android/sdk/build-tools/24.0.0/zipalign -v 4 /Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/bin/Release/com.example.test-Signed.aab.unaligned /Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/bin/Release/com.example.test-Signed.aab
Verifying alignment of /Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/bin/Release/com.example.test-Signed.aab (4)...
50 META-INF/MANIFEST.MF (OK - compressed)
27883 META-INF/CPANDROI.SF (OK - compressed)
56907 META-INF/CPANDROI.RSA (OK - compressed)
... (removed a lot of files from the logging)
13130472 base/manifest/AndroidManifest.xml (OK - compressed)
13132552 base/native.pb (OK - compressed)
13132664 base/resources.pb (OK - compressed)
Verification succesful
##[section]Finishing: Sign Android App Bundle
##[section]Starting: Sign APK
我猜构建和签署都很好,但我猜在复制捆绑文件到登台阶段的过程中出了问题。在此之前,运行“将生成文件复制到分段”阶段,并显示以下输出:
##[section]Starting: Copy build files to staging
==============================================================================
Task : Command Line
Description : Run a command line with arguments
Version : 1.1.3
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
[command]/bin/bash -c /usr/bin/find . -path '*/bin/*' ! -path '*/obj/*' -type f ! -name '*-Signed.apk' ! -name '*-armeabi-v7a.apk' ! -name '*-arm64-v8a.apk' ! -name '*-x86.apk' ! -name '*-x86_64.apk' -name '*.apk' -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -1 | cut -f2- -d" " | xargs -L 1 -I{} cp -R -v {} /Users/runner/runners/2.170.0/work/1/a/build
(node:1777) Warning: Use Cipheriv for counter mode of aes-256-ctr (11 times)
./CrossPoint.Xpact.Android/bin/Release/com.example.test.apk -> /Users/runner/runners/2.170.0/work/1/a/build/com.example.test.apk
##[section]Finishing: Copy build files to staging
它似乎将APK复制到staging文件夹,然后尝试对Android应用程序包(AAB)执行同样的操作:
##[section]Starting: Copy bundle files to staging
==============================================================================
Task : Command Line
Description : Run a command line with arguments
Version : 1.1.3
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
[command]/bin/bash -c mkdir -p /Users/runner/runners/2.170.0/work/1/a/bundle && ls -LR && /usr/bin/find . -path '*/obj/*' -type f -name '*.aab' -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -1 | cut -f2- -d" " | xargs -L 1 -I{} cp -R -v {} /Users/runner/runners/2.170.0/work/1/a/bundle
(node:1787) Warning: Use Cipheriv for counter mode of aes-256-ctr (11 times)
Example.Common.DataTypes
Example.Identity.Common
Example.Test
Example.Test.Android
Example.Test.UWP
Example.Test.iOS
Example.Test.sln
Example.ruleset
./Example.Common.DataTypes:
ExampleType.cs
Example.Common.DataTypes.csproj
AnotherType.cs
bin
obj
... (whole lot of files removed from this logging)
./Example.Test.iOS/obj:
Example.Test.iOS.csproj.nuget.dgspec.json
Example.Test.iOS.csproj.nuget.g.props
Example.Test.iOS.csproj.nuget.g.targets
project.assets.json
project.nuget.cache
##[section]Finishing: Copy bundle files to staging
它似乎转储了所有的文件,但并不复制实际的AAB文件。我不确定它为什么找不到AAB文件,因为它似乎确实在obj文件夹中创建了AAB文件。这是在Xamarin.android项目阶段的Build bundle中显示的:
_BuildApkEmbed:
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java -Xmx1G -jar /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/bundletool.jar build-bundle --modules obj/Release/android/bin/base.zip --output obj/Release/android/bin/com.example.test.aab --config /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmpb29e9af.tmp
_CopyPackage:
Copying file from "/Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/obj/Release/android/bin/com.example.test.aab" to "/Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/bin/Release/com.example.test.aab".
_CreateAndroidDebugSigningKey:
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/keytool -genkeypair -alias androiddebugkey -storepass android -keypass android -keystore "/Users/runner/.local/share/Xamarin/Mono for Android/debug.keystore" -dname "CN=Android Debug,O=Android,C=US" -keyalg RSA -validity 10950 -storetype pkcs12
_ResolveAndroidSigningKey:
Creating "obj/Release/android_debug_keystore.flag" because "AlwaysCreate" was specified.
_Sign:
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/jarsigner -keystore "/Users/runner/.local/share/Xamarin/Mono for Android/debug.keystore" -storepass android -keypass android -digestalg SHA-256 -sigalg SHA256withRSA -signedjar bin/Release/com.example.test-Signed.aab /Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/obj/Release/android/bin/com.example.test.aab androiddebugkey
jar signed.
The signer's certificate is self-signed.
Signed android package ''
Done Building Project "/Users/runner/runners/2.170.0/work/1/s/Example.Test.Android/Example.Test.Android.csproj" (PackageForAndroid;SignAndroidPackage target(s)).
Build succeeded.
我不知道有什么可能会出错,以及为什么最后一步会转储我所有的文件,而不是将AAB复制到staging文件夹。
因为我不能在评论中分享图片,所以我把这个贴出来作为一个回答。
如果是这样,只需下载该包,这就是您的AAB文件。