I have my Android project set as the startup project, set to release > android device.
After making changes to project code, and selecting [Build > Archive for Publishing] from the menu, the build is successful and the archive opens, with a new entry. I sign this build and save it to disk as an .apk file, but upon installing this on my Android device, it becomes apparent the code changes are not present in the build. I have to force quit Xamarin Studio and repeat the steps above to get the code changes to present themselves in the build.
- This was present on the previous version (6.1.1) but was able to be fixed by repeating the archive process without force quitting Xamarin Studio first
- If I change the version number in AndroidManifest.xml after making the code changes, the archived build will show the previous version number
- This does not affect my iOS builds
I will try to investigate this, but I'm curious, you have to "force quit" Xamarin Studio? Xamarin Studio won't quit by itself?
Some things you can attach to the bug report, the logs from Help | Open Log Directory - reproduce the error and the force quit.
Before force quitting XS and grabbing the logs, in Terminal, do
> kill -quit <process id of XS>
(get the process id from activity monitor)
I did reproduce this. I'm not completely sure how your workaround fixes it for you, it appears to require a clean for me.
Here were my repro steps (both in XS and on the cmdline)
1. Create a new android project
2. Switch to release configuration
3. Archive for Publishing
4. Sign and distribute the created archive to file (Desktop for example)
5. Using `adb install <apk file name>`, install the app
6. Run the app to see the default behaviour
7. Edit MainActivity.cs and change the label, display text etc
8. Archive for Publishing again
9. Sign and distribute the selected app, use same or different location, does not matter
10. uninstall the existing app `adb uninstall <packagename>`
11. install the updated apk, `adb install <apk file name>`
12. run the app and notice that the none of the changes were deployed
1. Create a new android project
2. `xbuild /p:Configuration=Release /t:Build`
3. `xbuild /p:Configuration=Release /t:PackageForAndroid` (this is what XS uses to create the initial apk to store in the archive).
4. Verify that the .apk was created, look at its timestamp
5. Wait a little, makes looking at timestamps easier
6. make the same edits in step 7 from prior repro steps
7. `xbuild /p:Configuration=Release /t:Build`
8. `xbuild /p:Configuration=Release /t:PackageForAndroid`
9. Look at the timestamps of the files
10. the timestamp of the .apk does not change, the build output from packageForAndroid indicates that it did nothing.
I think that's why the archive isn't updated. We don't get an updated .apk.
@dean can you verify this?
My apologies, I need to correct myself. I'm primarily a windows user and only use my macbook pro for Xamarin, so I'm not entirely familiar with the operating system. Closing the app with the red button in the top-left corner wasn't actually closing Xamarin Studio, just minimising it. Upon further inspection I now realise there's an option to quit normally from the Xamarin Studio menu, which is in fact adequate to exit the program as you suspected.
My most recent force quit also failed to fix the issue this time, so perhaps something in the force quit had triggered the app to do a clean build last time as possibly shown by the increased build time (this is all just speculation though).
Here are the steps I took to verify your solution:
1. Select Android project as startup project
2. Perform Clean
3. Build the project
4. Archive for publishing
5. Save to disk
6. Transfer .apk file onto Android device
7. Install and verify changes are now present
PR is up https://github.com/xamarin/xamarin-android/pull/333
Fixed in xamarin-android/master/20832a61
@Dean, Please fix the commit in C9. It will help us to verify and close this issue.
fixed in monodroid/cycle9/3819c645
VS will need to be bumped but the mac build should be ok.
I have checked this issue on Mac with latest C9 XamarinStudio-220.127.116.110_058f8df13bdfe48e4cba6021b876e4f66943a099 and xamarin.android-7.1.0-21 and on Windows VS with Xamarin.VisualStudio_18.104.22.1681_48809a62ab179f5898f3bf0e1b9abd441840eabf and observed that now this issue is working fine. After make changes and creating the new .apk using [Build > Archive for Publishing] option from menu then changes are reflecting correctly in new build.
Hence I am closing this issue.