--> -->

skimemo


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


#blog2navi()
*NativeScript androidX対応時の処理 [#t13bd26f]

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

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

** 2019/8/28追記 [#m4759d9d]
素直にNativeScript6.0に上げるのが良いかも。

#htmlinsert(twitterbutton.html)
RIGHT:Category: &#x5b;[[NativeScript>日記/Category/NativeScript]]&#x5d; - 15:17:15
----
RIGHT:&blog2trackback();
#comment(above)
#blog2navi()