Search Issue Tracker

Active

Under Consideration for 2020.3.X, 2021.3.X, 2022.2.X, 2023.1.X, 2023.2.X

Votes

0

Found in

2020.3.41f1

2021.3.15f1

2022.1.24f1

2022.2.0f1

2023.1.0a20

2023.2.0a1

Issue ID

UUM-20217

Regression

No

Android IL2CPP build fails when the project contains native plugins that use NDK APIs that are available in the project's minimum API level but not available in API 22

--

-

Steps to reproduce:
1. Open the attached user's project "AndroidNdkApiLevel26.zip"
2. Make sure that Android is selected as the platform
3. Make sure that IL2CPP scripting backend and minimum API level is 26 or higher are selected
4. Build the Android Player
5. Observe the error in the Console

Expected results: build doesn't fail
Actual results: android IL2CPP build fails when the project contains native plugins that use NDK APIs that are available in the project's minimum API level but not available in API 22

Reproducible on: 2020.3.41f1, 2021.3.15f1, 2022.1.24f1

Not reproducible on: 2022.2.0f1, 2023.1.0a23

Notes:
-There are additional IL2CPP linker flags set in ProjectSettings.asset, do not remove them. They are needed to link against the NDK libraries
-When building a Unity project for Android with IL2CPP as the scripting backend, the API level passed to the C compiler and linker is fixed at 22, even if the project's minimum API level is higher. This causes the build to fail when the project contains native plugins that use NDK APIs that are available in the project's minimum API level but not available in API 22
-Error that gets outputted:
Building Library\Bee\artifacts\Android\d8kzr\v1kj_tivePlugin.o failed with output:
D:\Cases\AndroidNdkApiLevel26\AndroidNdkApiLevel26\Library\Bee\artifacts\Android\il2cppOutput\cpp\NativePlugin.cpp(5,5): error: use of undeclared identifier 'AImageReader_newWithUsage'
AImageReader_newWithUsage(
^

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.