Xamarin-android: Deployment issue with Fast Deployment feature enabled after Visual Studio upgrade

Created on 30 Mar 2021  路  54Comments  路  Source: xamarin/xamarin-android

After upgrading Visual Studio Professional 2019 to version 16.9.2, when I try to deploy application on Android Emulator or physical device with Fast Deployment feature enabled, I get following error:
Error XA0130: Sorry. Fast deployment is only supported on devices running Android 5.0 (API level 21) or higher. Please disable fast deployment in the Visual Studio project property pages or edit the project file in a text editor and set the 'EmbedAssembliesIntoApk' MSBuild property to 'true'.

Expected Behavior

App deploy successful

Actual Behavior

[XA0130] error, deployment failed

Version Information

Microsoft Visual Studio Professional 2019
Version 16.9.2
VisualStudio.16.Release/16.9.2+31112.23
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

ASP.NET and Web Tools 2019 16.9.688.6828
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services 16.1.0.2112521+5741df381174d72f08e3632bb99f52e8635b6a1a
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019 16.9.688.6828
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.9.688.6828
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 16.9.688.6828
Azure Functions and Web Jobs Tools

C# Tools 3.9.0-6.21160.10+59eedc33d35754759994155ea2f4e1012a9951e3
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fine Code Coverage fcc-f339fe606-9d51-4fca-895c-d50375137b62
Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)

GhostDoc 20.2.20270.0
Generate XML Comments from your code, maintain clean and up-to-date documentation, produce help documentation in multiple formats, use intelligent source code Spell Checker in Visual Studio.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

JetBrains ReSharper 2020.3.4 Build 203.0.20210316.132251
JetBrains ReSharper package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper. Copyright 漏 2021 JetBrains, Inc.

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.40218.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Mono Debugging for Visual Studio 16.9.7 (df23ba6)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.9.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.62103.10080
Microsoft SQL Server Data Tools

TypeScript Tools 16.0.30201.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.9.0-6.21160.10+59eedc33d35754759994155ea2f4e1012a9951e3
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 16.9.0-beta.21102.9+7ce7132f1459095e635194d09d6f73265352029a
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

VisualStudio.DeviceLog 1.0
Information about my package

VisualStudio.Foo 1.0
Information about my package

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.9.000.273 (d16-9@1bba9e0)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.9.0.316 (remotes/origin/d16-9@fdbf64026)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.9.68 (8e9b569)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 11.2.2.1 (d16-9/877f572)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@54f8c24
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.34.1@daff8f4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@d210f11

Xamarin.iOS and Xamarin.Mac SDK 14.14.2.5 (3836759d4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Log File

Detailed msbuild log is attached
msbuild.zip

App+Library Build need-info

Most helpful comment

We are indeed, and it's false. Removing that, on top of the other changes mentioned, has fixed the fast deploy.
Thanks v much for the speedy responses, cheers!

All 54 comments

I'm getting the same error using a physical device but the emulators I've tried have been fine (my usual emulators run Android 9 & 10).

My test device is a Samsung Galaxy S6 Edge running Android 7.0 (API 24) which is obviously higher than Android 5.0 (API level 21).

I get the same error with an existing Xamarin Forms project and a new blank Forms project.

@Shourek or @irongut could you add this to your project and attach another .binlog, thanks!

<_FastDeploymentDiagnosticLogging>true</_FastDeploymentDiagnosticLogging>

This should log extra information during the <FastDeploy/> MSBuild task.

I think what might be happening is that something else on your device is not supported, and we need to improve the error message here. (or also could be a bug)

@jonathanpeppers I assume that value goes in my Android project rather than my Forms project. How do I create the binlog & where can I find it?

Sorry, @Shourek has a .binlog on the original issue, so I didn't post instructions.

You can build command-line with the -bl switch, and a msbuild.binlog file will appear the current directory:

msbuild YourAndroidApp.csproj -t:Install -p:_FastDeploymentDiagnosticLogging=true -bl

Then zip/upload the msbuild.binlog file here, thanks.

@jonathanpeppers thanks for a quick response.

Here you can find the msbuild log with FastDeploymentDiagnosticLogging enabled.
msbuild-fastDeployDiagnostics.zip

@jonathanpeppers Thanks for the instructions. I've attached a binlog for a new blank Forms app deploying to my Samsung S6 Edge.

msbuild.zip

@Shourek if you can run adb shell at the command-line what do these commands return?

$ adb shell run-as com.ios.EnviNative cat files/.__tools__/version
$ adb shell run-as com.ios.EnviNative mkdir -p files/.__tools__

@irongut you can try the same, your app name is different though:

$ adb shell run-as com.companyname.xamtest cat files/.__tools__/version
$ adb shell run-as com.companyname.xamtest mkdir -p files/.__tools__

adb.exe is at "C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" by default.

I'm thinking both of your devices might not support run-as? We should at least change the error message to say Your device doesn't support run-as, but maybe we need to figure out how widespread this is?

@jonathanpeppers after executing both of these commands I've got next message:
run-as: package not debuggable

Does it means that my emulator doesn't support run-as?

@Shourek I can't tell from the build log, do you have android:debuggable="false" in your Properties\AndroidManifest.xml?

You can also check obj\Debug\100\AndroidManifest.xml and see what is in there.

I'm also getting this, on samsung A70 android 10 device. Previously worked fine on VS 16.7.
Left unable to debug, which is grim.
NB android:debuggable="false" in the Debug\100\Android\ manifest file, but not in the project manifest file.

@hwd71 can you attach a .binlog file as mentioned above? It sounds like you must have some Release mode settings in your Debug configuration. Debug builds should emit android:debuggable="true" by default.

@jonathanpeppers With my S6 Edge connected I get run-as: Could not set capabilities: Operation not permitted for both commands.

I also have a Samsung Galaxy S8+ on Android 9 (API 28) and a Samsung Tab S6 Lite on Android 11 (API 30) which have no problems with the new fast deployment method.

/cc @dellis1972 for when you're back next week 馃槃, I think two things would help here.

Give a different error code & error message for:

  • package not debuggable - offer suggestion to check android:debuggable
  • Operation not permitted - say the device doesn't support run-as. I think it says the device < API 21 right now.

Debug is now working, with Fast Deploy off, so panic over, phew! Thanks for speedy response.
"Optimize" was set on the debug profile, oddly, so set that to false, and set Link to None, and enabled AAPT2.
Also Tools/Options/Xamarin/AndroidSettings/ProvideDebugSymbols - wasn't ticked, ticked that.
Uninstall, uninstall Mono Shared runtime, rebuild all, breakpoints now hit.

The binlog is large; it's a large project.. 38Mb.. do you still want it, for the fast deployment failure?

Optimize=True would also break Fast Deployment. So we probably don't need a log for that, thanks.

I tried again, cos you know, I'd really like Fast Deployment, and it was previously working just fine.
Even with Optimize false, cleaning everything down and rebuilding, I get
XA0130: Sorry. Fast deployment is only supported on devices running Android 5.0 (API level 21) or higher.

So, I disabled Fast Deploy, rebuilt, deployed, make sure that breakpoints are hit.
Then I checked the Debug/100/android/manifest, and it still says android:debuggable="false"
And, if I run adb shell with pwd, for example, it still says
run-as: package not debuggable: mypackage

Which makes no sense to me, as it obviously is debuggable, as I've just been debugging it.
Or else, there's some other gremlin at work.

@hwd71 attach a .binlog if you think the settings are correct and it's still not working.

Can't attach my binlog, it's too large! I ran up a new Android project instead, and that also failed, but in various different ways. Tried nuget update, target framework from 11 to 10, and finally switched the "minimum android" up from the default 5 to 6, and it runs up fine, with fast deployment. Switched it back to 5, and still works fine. So, whilst it seems a bit shaky, it is definitely working, on the same device.

So, there definitely is a problem with fast deploy, for me, on this legacy project.. but, it's working in general.
For the moment, I'll have to return to an older IDE.

@hwd71

can you search for debuggable in all the AndroidManiest.xml files in the obj/Debug/100/lp directory (all the sub directories).

What I suspect is happening is a Nuget Package manifest has the debuggable property set to false and it is being merged into the final manifest overwriting the value we set.

It looks like run-as is broken for some (possibly older) models of Samsung:
https://stackoverflow.com/questions/37413667/run-as-could-not-set-capabilities-operation-not-permitted

@jonathanpeppers May be you can use another method rather than run-as for fast deployment?

@john-larson if you want to write up a spec on how that would work, that would be great, thanks!

@john-larson the only other time I've seen the could not set capabilities error is when the app was installed under a different user account on the same device.

@hwd71 did you see my earlier comment https://github.com/xamarin/xamarin-android/issues/5794#issuecomment-812684318 ?

You mentioned that debuggable is set to false in your obj/Debug/100/AndroidManifest.xml which means something is overwriting the value we set for debug builds. This is controlled by the AndroidIncludeDebugSymbols property which will be set to true for the following conditions

<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
<Optimize>false</Optimize>

Now if your file obj/Debug/100/AndroidManifest.xml still has false in it even with the settings above being correct then it means something else is overwriting the setting. This is probably a Nuget Package or a library project. We have seen instances of Nuget Packages including an AndroidManifest.xml which contains an application element.
So if you can search the following directory obj/Debug/100/lp and its subdirectories for AndroidManifest.xml files which contain debuggable we might be able to identify what is causing the problem in your particular case.

It is true that some device manufacturers (particularly Samsung) do mess around with the android OS on their devices, this can stop things like run-as from working completely. I am updating our error messaging to catch specific errors such as "Operation no permitted" to explain that in cases like this fast dev won't function on that device.

Sorry, Easter break. Interesting info about nuget/manifest stuff, thanks.
A search for 'debuggable' under /obj for *.xml shows 2 results
100\androidAndroidManifest.xml (1 hit)
100\android\manifestAndroidManifest.xml (1 hit)
Both of which show
android:debuggable="false"
The values in the csproj DEBUG section match yours, except for
<DebugType>full</DebugType>
Having changed that to 'portable', reloaded and rebuilt, all excited, but.. I still get the same XA0130 error, and still the same search results.
So, something 'else' is switching manifest debuggable to false, if I'm understanding right. I'll have a look through the detailed log. Any more help greatly appreciated - I know that it works with a vanilla project, on the same device.

Interestingly, from the build diagnostic log, I see lots of these, which don't look good?

Target "_CheckInstantRunCondition: (TargetId:35)"...
Task "CreateProperty" (TaskId:31)
  Task Parameter:Value=Assemblies (TaskId:31)
  Output Property: _LocalAndroidFastDeploymentType=Assemblies (TaskId:31)
Done executing task "CreateProperty". (TaskId:31)
Task "CreateProperty" skipped, due to false condition...
Task "Message" (TaskId:32)
  Task Parameter:Text=Dex Fast Deployment Enabled: False (TaskId:32)
  Dex Fast Deployment Enabled: False (TaskId:32)

NB this android project has lots of android library projects involved, and seems to get these messages for every project.

@hwd71
Are you using a Custom Application? Can you search your code for the ApplicationAttribute and make sure that you don't have code setting the debuggable property there?

[Application (Debuggable=false)]

Can you post a snippet from the build log around the target "_GenerateJavaStubs".

Don't worry about he Dex Fast Deployment stuff, that is an enhanced debugging mode which is disabled by default. It won't be the cause of this issue.

We are indeed, and it's false. Removing that, on top of the other changes mentioned, has fixed the fast deploy.
Thanks v much for the speedy responses, cheers!

I have a similar issue. I have lost the ability of debugging when fast deploy is enabled. The only way I can fix it is to turn off fast deploy and link SDK assemblies. If I don't do this, my app hangs on the splash screen and eventually hot reload times out.

I have looked at the settings and the android:debuggable seems to be being set to true. I removed our custom Application also to see if that was the issue. If I used 16.9.1 this all works. But moving to 16.9.4 is broke. The issue is that in 16.9.1 the Android project templates were half missing, so I needed to update to get them back.

I'm now having a really hard time getting hot reload to work - it seems to claim my settings conflict (but they worked earlier.) The settings are set to not use "fast deploy" and to link "Sdk Assembles", but hot reload says the configuration is unsupported and I should set the linker to use "Don't link" or "Link SDK assemblies only"... except, that second option is exactly what I believe is set.

@memsom your issue sounds quite different from this one: your app is crashing and Android is continually trying to restart the activity. Normally I've only seen this when some native library is missing, and we hit a native crash on startup.

Can you file a new issue with adb logcat output? Thanks!

still facing with this issue with
Microsoft Visual Studio Enterprise 2019
Version 16.9.5
Xamarin.Android.SDK 11.2.2.1

Configuration

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RELEASE_USER|AnyCPU'">
    <DebugSymbols>false</DebugSymbols>
    <OutputPath>bin\RELEASE_USER\</OutputPath>
    <DefineConstants>TRACE;RELEASE_USER;</DefineConstants>
    <Optimize>true</Optimize>
    <DebugType>portable</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <LangVersion>8.0</LangVersion>
    <ErrorReport>prompt</ErrorReport>
    <AndroidLinkTool>r8</AndroidLinkTool>
    <AndroidPackageFormat>aab</AndroidPackageFormat>
    <AndroidUseAapt2>true</AndroidUseAapt2>
    <AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
    <AotAssemblies>true</AotAssemblies>
    <EnableLLVM>true</EnableLLVM>
    <AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
    <AndroidSupportedAbis>armeabi-v7a;arm64-v8a</AndroidSupportedAbis>
    <JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
    <BundleAssemblies>true</BundleAssemblies>
    <AndroidEnableMultiDex>true</AndroidEnableMultiDex>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
    <AndroidKeyStore>true</AndroidKeyStore>
    <AndroidSigningKeyStore>my.keystore</AndroidSigningKeyStore>
    <AndroidSigningKeyAlias>my_alias</AndroidSigningKeyAlias>
    <AndroidSigningStorePass>my_password</AndroidSigningStorePass>
    <AndroidSigningKeyPass>my_password</AndroidSigningKeyPass>
  </PropertyGroup>

@jonathanpeppers

@e-PGDev001 we would need to see a .binlog file with your issue as described above: https://github.com/xamarin/xamarin-android/issues/5794#issuecomment-810271818

There are instructions a few comments below this one. ^ Thanks.

@jonathanpeppers i think Share Mono Runtime is removed in new version of VS and Xamarin SDK but you guys didn't change the default value into false in MSBuild engine.
I resolved this problem by add

<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>

in to release PropertyGroup

@e-PGDev001 I checked the project template and it sets AndroidUseSharedRuntime=false in the Release configuration.

Can you elaborate on what the problem is exactly? If the IDE is doing something wrong, could you go to Help > Send Feedback > Report a Problem. That is the best place to file IDE issues.

Hello @jonathanpeppers ,

i have a similar problem with the Fast Assembly Deployment.
When i turn it on, the deployment process stucks on "fast deploy application files"
I just see some dll's are copied and than it stops.
When i turn it off, it deploys correctly.
The strange thing is when i enable it, it changes the property in my android.csproj file: false

But when i open the android project settings again in the IDE (VS for Mac Community 8.9.9 build 3) its again disabled.
But in the csproj file it remains as false.

I don't see any error, it just stucks on "fast deploy application files"

Thx!

@stoff99 this issue is about the error:

Error XA0130: Sorry. Fast deployment is only supported on devices running Android 5.0 (API level 21) or higher.

If your build is getting stuck/hanging, that is a different problem. Can you file a new issue with a diagnostic MSBuild log? It might show us exactly where the build is stuck.

@jonathanpeppers

I too am getting "Error XA0130: Sorry. Fast deployment is only supported on devices running Android 5.0 (API level 21) or higher." since updating to the latest VS2019 build.

@JREnitial can you follow the instructions on https://github.com/xamarin/xamarin-android/issues/5794#issuecomment-810553540 and post a binlog?

Also somethings to check in the mean time

  1. Make sure your AndroidManifest.xml does not contain android:debuggable="false".
  2. If you have a custom application class. make sure the [Application] attribute does not have Debuggable=False set.

Also a note, we have improved the error messaging for the d16-10 release. So if you can test out the preview versions that would be helpful. You can install both side by side so there is no need to uninstall the stable version.

@dellis1972
msbuild.zip

@JREnitial The error we are seeing is Package uk.co.enidata.enidata25 was not installed.
Do you have a multi user or guest account on that device? If so you will need to make sure it is not installed under any other user account.

@dellis1972
Nope. All I know is the error at the bottom of the output window, and the only error in the "error window' is: "Error XA0130: Sorry. Fast deployment is only supported on devices running Android 5.0 (API level 21) or higher." Has never been an issue before, and same deice and setup (other then VS update a couple days ago) is the same. Given this error, surely this is why it has "not installed" as a secondary error?? It can't even build it, let alone deploy/install it???...

@JREnitial

Here is the snipped from the log file you provided

Found device: 937531f309439c63 (TaskId:190)
  DEBUG RunShellCommand 937531f309439c63 "run-as" "uk.co.enidata.enidata25" "pwd". [16ms] (TaskId:190)
  Package uk.co.enidata.enidata25 was not installed. (TaskId:190)
  Installing Package uk.co.enidata.enidata25 (TaskId:190)
  [BEGIN] InstallPackage (TaskId:190)
  DEBUG RunShellCommand 937531f309439c63 pm install -d "/data/local/tmp/uk.co.enidata.enidata25-Signed.apk". [8932ms] (TaskId:190)
  DEBUG RunShellCommand 937531f309439c63 pm uninstall -k uk.co.enidata.enidata25. [15123ms] (TaskId:190)
  DEBUG RunShellCommand 937531f309439c63 pm uninstall -k uk.co.enidata.enidata25. [0ms] (TaskId:190)
  DEBUG RunShellCommand 937531f309439c63 pm install "/data/local/tmp/uk.co.enidata.enidata25-Signed.apk". [2478ms] (TaskId:190)
  DEBUG RunShellCommand 937531f309439c63 rm "/data/local/tmp/uk.co.enidata.enidata25-Signed.apk". [19473ms] (TaskId:190)
  Installed Package uk.co.enidata.enidata25. [49ms] (TaskId:190)
  [END] InstallPackage (TaskId:190)
  DEBUG RunShellCommand 937531f309439c63 "run-as" "uk.co.enidata.enidata25" "pwd". [0ms] (TaskId:190)
  Package uk.co.enidata.enidata25 was not installed.

The .apk was successfully built. The reason the XA0130 error is thrown is because the check we make after we installed the package returned Package uk.co.enidata.enidata25 was not installed. Yet according to the log you can see that adb thinks it installed the apk.

Just for context for the 16.9.x release the entire fast deployment system was rebuilt from scratch to work on newer API 30 devices. The old system would not longer function. So if you just upgraded to 16.9 from say 16.8 that would explain why you now see the error message.

We are aware that certain manufacturers (like Samsung) actively make changes to the Android OS will may well prevent Fast Deployment from working. So we need to do a couple of things to check to see if there is a problem with this particular device and the new fast deployment system. Looking at the log your app should be installed , although it will be missing its assemblies because we could not fast deploy them.
Can you open an Adb Command Prompt from the Tools->Android menu option (I think). Then run the following

adb shell pm list packages uk.co.enidata.enidata25

If you get package:uk.co.enidata.enidata25 as a result then the package was installed, if you get blank then it was not.

Next up try

adb shell pm list users

And post the results if you can. This will make sure no other users are running.

Finally if the package was installed try the following commands and post the results.

adb shell run-as uk.co.enidata.enidata25 ls
adb shell run-as uk.co.enidata.enidata25 pwd .
adb shell run-as uk.co.enidata.enidata25 readlink -f .

Another thing to check is if you have android:InstallLocation in the AndoridManifest.xml set to preferExternal rather than auto. That can sometimes cause issues too.

I think I have a similar issue on a Huawei P20, it seems to install something on the device, but Visual Studio for Mac just gets stuck deploying to the device. If I manually try to launch the App, I see our splash for a brief then App just crashes. I've tried with both Fast Deployment enabled and disabled, neither seem to work.

adb shell pm list users

Users:
    UserInfo{0:Owner:13} running

When running adb shell pm list packages, the App is installed.

adb shell run-as dk.TrackMan.Range ls
cache
code_cache
files
adb shell run-as dk.TrackMan.Range pwd                                                                                                                                                                                        
/data/data/dk.TrackMan.Range
adb shell run-as dk.TrackMan.Range readlink -f .

This last command just exits

I noticed one thing. I had to run adb shell run-as dk.TrackMan.Range pwd twice, the first time adb just says error: closed right after trying to deploy with VS

Just tried running with binlog. It seems to fail with:

"/Users/cheesebaron/git/DrivingRangeApp/TrackMan.DrivingRangeApp.Droid/TrackMan.DrivingRangeApp.Droid.csproj" (Install target) (1) ->
(_CompileJava target) ->
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1697,3): error XAJVC7000: Xamarin.Tools.Zip.ZipException: Failure to create temporary file: Too many open files [/Users/cheesebaron/git/DrivingRangeApp/TrackMan.DrivingRangeApp.Droid/TrackMan.DrivingRangeApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1697,3): error XAJVC7000:   at Xamarin.Tools.Zip.ZipArchive.Close () [0x00028] in <88e5f87310fc4b0cbcadde89bab7fe3c>:0  [/Users/cheesebaron/git/DrivingRangeApp/TrackMan.DrivingRangeApp.Droid/TrackMan.DrivingRangeApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1697,3): error XAJVC7000:   at Xamarin.Android.Tasks.ZipArchiveEx.Dispose (System.Boolean disposing) [0x0000b] in <5a1df33220564ef787578ac3c7e67d03>:0  [/Users/cheesebaron/git/DrivingRangeApp/TrackMan.DrivingRangeApp.Droid/TrackMan.DrivingRangeApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1697,3): error XAJVC7000:   at Xamarin.Android.Tasks.ZipArchiveEx.Dispose () [0x00000] in <5a1df33220564ef787578ac3c7e67d03>:0  [/Users/cheesebaron/git/DrivingRangeApp/TrackMan.DrivingRangeApp.Droid/TrackMan.DrivingRangeApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1697,3): error XAJVC7000:   at Xamarin.Android.Tasks.Javac.RunTask () [0x0005d] in <5a1df33220564ef787578ac3c7e67d03>:0  [/Users/cheesebaron/git/DrivingRangeApp/TrackMan.DrivingRangeApp.Droid/TrackMan.DrivingRangeApp.Droid.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1697,3): error XAJVC7000:   at Xamarin.Android.Tasks.AndroidToolTask.Execute () [0x00000] in <5a1df33220564ef787578ac3c7e67d03>:0  [/Users/cheesebaron/git/DrivingRangeApp/TrackMan.DrivingRangeApp.Droid/TrackMan.DrivingRangeApp.Droid.csproj]

msbuild.binlog.zip

(don't worry, I've revoked the PAT in my env vars that was exposed in the binlog...)

@Cheesebaron your too many open files is something we've seen before on MacOS. Its not related to Fast Dev. You can use the ulimit command line tool to change your file limits. Also try cleaning out your temp folder. We used to hit this allot on Azure Pipelines.

Thanks @dellis1972 you are right. I have it working again.

@dellis1972

Update timeline sounds right, as although I update regularly, I have not been working on an Android project in the last couple of months, so wouldn't have noticed the breaking changes immediately.

As requested:

  • adb shell pm list packages uk.co.enidata.enidata25

  • adb shell pm list users

  • adb shell run-as uk.co.enidata.enidata25 ls

    • run-as: Package 'uk.co.enidata.enidata25' is unknown
  • adb shell run-as uk.co.enidata.enidata25 pwd .

    • run-as: Package 'uk.co.enidata.enidata25' is unknown
  • adb shell run-as uk.co.enidata.enidata25 readlink -f .

    • run-as: Package 'uk.co.enidata.enidata25' is unknown
  • android:InstallLocation

    • preferInternal

Thanks for your clear instructions and help

@JREnitial

Hmm interesting. The package is installed but the run-as command on the device cannot see it. What device is this? Which API Level is it running?

I'm digging through the run-as code [here] (https://github.com/aosp-mirror/platform_system_core/blob/34a0e57a257f0081c672c9be0e87230762e677ca/run-as/run-as.cpp). Trying to figure out what the problem is. It is entirely possible that the manufacturer has disabled the run-as command for some reason, but that is not normally the error you get if that is the case.

One other thing I can suggest based on the code if you try adding the following from the Developer Command Prompt.

msbuild enidata25_Mobile.Android.csproj  /restore /t:Install /bl /p:AndroidDeviceUserId=0 

I'm not 100% sure if the AndroidDeviceUserId property made it into 16.9.x but its worth a try.

You can disabled Fast deployment and still debug on that device by setting EmbedAssembliesIntoApk to true, that will at least allow you to continue to work.

@dellis1972

Device is a Samsung Galaxy Tab Active running Android 5.1.1.

Updated Developer Command Prompt build command had same issue.

Disabling Fast Deployment indeed allows me to continue to work, so that is something.

Not sure where we are in resolving the issue (if in deed possible) for users where it should work, but isn't, but I am happy to try things from my end as they are suggested, to try and find out why it doesn't work any more.

Thanks again.

Device is a Samsung Galaxy Tab Active running Android 5.1.1.

Bingo. You'll notice earlier in the thread my own discovery that "run as" is not implemented correctly on Samsung Galaxy S-series devices before the Samsung Galaxy S8+ on Android 9 (API 28). Your Samsung Galaxy Tab Active running Android 5.1.1 also does not implement "run as" correctly.

Unfortunately we need to buy new dev devices, get used to not using Fast Deploy or use the emulator because Google changed the file system and Samsung didn't implement Android properly.

Just a heads up, we are working on a backup plan for older devices. See https://github.com/xamarin/xamarin-android/pull/5775 there are some downsides to that approach and there is still allot of work to do on the Fast Deployment stuff in monodroid (an internal repo). But we are working on it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rubo picture rubo  路  3Comments

mathiasnielsen picture mathiasnielsen  路  4Comments

EDMIStephen picture EDMIStephen  路  4Comments

jonpryor picture jonpryor  路  4Comments

jonpryor picture jonpryor  路  3Comments