rive-flutter icon indicating copy to clipboard operation
rive-flutter copied to clipboard

[NDK] [Build Failed] A problem occurred configuring project ':rive_common'.

Open RoyalCoder88 opened this issue 2 years ago • 9 comments

I'm using rive 0.11.1, and I'm not able to build on Android, with the error:

[CXX1104] NDK from ndk.dir at C:\Program Files\Unity\Hub\Editor\2022.2.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK had version [23.1.7779620] which disagrees with android.ndkVersion [25.1.8937393]
[CXX1104] NDK from ndk.dir at C:\Program Files\Unity\Hub\Editor\2022.2.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK had version [23.1.7779620] which disagrees with android.ndkVersion [25.1.8937393]
[CXX1104] NDK from ndk.dir at C:\Program Files\Unity\Hub\Editor\2022.2.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK had version [23.1.7779620] which disagrees with android.ndkVersion [25.1.8937393]

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':rive_common'.
> [CXX1104] NDK from ndk.dir at C:\Program Files\Unity\Hub\Editor\2022.2.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK had version [23.1.7779620] which disagrees with android.ndkVersion [25.1.8937393]

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

flutter --version

Flutter 3.10.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9cd3d0d9ff (7 days ago) • 2023-05-23 20:57:28 -0700
Engine • revision 90fa3ae28f
Tools • Dart 3.0.2 • DevTools 2.23.1

flutter doctor -v

[√] Flutter (Channel stable, 3.10.2, on Microsoft Windows [Version 10.0.22621.1702], locale en-GB)
    • Flutter version 3.10.2 on channel stable at C:\tools\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9cd3d0d9ff (7 days ago), 2023-05-23 20:57:28 -0700
    • Engine revision 90fa3ae28f
    • Dart version 3.0.2
    • DevTools version 2.23.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\burac\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.4.33213.308
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2021.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[√] VS Code (version 1.78.2)
    • VS Code at C:\Users\burac\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.64.0

[√] Connected device (4 available)
    • SM A908B (mobile) • RFCMA02W5WT • android-arm64  • Android 12 (API 31)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.22621.1702]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 113.0.5672.127
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 113.0.1774.42

[√] Network resources
    • All expected network resources are available.

RoyalCoder88 avatar May 30 '23 23:05 RoyalCoder88

Hi @RoyalCoder88, you'll need to update the NDK version in your Android app, see here: https://github.com/rive-app/rive-flutter/blob/master/platform_considerations.md#android

Please also make sure that CMake is up to date on your Windows system, see here: https://github.com/rive-app/rive-flutter/blob/master/platform_considerations.md#windows

HayesGordon avatar May 31 '23 09:05 HayesGordon

Hi @HayesGordon , thanks for the quick reply, but I can't update the NDK because Unity widget depends on this specific NDK version :( thanks!

RoyalCoder88 avatar May 31 '23 18:05 RoyalCoder88

Having the same issue.. : ( Still no solution ?

ben55j avatar Jun 29 '23 18:06 ben55j

same issues still

user97116 avatar Jul 18 '23 11:07 user97116

Having same problem with integration with Unity

@RoyalCoder88 did you have temporarily solution?

kcbuilder avatar Jul 23 '23 20:07 kcbuilder

any news ?

Joseph-Nathan avatar Aug 10 '23 21:08 Joseph-Nathan

any news ?

nothing works for me still :(

ShadrackOngera avatar Aug 14 '23 04:08 ShadrackOngera

I manage to find two workarounds:

  1. use a wrapper to wrap Android native SDK, here is the poc: https://pub.dev/packages/rive_mobile tested in our project and it does work. but don't have time (and my not worth it) to use federated plugin so iOS can still use flutter version. Otherwise, iOS native version will require iOS 14 or above (which still ok). this workaround does work but only support Android and iOS and will have to manually wrap function needed, not a scalable way. If anyone want to go further with the method, feel free to clone or submit PR to https://github.com/onlifeltd/rive_mobile.

  2. In our case it is conflict with Unity flutter NDK r23 requirement. Manage to update unityLibrary/build.gradle line 11 (ish) from

ndkVersion = rootProject.ext.ndkVersion

to

ndkVersion = 23.1.7779620

so unityLibrary project doesn't force main project to use NDK r23, and main project can use NDK 25.1.8937393 that rive ask for.

But come with http version conflict that already fix there but not released in latest nor prerelease (as in 21 Aug 2023). Have to walk around it with your own risk. We simply dependency_overrides http version to 1.11.0, full regression test still in pipeline to verify the impact for all these workarounds.

river2202 avatar Aug 21 '23 01:08 river2202

In case this is useful to anyone else, an alternative workaround I'm using is to use an older version of rive (version 0.8.4 or earlier) which targets NDK 23.1.7779620. Unfortunately this older version depends on an old version of http which caused a dependency conflict in my project, so you may have to fork it to updated the dependencies. And of course you can't take advantage of any features added to rive after 0.8.4

jamesncl avatar May 22 '24 12:05 jamesncl