--> -->

skimemo


skimemo - 日記/2019-08-20/NativeScript androidX対応時の処理

_ NativeScript androidX対応時の処理

NativeScriptでandroid向けのビルドをした際に、突然以下のエラーが出ました。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
        is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
        Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:22:2-43:16 to override.

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

* Get more help at https://help.gradle.org

BUILD FAILED in 16s
Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.

androidx対応時には環境の設定が必要なようです。 参考ページの通り、以下のコマンドを発行して無事ビルドが通るようになりました。

> npm install tns-core-modules@androidx --save-exact
> tns platform add android@androidx

参考: https://stackoverflow.com/questions/56686814/nativescript-build-fails-with-error-manifest-merger-failed

tns platform remove androidでplatformを初期化した後には再度必要なようですので注意が必要です。

_ 2019/8/28追記

素直にNativeScript6.0に上げるのが良いかも。

Category: [NativeScript] - 15:17:15



 
Last-modified: 2019-08-28 (水) 20:07:50 (1693d)