android - Compile MAUI .NET 9 project with external DLL - Stack Overflow

I have a .NET 9 MAUI project, targeting Android devices only, built with Visual Studio 2022 17.13.5.Af

I have a .NET 9 MAUI project, targeting Android devices only, built with Visual Studio 2022 17.13.5.

After adding a reference to a third-party DLL, I cannot compile in Debug configuration because of this error:

Errore (attivo) XAAMM0000   C:\myProject\obj\Debug\net9.0-android35.0\AndroidManifest.xml:14:225-250 Error:
    Attribute application@debuggable value=(true) from AndroidManifest.xml:14:225-250
    is also present at AndroidManifest.xml:15:9-35 value=(false).
    Suggestion: add 'tools:replace="android:debuggable"' to <application> element at AndroidManifest.xml:14:3-31:17 to override.    myProject (net9.0-android35.0)  C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.39\tools\Xamarin.Android.Common.targets    1561

Following the suggestion, I added the ,android:debuggable attribute to my AndroidManifest.xml manifest and the projects compiles.

The situation in Release mode is the opposite: I cannot compile the project if I leave there the attribute, but it compiles if I remove it.

Errore (attivo) AMM0000 
    tools:replace specified at line:14 for attribute android:debuggable, but no new value specified
C:\repos\myProject\myProject\obj\Release\net9.0-android35.0\AndroidManifest.xml

Error:
        Validation failed, exiting myProject (net9.0-android35.0)   C:\repos\myProject\myProject\obj\Release\net9.0-android35.0\AndroidManifest.xml 14      
    
Errore (attivo) XAAMM0000   C:\repos\myProject\myProject\obj\Release\net9.0-android35.0\AndroidManifest.xml:14:3-31:17

Error:
        tools:replace specified at line:14 for attribute android:debuggable, but no new value specified
    C:\repos\myProject\myProject\obj\Release\net9.0-android35.0\AndroidManifest.xml

Error:
        Validation failed, exiting  myProject (net9.0-android35.0)  C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.39\tools\Xamarin.Android.Common.targets    1561    

Now, I was expecting that the debuggable attribute would have been automatically replaced based on the configuration, but this doesn't happen in Release mode.

How can I solve this? Is there a way, in Release mode, to either:

  1. Replace with false the ,android:debuggable value
  2. Remove the ,android:debuggable attribute

I have a .NET 9 MAUI project, targeting Android devices only, built with Visual Studio 2022 17.13.5.

After adding a reference to a third-party DLL, I cannot compile in Debug configuration because of this error:

Errore (attivo) XAAMM0000   C:\myProject\obj\Debug\net9.0-android35.0\AndroidManifest.xml:14:225-250 Error:
    Attribute application@debuggable value=(true) from AndroidManifest.xml:14:225-250
    is also present at AndroidManifest.xml:15:9-35 value=(false).
    Suggestion: add 'tools:replace="android:debuggable"' to <application> element at AndroidManifest.xml:14:3-31:17 to override.    myProject (net9.0-android35.0)  C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.39\tools\Xamarin.Android.Common.targets    1561

Following the suggestion, I added the ,android:debuggable attribute to my AndroidManifest.xml manifest and the projects compiles.

The situation in Release mode is the opposite: I cannot compile the project if I leave there the attribute, but it compiles if I remove it.

Errore (attivo) AMM0000 
    tools:replace specified at line:14 for attribute android:debuggable, but no new value specified
C:\repos\myProject\myProject\obj\Release\net9.0-android35.0\AndroidManifest.xml

Error:
        Validation failed, exiting myProject (net9.0-android35.0)   C:\repos\myProject\myProject\obj\Release\net9.0-android35.0\AndroidManifest.xml 14      
    
Errore (attivo) XAAMM0000   C:\repos\myProject\myProject\obj\Release\net9.0-android35.0\AndroidManifest.xml:14:3-31:17

Error:
        tools:replace specified at line:14 for attribute android:debuggable, but no new value specified
    C:\repos\myProject\myProject\obj\Release\net9.0-android35.0\AndroidManifest.xml

Error:
        Validation failed, exiting  myProject (net9.0-android35.0)  C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.39\tools\Xamarin.Android.Common.targets    1561    

Now, I was expecting that the debuggable attribute would have been automatically replaced based on the configuration, but this doesn't happen in Release mode.

How can I solve this? Is there a way, in Release mode, to either:

  1. Replace with false the ,android:debuggable value
  2. Remove the ,android:debuggable attribute
Share Improve this question asked Mar 28 at 7:58 MAXEMAXE 5,1542 gold badges50 silver badges65 bronze badges 3
  • a reference to a third-party DLL .. what exactly is this? does it contains it's own AndroidManifest.xml? – Bhavanesh N Commented Mar 28 at 9:22
  • @BhavaneshN I just references it adding it to the project references, it doesn't have an AndroidManifest.xml – MAXE Commented Mar 28 at 10:04
  • @LiyunZhang-MSFT sorry I didn't get your question...it is a MAUI project. How can I set it? – MAXE Commented Mar 31 at 10:22
Add a comment  | 

1 Answer 1

Reset to default 0

Did you check your AndroidManifest.xml? The first error means that the debuggable property has different value in AndroidManifest.xml or the other dependency' Manifest. And this made the gradle can't merge the Manifest automatically. So you can use tools:replace="android:debuggable" to fix it.

And the second error means that when you used tools:replace="android:debuggable", you have to set the new value for android:debuggable. Such as:

<manifest xmlns:android="http://schemas.android/apk/res/android"
          xmlns:tools="http://schemas.android/tools">
      <application android:debuggable="true" tools:replace="android:debuggable" ....

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744049508a4549812.html

相关推荐

  • android - Compile MAUI .NET 9 project with external DLL - Stack Overflow

    I have a .NET 9 MAUI project, targeting Android devices only, built with Visual Studio 2022 17.13.5.Af

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信