当前位置: 首页 > 知识库问答 >
问题:

使用Ionic 3构建android应用程序时出现错误

公良莫希
2023-03-14

我有一个基于Ionic v3构建的项目。通常它是工作的,但是一段时间过去了,现在它抛出了一个错误。

当前配置如下所示:

ionic info

Ionic:

   Ionic CLI          : 5.0.3 (C:\Users\volkk\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.3

Cordova:

   Cordova CLI       : not installed
   Cordova Platforms : android 7.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.2, (and 16 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (C:\android)
   NodeJS            : v10.15.1 (C:\Program Files\nodejs\node.exe)
   npm               : 6.7.0
   OS                : Windows 10

我收到以下错误:

Execution failed for task ':app:processDebugResources'.

我试图在应用程序/构建中更改版本。gradle,但这对我帮助不大。

我仍然相信有一些版本不匹配,因为一些更新...当然,我会尝试自己解决这个问题,但是当我这样做的时候,也许你可以给我一个关于如何解决这个问题的好建议。

这是一个完整的构建日志:https://pastebin.com/zah1samG

更新:我安装了一个名为cordova-android-support port-gradle-释放的插件,现在我收到以下错误:

> Task :CordovaLib:javaPreCompileDebug

Note: C:\Users\volkk\Downloads\Install\work\new\vagrant-php-box\sites\mobile application\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :CordovaLib:compileDebugJavaWithJavac

> Task :CordovaLib:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
> Task :app:javaPreCompileDebug
> Task :app:mainApkListPersistenceDebug
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:mergeDebugResources
> Task :app:createDebugCompatibleScreenManifests

> Task :app:processDebugManifest
C:\Users\volkk\Downloads\Install\work\new\vagrant-php-box\sites\mobile application\platforms\android\app\src\main\AndroidManifest.xml:24:9-31:50 Warning:
        activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present

> Task :app:processDebugResources

C:\Users\volkk\Downloads\Install\work\new\vagrant-php-box\sites\mobile application\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginInstanceIDService.java:6: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceIdService;
> Task :app:compileDebugJavaWithJavac FAILED
                              ^

更新2:

我已经更新了我所有的东西,现在看起来像:

$ ionic info

Ionic:

   Ionic CLI          : 5.0.3 (C:\Users\volkk\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : not installed
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.2, (and 18 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (C:\android)
   NodeJS            : v10.15.1 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

以下是已安装插件的列表:

$ ionic cordova plugins list
> cordova.cmd plugin ls

You have been opted out of telemetry. To change this, run: cordova telemetry on.
com-sarriaroman-photoviewer 1.1.18 "PhotoViewer"
cordova-android-support-gradle-release 3.0.0 "cordova-android-support-gradle-release"
cordova-background-geolocation 2.12.3-beta.1 "BackgroundGeolocation"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-cocoapod-supportx 1.6.1 "Cordova CocoaPods Dependency Support"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-filepath 1.0.2 "FilePath"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-qrscanner 2.6.0 "QRScanner"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 3.2.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"

但是我的构建仍然失败。

以下是生成日志:https://pastebin.com/L7JDayfd

如果我使用cordova插件firebasex,我会体验到类似的行为。

以下是生成日志:https://pastebin.com/FRMuKqhv

$ ionic cordova plugins list
> cordova.cmd plugin ls

You have been opted out of telemetry. To change this, run: cordova telemetry on.
com-sarriaroman-photoviewer 1.1.18 "PhotoViewer"
cordova-android-support-gradle-release 3.0.0 "cordova-android-support-gradle-release"
cordova-background-geolocation 2.12.3-beta.1 "BackgroundGeolocation"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-cocoapod-supportx 1.6.1 "Cordova CocoaPods Dependency Support"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-filepath 1.0.2 "FilePath"
cordova-plugin-firebasex 2.0.7 "Google Firebase Plugin"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-qrscanner 2.6.0 "QRScanner"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 3.2.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"

P、 美国:如果我卸载插件cordova plugin androidx和cordova plugin firebasex,则构建成功,但google play服务无法正常工作。

共有1个答案

丰飞龙
2023-03-14

当我添加所有三个插件时,问题解决了。

cordova插件firebasex

cordova-插件-android x

cordova插件androidx适配器

感谢评论:https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503135862

我的当前配置:

ionic info

Ionic:

   Ionic CLI          : 5.0.3 (C:\Users\volkk\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.2, (and 19 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (C:\android)
   NodeJS            : v10.15.1 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10


ionic cordova plugins list
> cordova.cmd plugin ls
com-sarriaroman-photoviewer 1.1.18 "PhotoViewer"
cordova-background-geolocation 2.12.3-beta.1 "BackgroundGeolocation"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 5.4.1 "CDVBackgroundFetch"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-cocoapod-supportx 1.6.1 "Cordova CocoaPods Dependency Support"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-filepath 1.5.5 "cordova-plugin-filepath"
cordova-plugin-firebasex 2.1.0 "Google Firebase Plugin"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-qrscanner 3.0.1 "QRScanner"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 3.2.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
 类似资料:
  • 错误:无法运行“javac-version”,请确保已安装JDK。您可以从以下网站获得:http://www.oracle.com/technetwork/java/javase/downloads.您的JAVA\u主页无效:C:\Program Files\JAVA\jdk1。8.0_172

  • 然后我尝试“Cordova build Android”并收到以下错误: 错误:在构建android项目时发生了一个错误。请安装Android Target17(Android最新SDK)。确保你也安装了最新的Android工具。从命令行运行“Android”来安装/更新任何丢失的SDK或工具。 所以我运行了“Android”,安装了与目标17相关的一切。 有什么想法/建议吗?

  • 1-我安装了PushWoosh:cordova插件添加https://github.com/PushWoosh/pushwoosh-phoneGap-3.0-plugin.git 2-PushWoosh代码: 3-构建项目时使用:cordova build android 生成失败/users/newAccount/opt/android-sdk/tools/ant/BUILD.xml:892:执

  • 当我构建我的应用程序时,我遇到以下错误,请帮助。 运行应用程序时没有错误,制造战争时出错。

  • 我创建了一个phonegap项目,并通过以下方式添加了android平台http://docs.phonegap.com/en/4.0.0/guide_cli_index.md.html#The此文档的命令行界面。当我尝试使用以下命令构建它时: cordova build或cordova build android 我得到了这个错误。