gpt4 book ai didi

android - 用cordova构建android

转载 作者:行者123 更新时间:2023-12-03 05:47:00 27 4
gpt4 key购买 nike

我有一个 ionic 移动应用程序,我一直在为 IOS 和 android 构建它。
但我不得不从我的电脑中删除 android studio,然后我重新安装它。
而现在,我无法构建 android!我收到了这个错误:

What went wrong: A problem occurred evaluating root project 'android'.

Failed to apply plugin [id 'com.android.application'] Minimum supported Gradle version is 4.1. Current version is 3.3. If using the gradle wrapper, try editing the distributionUrl in /Users/lamatatwany/Downloads/wesalApp/gradle/wrapper/gradle-wrapper.properties to gradle-4.1-all.zip



我试图将 gradle 版本更改为最新版本并得到另一个错误...

有人可以帮我解决这个问题。

Cordova 要求输出:

Requirements check results for android: Java JDK: installed 1.8.0 Android SDK: installed true Android target: installed android-27,android-26,android-24,android-23 Gradle: installed /Applications/Android Studio.app/Contents/gradle/gradle-4.4/bin/gradle

Requirements check results for ios: Apple OS X: installed darwin Xcode: installed 9.2 ios-deploy: not installed ios-deploy was not found. Please download, build and install version 1.9.0 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy' CocoaPods: installed (node:39026) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Some of requirements check failed (node:39026) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.



当我在 GradleBuilder.js 中更新这一行时:

var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\://services.gradle.org/distributions/gradle-3.3-all.zip';



到 gradle-4.4-all.zip,出现以下错误:

BUILD FAILED in 1m 13s (node:39180) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /Users/lamatatwany/downloads/wesalapp/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':compileDebugJavaWithJavac'.

    Could not resolve all task dependencies for configuration ':debugCompileClasspath'. Could not resolve project :CordovaLib. Required by: project : Project : declares a dependency from configuration 'debugCompile' to configuration 'debug' which is not declared in the descriptor for project :CordovaLib.



  • 添加安卓版本7:

    Installing "cordova-plugin-file-transfer" for android Plugin dependency "cordova-plugin-file@4.3.3" already fetched, using that version. Dependent plugin "cordova-plugin-file" already installed on android. Installing "cordova-plugin-filepath" for android Installing "cordova-plugin-image-picker" for android Installing "cordova-plugin-iroot" for android Failed to install 'cordova-plugin-iroot': Error: ENOENT: no such file or directory, open '/Users/lamatatwany/Downloads/wesalapp/platforms/android/AndroidManifest.xml' at Object.fs.openSync (fs.js:646:18) at Object.fs.readFileSync (fs.js:551:33) at Object.parseElementtreeSync (/Users/lamatatwany/Downloads/wesalapp/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27) at new AndroidManifest (/Users/lamatatwany/Downloads/wesalapp/platforms/android/cordova/lib/AndroidManifest.js:29:20) at AndroidProject.getPackageName (/Users/lamatatwany/Downloads/wesalapp/platforms/android/cordova/lib/AndroidProject.js:99:12) at Api.addPlugin (/Users/lamatatwany/Downloads/wesalapp/platforms/android/cordova/Api.js:223:57) at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:594:10) at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28 at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54) at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)

最佳答案

你的cordova-android版本很旧。当前版本是 7.0.0 .
这经历了许多变化来处理 android 项目结构和 gradle 的变化。

尝试:

ionic cordova platform update android

否则删除平台,然后添加:
ionic cordova platform add android@latest

或者
ionic cordova platform add android@7.0.0

关于android - 用cordova构建android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49551800/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com