dotnet / dotnet/android

_CreateAar step fails if you also have native libraries intended for Linux

Open
#8,466 3 comments 0 reactions 2 assignees Assigned to @dellis1972 View on GitHub
Area: App+Library Build bug
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 20h
Merged PRs (30d)
257

Description

### Android application type

.NET Android (net7.0-android, etc.)

### Affected platform version

.NET 7.0.308

### Description

Given an SDK project targeting:

```xml
netstandard2.1;net6.0-ios;net6.0-android
```

And intended to be used on Android **but also Linux**, with native libraries, having the following structure:

```
libs
├── android
│   ├── arm64-v8a
│   │   └── lib.so
│   ├── armeabi-v7a
│   │   └── lib.so
│   ├── x86
│   │   └── lib.so
│   └── x86_64
│   └── lib.so
└── linux
├── linux-aarch64
│   └── lib.so
└── linux-x86_64
└── lib.so
```

Trying to build it, it fails with the given error, during the `_CreateAar ` step

```
libs/linux/linux-aarch64/lib.so : error XA4301: Cannot determine ABI of native library 'libs/linux/linux-aarch64/lib.so'. Move this file to a directory with a valid Android ABI name such as 'libs/armeabi-v7a/'.
libs/linux/linux-x86_64/lib.so : error XA4301: Cannot determine ABI of native library 'libs/linux/linux-x86_64/lib.so'. Move this file to a directory with a valid Android ABI name such as 'libs/armeabi-v7a/'.
```

Even excluding the files has no effect.

```

```

### Steps to Reproduce

1. Create a `Microsoft.NET.Sdk` project targeting `net6.0-android`
2. Create the `libs` structure defined in the description.
3. Try to build and notice the failure.

### Did you find any workaround?

Just dirty hacks to be used around the `_CreateAar` step to avoid these being identified by the pattern `libs/[arch]/*.so`

### Relevant log output

```shell
libs/linux/linux-aarch64/lib.so : error XA4301: Cannot determine ABI of native library 'libs/linux/linux-aarch64/lib.so'. Move this file to a directory with a valid Android ABI name such as 'libs/armeabi-v7a/'.
libs/linux/linux-x86_64/lib.so : error XA4301: Cannot determine ABI of native library 'libs/linux/linux-x86_64/lib.so'. Move this file to a directory with a valid Android ABI name such as 'libs/armeabi-v7a/'.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.