[转载] Cordova build android failure: A problem occurred evaluating project ':app'
今天用 WebStorm
搭建了个 cordova
项目, 准备开发一个 套壳 web网站的
android app`.
执行 cordova build android
命令报错:
error log
Microsoft Windows [版本 10.0.18363.959]
(c) 2019 Microsoft Corporation。保留所有权利。
C:\reps\CordovaDemo\app>cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\reps\CordovaDemo\app\platforms\android\app\build.gradle' line: 20
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter
* 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 20s
C:\reps\CordovaDemo\app\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\reps\CordovaDemo\app\platforms\android\app\build.gradle' line: 20
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter
* 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 20s
C:\reps\CordovaDemo\app>
后面百度找到这篇文章: https://blog.csdn.net/m0_37220818/article/details/104070867 解决了。
再次执行,输出成功构建的日志
success log
C:\reps\CordovaDemo\app>cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
> Configure project :app
Unable to initialize metrics, ensure C:\Program Files (x86)\Android\android-sdk is writable, details: C:\Program Files (x86)\Android\android-sdk\analytics.settings (�ܾ����ʡ�)
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms\android-25\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms\android-27\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms\android-28\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms\android-25\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms\android-27\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms\android-28\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\tools\package.xml. Probably the SDK is read-only
> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :CordovaLib:checkDebugManifest
> Task :CordovaLib:processDebugManifest
> Task :app:preDebugBuild
> Task :CordovaLib:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :CordovaLib:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript
> Task :app:checkDebugManifest
> Task :app:generateDebugBuildConfig
> Task :app:prepareLintJar
> Task :app:generateDebugSources
> Task :CordovaLib:compileDebugRenderscript
> Task :CordovaLib:generateDebugBuildConfig
> Task :CordovaLib:generateDebugResValues
> Task :CordovaLib:generateDebugResources
> Task :CordovaLib:packageDebugResources
> Task :CordovaLib:generateDebugRFile
> Task :CordovaLib:prepareLintJar
> Task :CordovaLib:generateDebugSources
> Task :CordovaLib:javaPreCompileDebug
> 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
> Task :app:processDebugResources
> Task :app:compileDebugJavaWithJavac
> Task :app:compileDebugNdk NO-SOURCE
> Task :app:compileDebugSources
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders
> Task :app:generateDebugAssets
> Task :CordovaLib:mergeDebugShaders
> Task :CordovaLib:compileDebugShaders
> Task :CordovaLib:generateDebugAssets
> Task :CordovaLib:packageDebugAssets
> Task :app:mergeDebugAssets
> Task :app:validateSigningDebug
> Task :app:signingConfigWriterDebug
> Task :app:transformClassesWithDexBuilderForDebug
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug
> Task :app:transformDexArchiveWithDexMergerForDebug
> Task :app:mergeDebugJniLibFolders
> Task :CordovaLib:compileDebugNdk NO-SOURCE
> Task :CordovaLib:mergeDebugJniLibFolders
> Task :CordovaLib:transformNativeLibsWithMergeJniLibsForDebug
> Task :CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug
> Task :app:transformNativeLibsWithMergeJniLibsForDebug
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:transformResourcesWithMergeJavaResForDebug
> Task :app:packageDebug
> Task :app:assembleDebug
> Task :app:cdvBuildDebug
BUILD SUCCESSFUL in 1m 14s
42 actionable tasks: 42 executed
Built the following apk(s):
C:\reps\CordovaDemo\app\platforms\android\app\build\outputs\apk\debug\app-debug.apk
C:\reps\CordovaDemo\app>
转载正文
报这个错误:A problem occurred evaluating project ':app'
解决这个问题就是把 android
下面 build.gradle
中的 com.android.tools.build:gradle:3.2.1
改成 com.android.tools.build:gradle:3.3.2
这个即可
这是老外的解答,挺详细的,原因就是flutter升级版本不一致导致的
转载地址
https://blog.csdn.net/m0_37220818/article/details/104070867
PS: 我是 com.android.tools.build:gradle:3.3.0
改成 com.android.tools.build:gradle:3.3.2
解决的。
作者:VAllen
出处:http://www.cnblogs.com/vallen
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
唯有偏执者得以生存。
出处:http://www.cnblogs.com/vallen
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
唯有偏执者得以生存。