我如何在 nativescript 版本更改后正确构建我的 android 应用程序
How do i properly build my android app after nativescript version change
我在构建 nativescript android 应用程序时遇到错误
我正在使用 NativeScript 5.2 开发 Android 应用程序。然而,我的一位同事使用 NativeScript 6 git 推送到开发分支。我将其拉出并进行了 tns 迁移,但无法再构建它。它一直显示 Command gradlew.bat failed with exit code 1.
我试过将我的 NativeScript 升级到他的版本,我也试过还原 NativeScript 和 git 分支,但它仍然显示相同的错误。
错误代码:
Gradle build...
+ setting applicationId
+ applying user-defined configuration from C:\Users\Le\Documents\Work\work-app-investor\app\App_Resources\Android\app.gradle
+ using support library version 28.0.0
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-background-http\platforms\android\nativescript_background_http.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-camera\platforms\android\nativescript_camera.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-fingerprint-auth\platforms\android\nativescript_fingerprint_auth.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-loading-indicator\platforms\android\nativescript_loading_indicator.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-material-textfield\platforms\android\nativescript_material_textfield.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-pager\platforms\android\nativescript_pager.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-plugin-firebase\platforms\android\firebase-release.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-plugin-firebase\platforms\android\nativescript_plugin_firebase.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-material-core\platforms\android\nativescript_material_core.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
C:\Users\Le\Documents\Work\work-app-investor\platforms\android\app\src\main\AndroidManifest.xml:22:18-91 Error:
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.1.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:25:2-47:16 to override.
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.1.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:25:2-47: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 2s
Unable to apply changes on device: 8DQCIF45VCSOTOYH. Error is: Command gradlew.bat failed with exit code 1.
您应该首先检查您的插件是否支持 AndroidX - 根据您的构建消息,您似乎有一些。
通常您只需要在 package.json
中更新它们,执行 tns platform clean android
并重新构建。
我在构建 nativescript android 应用程序时遇到错误
我正在使用 NativeScript 5.2 开发 Android 应用程序。然而,我的一位同事使用 NativeScript 6 git 推送到开发分支。我将其拉出并进行了 tns 迁移,但无法再构建它。它一直显示 Command gradlew.bat failed with exit code 1.
我试过将我的 NativeScript 升级到他的版本,我也试过还原 NativeScript 和 git 分支,但它仍然显示相同的错误。
错误代码:
Gradle build...
+ setting applicationId
+ applying user-defined configuration from C:\Users\Le\Documents\Work\work-app-investor\app\App_Resources\Android\app.gradle
+ using support library version 28.0.0
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-background-http\platforms\android\nativescript_background_http.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-camera\platforms\android\nativescript_camera.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-fingerprint-auth\platforms\android\nativescript_fingerprint_auth.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-loading-indicator\platforms\android\nativescript_loading_indicator.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-material-textfield\platforms\android\nativescript_material_textfield.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-pager\platforms\android\nativescript_pager.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-plugin-firebase\platforms\android\firebase-release.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-plugin-firebase\platforms\android\nativescript_plugin_firebase.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\nativescript-material-core\platforms\android\nativescript_material_core.aar
+ adding aar plugin dependency: C:\Users\Le\Documents\Work\work-app-investor\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
C:\Users\Le\Documents\Work\work-app-investor\platforms\android\app\src\main\AndroidManifest.xml:22:18-91 Error:
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.1.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:25:2-47:16 to override.
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.1.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:25:2-47: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 2s
Unable to apply changes on device: 8DQCIF45VCSOTOYH. Error is: Command gradlew.bat failed with exit code 1.
您应该首先检查您的插件是否支持 AndroidX - 根据您的构建消息,您似乎有一些。
通常您只需要在 package.json
中更新它们,执行 tns platform clean android
并重新构建。