I have created a Xamarin Forms application and when it builds on my computer it generates an AAB. When I enabled signing then the AAB file is accepted by the Google Play store and can be published.
AppCenter has been set-up to build the same solution and I enabled the option to build an Android App Bundle (available via the wrench icon in the Build tab when you hover the branch):
It does seem to build the Android App Bundle when I look at the build logging:
...
##[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
I guess the build and siging is all fine, but I guess something goes wrong during the Copy bundle files to staging stage. Before that the Copy build files to staging stage runs and it shows the following output:
##[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
It seems to copy the APK to the staging folder and then it tries to do the same for the Android App Bundle (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
It seems to dump all the files, but it doesn't copy the actual AAB file. I'm not sure why it cannot find the AAB file, because it did seem to create the AAB file in the obj folder. This was shown during the Build bundle from Xamarin.Android project stage:
_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.
I don't know what could be wrong and why that last steps dumps all my files, instead of copying the AAB to the staging folder.
Posting this as an answer, since I can't share pictures in the comment.
It doesn't seem like you have any errors. When you look at the build in the Distribute page, try to click on the download drop down button, are you able to see the download bundle button, as shown:
If so, just download the bundle and that's your AAB file.
AppCenter support confirmed the issue and filed a bug-report. It only occurs with Xamarin 10.3 and downgrading to Xamarin 10.2 indeed solves this issue. At June 16th, 2020 I got an e-mail that the bug has been fixed and it now also works with Xamarin 10.3 again.
Related
Ive just read about the issue with Malware inside of handbrake for OSX - link to article on hacker news.
Ive got handbrake installed on a few computers of mine, so wanted to check wether i had an infected copy. To do this i ran the following terminal command as suggested via handbrakes checksum page.
COMMAND : cd /Applications shasum -a 1 HandBrake-* && shasum -a 256 HandBrake-
From this i got the following response which seems to be blank.. any ideas wether this is saying that i have an infected file or if ive just run the initial terminal command wrong ?
RESPONSE : shasum: HandBrake-: Sams-MacBook-Pro:Applications Sam$
It appears the instructions on the HandBrake website are for checking the original .dmg file downloaded and saved in the ~/Downloads directory:
~/Downloads/HandBrake-1.0.7.dmg
Open Terminal.app
cd ~/Downloads
shasum -a 1 HandBrake-* && shasum -a 256 HandBrake-*
Result:
6d2e5158f101dad94ede3d5cf5fda8fe9fd3c3b9 HandBrake-1.0.7.dmg
3cd2e6228da211349574dcd44a0f67a3c76e5bd54ba8ad61070c21b852ef89e2 HandBrake-1.0.7.dmg
If you have a version of HandBrake already installed and want to verify the shasum:
Check the version of HandBrake.app installed in /Applications
Download the corresponding .dmg from the archive page (https://handbrake.fr/old.php)
Run command (shown above) mentioned here on the .dmg and verify it matches
If the returned shasums match the corresponding version mount the .dmg
Finally, run the following commands:
shasum -a 1:
$ shasum -a 1 /Applications/HandBrake.app/Contents/MacOS/HandBrake && \
shasum -a 1 /Volumes/HandBrake-1.0.2/HandBrake.app/Contents/MacOS/HandBrake
Result:
95017f8cc3d634d71b45407830d22e65a9098cb8 /Applications/HandBrake.app/Contents/MacOS/HandBrake
95017f8cc3d634d71b45407830d22e65a9098cb8 /Volumes/HandBrake-1.0.2/HandBrake.app/Contents/MacOS/HandBrake
shasum -a 256:
$ shasum -a 256 /Applications/HandBrake.app/Contents/MacOS/HandBrake && \
shasum -a 256 /Volumes/HandBrake-1.0.2/HandBrake.app/Contents/MacOS/HandBrake
Result:
200c8ace634f792bffd3142f96c2187943c0243a441363220202552eb804dcec /Applications/HandBrake.app/Contents/MacOS/HandBrake
200c8ace634f792bffd3142f96c2187943c0243a441363220202552eb804dcec /Volumes/HandBrake-1.0.2/HandBrake.app/Contents/MacOS/HandBrake
If the hashes match (showing twice each command) then you'll know the binary is legit.
I would like to install the dmg java package in my MAC OS through the terminal
I tried using this command:
sudo installer -package jdk-7u51-macos-x64.dmg -target /
But I receive this error:
installer: Error the package path specified was invalid: 'jdk-7u51-macos-x64.dmg'
Try this:
MOUNTDIR=$(echo `hdiutil mount jdk-7u51-macos-x64.dmg | tail -1 \
| awk '{$1=$2=""; print $0}'` | xargs -0 echo) \
&& sudo installer -pkg "${MOUNTDIR}/"*.pkg -target /
Let dmgFilePath be the variable containing the path of your dmg file.
Then you can try this :
$ MOUNTDEV=$(hdiutil mount $dmgFilePath | awk '/dev.disk/{print$1}')
$ MOUNTDIR="$(mount | grep $MOUNTDEV | awk '{$1=$2="";sub(" [(].*","");sub("^ ","");print}')"
$ sudo installer -pkg "${MOUNTDIR}/"*.pkg -target /
$ hdiutil unmount "$MOUNTDIR"
Tested on macOS High Sierra even if "$MOUNTDIR" contains one space.
I ran into the exact same problem and found the root cause.
if you trying to install a package where the installer has no permission to access the directory you will get that weird error.
i.e
osascript -e {'do shell script "installer -allowUntrusted -pkg ~/Download/OpenJDK8U-jdk_x64_mac_hotspot_8u275b01.pkg -target /tmp/ " with administrator privileges'}
1:150: execution error: installer: Error - the package path specified was invalid: '/Users/user-x/Download/OpenJDK8U-jdk_x64_mac_hotspot_8u275b01.pkg'. (1)
either by moving the package into /tmp/ or change the directory permission so applescript or installer command can access the file.
osascript -e {'do shell script "installer -allowUntrusted -pkg /tmp/OpenJDK8U-jdk_x64_mac_hotspot_8u275b01.pkg -target /tmp/ " with administrator privileges'}
installer: The upgrade was successful.K
Thank Mateusz Szlosek,
For me :
$ MOUNTDIR=$(echo `hdiutil mount /Users/valorisa/Downloads/VirtualBox\ 5.0.14\ Build\ 105127
/VirtualBox-5.0.14-105127-OSX.dmg | tail -1 | awk '{$1=$2=""; print $0}'` | xargs -0 echo)
&& sudo installer -pkg "${MOUNTDIR}/"*.pkg -target /
Password:
installer: Package name is Oracle VM VirtualBox
installer: Upgrading at base path /
installer: The upgrade was successful.
Valorisa
I'm trying to import a certificate via cmd with certutil.exe
After I tried this command:
certutil.exe -A -n C:\Documents and Settings\xxxxx\Desktop\RootCert-somecert.cer -t c
It returns me
certutil.exe: function failed: The certificate/key database is in an old, unsupported format
Can you help me?
make sure that the key3.db, cert8.db and secmod.db is in the same directory and in the current directory where you run the certutil. If you want to point another directory for the db, use -d argument.
-n argument is used to give alias to the certificate. To point the certificate to add, use the -i argument.
example:
certutil.ex -A -n "mycert" -i "C:\Documents and Settings\xxxxx\Desktop\RootCert-somecert.cer" -t c -d "C:\certdb"
hope it helps
I want to package my native extension .jar (Android JAVA side) and .swc(ActionScript side) files into a ANE (Air Native Extension) file in windows 7 using command line and adt commands i have two .sh files (Mac OS) that can package the ANE file just by running them i don't have any idea how to write a .bat or .sh file so i couldn't find out how to translate .sh to a .bat file so i'm looking for some help to translate .sh commands into a .bat commands for windows users. I think it can help so many air developers .... :)
Build.sh :
adt="/Applications/Adobe Flash Builder 4.7/eclipse/plugins/com.adobe.flash.compiler_4.7.0.349722/AIRSDK/bin/adt"
nativedir="/Users/markhood/Documents/Eclipse64/ANESample_java"
echo "********************************************************************"
echo " - creating ANE package"
rm -rf Android-ARM/*
rm -f SampleASExtension.ane library.swf
mkdir -p Android-ARM
unzip ../ANESample/bin/ANESample.swc library.swf
cp library.swf Android-ARM
cp "$nativedir"/ANESample.jar Android-ARM
cp -r "$nativedir"/res Ansion.xml -swc ../ANESample/bin/ANESample.swc -platform Android-ARM -C Android-ARM .ndroid-ARM
"$adt" -package -target ane SampleASExtension.ane extension.xml -swc ../ANESample/bin/ANESample.swc -platform Android-ARM -C Android-ARM .
#"$adt" -package -storetype PKCS12 -keystore cer.p12 -storepass password -target ane SampleASExtension.ane exte
BuildANE.sh
# path to YOUR Android SDK
export AIR_ANDROID_SDK_HOME="/Users/leebrimelow/Documents/SDKs/android-sdk/"
# path to the ADT tool in Flash Builder sdks
ADT="/Applications/Adobe Flash Builder 4.5/sdks/4.5.0/bin/adt"
# native project folder
NATIVE_FOLDER=jar
# AS lib folder
LIB_FOLDER=lib
# app folder
APP_PROJECT=NotifyApp
# name of ANE file
ANE_NAME=notification.ane
# JAR filename
JAR_NAME=notification.jar
# APK name
APK_NAME=NotifyApp.apk
# cert path
CERT_NAME=cert.p12
# cert password
CERT_PASS=password
#===================================================================
echo "****** preparing ANE package sources *******"
rm ${ANE_NAME}
rm -rf ./build/ane
mkdir -p ./build/ane
mkdir -p ./build/ane/Android-ARM
mkdir -p ./build/ane/Android-ARM/res
#copy resources
cp -R ./${NATIVE_FOLDER}/res/* ./build/ane/Android-ARM/res
# create the JAR file
jar cf ./build/ane/Android-ARM/${JAR_NAME} -C ./${NATIVE_FOLDER}/bin .
# grab the extension descriptor and SWC library
cp ./${LIB_FOLDER}/src/extension.xml ./build/ane/
cp ./${LIB_FOLDER}/bin/*.swc ./build/ane/
unzip ./build/ane/*.swc -d ./build/ane
mv ./build/ane/library.swf ./build/ane/Android-ARM
echo "****** creating ANE package *******"
"$ADT" -package -storetype PKCS12 -keystore ./cert.p12 -storepass password -tsa none \
-target ane \
${ANE_NAME} \
./build/ane/extension.xml \
-swc ./build/ane/*.swc \
-platform Android-ARM \
-C ./build/ane/Android-ARM/ .
echo "****** ANE package created *******"
echo "****** preparing APK package sources *******"
rm ${APK_NAME}
rm -rf ./build/apk
mkdir -p ./build/apk
cp ./${APP_PROJECT}/bin-debug/${APP_PROJECT}-app.xml ./build/apk
cp ./${APP_PROJECT}/bin-debug/${APP_PROJECT}.swf ./build/apk
echo "****** creating APK package *******"
cd ./build/apk
"$ADT" -package -target apk -storetype PKCS12 -keystore ../../${CERT_NAME} -storepass ${CERT_PASS} \
../../${APK_NAME} \
./${APP_PROJECT}-app.xml \
./${APP_PROJECT}.swf -extdir ../..
cd ../..
echo "****** APK package created *******"
adb uninstall air.${APP_PROJECT}.debug
adb install ${APK_NAME}
I would recommend building it with ANT instead. It is more easily converted between Mac and Windows. Take a look at PushWoosh's ANE build scripts as an example. They are well done and easy to use. https://github.com/shaders/push-notifications-sdk/tree/master/SDK%20Sample%20Projects/AdobeAir/ANE-Pushwoosh/build
I have a pkg file created by Install Maker for Mac.
I want to replace one file in pkg. But I must do this under Linux system, because this is a part of download process. When user starts to download file server must replace one file in pkg.
I have a solution how unpack pkg and replace a file but I dont know how pack again to pkg.
http://emresaglam.com/blog/1035
http://ilostmynotes.blogspot.com/2012/06/mac-os-x-pkg-bom-files-package.html
Packages are just .xar archives with a different extension and a specified file hierarchy. Unfortunately, part of that file hierarchy is a cpio.gz archive of the actual installables, and usually that's what you want to edit. And there's also a Bom file that includes information on the files inside that cpio archive, and a PackageInfo file that includes summary information.
If you really do just need to edit one of the info files, that's simple:
mkdir Foo
cd Foo
xar -xf ../Foo.pkg
# edit stuff
xar -cf ../Foo-new.pkg *
But if you need to edit the installable files:
mkdir Foo
cd Foo
xar -xf ../Foo.pkg
cd foo.pkg
cat Payload | gunzip -dc |cpio -i
# edit Foo.app/*
rm Payload
find ./Foo.app | cpio -o | gzip -c > Payload
mkbom Foo.app Bom # or edit Bom
# edit PackageInfo
rm -rf Foo.app
cd ..
xar -cf ../Foo-new.pkg
I believe you can get mkbom (and lsbom) for most linux distros. (If you can get ditto, that makes things even easier, but I'm not sure if that's nearly as ubiquitously available.)
Here is a bash script inspired by abarnert's answer which will unpack a package named MyPackage.pkg into a subfolder named MyPackage_pkg and then open the folder in Finder.
#!/usr/bin/env bash
filename="$*"
dirname="${filename/\./_}"
pkgutil --expand "$filename" "$dirname"
cd "$dirname"
tar xvf Payload
open .
Usage:
pkg-upack.sh MyPackage.pkg
Warning: This will not work in all cases, and will fail with certain files, e.g. the PKGs inside the OSX system installer. If you want to peek inside the pkg file and see what's inside, you can try SuspiciousPackage (free app), and if you need more options such as selectively unpacking specific files, then have a look at Pacifist (nagware).
You might want to look into my fork of pbzx here: https://github.com/NiklasRosenstein/pbzx
It allows you to stream pbzx files that are not wrapped in a XAR archive. I've experienced this with recent XCode Command-Line Tools Disk Images (eg. 10.12 XCode 8).
pbzx -n Payload | cpio -i
In addition to what #abarnert said, I today had to find out that the default cpio utility on Mountain Lion uses a different archive format per default (not sure which), even with the man page stating it would use the old cpio/odc format. So, if anyone stumbles upon the cpio read error: bad file format message while trying to install his/her manipulated packages, be sure to include the format in the re-pack step:
find ./Foo.app | cpio -o --format odc | gzip -c > Payload
#shrx I've succeeded to unpack the BSD.pkg (part of the Yosemite installer) by using "pbzx" command.
pbzx <pkg> | cpio -idmu
The "pbzx" command can be downloaded from the following link:
pbzx Stream Parser
If you are experiencing errors during PKG installation following the accepted answer, I will give you another procedure that worked for me (please note the little changes to xar, cpio and mkbom commands):
mkdir Foo
cd Foo
xar -xf ../Foo.pkg
cd foo.pkg
cat Payload | gunzip -dc | cpio -i
# edit Foo.app/*
rm Payload
find ./Foo.app | cpio -o --format odc --owner 0:80 | gzip -c > Payload
mkbom -u 0 -g 80 Foo.app Bom # or edit Bom
# edit PackageInfo
rm -rf Foo.app
cd ..
xar --compression none -cf ../Foo-new.pkg
The resulted PKG will have no compression, cpio now uses odc format and specify the owner of the file as well as mkbom.
Bash script to extract pkg: (Inspired by this answer:https://stackoverflow.com/a/23950738/16923394)
Save the following code to a file named pkg-upack.sh on the $HOME/Downloads folder
#!/usr/bin/env bash
filename="$*"
dirname="${filename/\./_}"
mkdir "$dirname"
# pkgutil --expand "$filename" "$dirname"
xar -xf "$filename" -C "$dirname"
cd "$dirname"/*.pkg
pwd
# tar xvf Payload
cat Payload | gunzip -dc |cpio -i
# cd usr/local/bin
# pwd
# ls -lt
# cp -i * $HOME/Downloads/
Uncomment the last four lines, if you are using a rudix package.
Usage:
cd $HOME/Downloads
chmod +x ./pkg-upack.sh
./pkg-upack.sh MyPackage.pkg
This was tested with the ffmpeg and mawk package from rudix.org (https://rudix.org) search for ffmpeg and mawk packages on this site.
Source : My open source projects : https://sourceforge.net/u/nathan-sr/profile/