gpt4 book ai didi

java - Ionic 构建 Android 失败解析错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:30:10 25 4
gpt4 key购买 nike

我在 Ionic 构建 Android 时遇到问题:当我尝试时使用 Android 平台构建我的应用程序时,出现错误

***Config:***
NodeJS 4.4.5
Ionic 1.7.15
JDK 1.8.0_65
target=android-23

当我运行命令时:

>ionic build android 

我有这个错误:

D:\ionic\MyInstitutBat>ionic build android
Running command: D:\Tools\nodejs\node.exe D:\ionic\MyInstitutBat\hooks\after_prepare\010_add_platform_class.js D:\ionic\MyInstitutBat
add to body class: platform-android
ANDROID_HOME=D:\Tools\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources
:generateDebugSources
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk UP-TO-DATE
:compileDebugSources UP-TO-DATE
:transformClassesWithDexForDebug
PARSE ERROR:
unsupported class file version 52.0
...while parsing com/ionicframework/starter/BuildConfig.class

PARSE ERROR:
unsupported class file version 52.0
...while parsing com/ionicframework/starter/MainActivity.class

PARSE ERROR:
unsupported class file version 52.0
...while parsing com/ionicframework/starter/R.class

PARSE ERROR:
unsupported class file version 52.0
...while parsing com/ionicframework/starter/R$attr.class

PARSE ERROR:
unsupported class file version 52.0
...while parsing com/ionicframework/starter/R$drawable.class

PARSE ERROR:
unsupported class file version 52.0
...while parsing com/ionicframework/starter/R$string.class

PARSE ERROR:
unsupported class file version 52.0
...while parsing com/ionicframework/starter/R$xml.class
7 errors; aborting

FAILED


BUILD FAILED

Total time: 2 mins 23.749 secs
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit
value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: Error code 1 for command: cmd with args: /s,/c,"D:\ionic\MyInstitutBat\platforms\android\gradlew cdvBuildDebug -b D:\ionic\MyInstitutBat\platforms\android\build.gradle -Dorg.gradle.d
aemon=true -Pandroid.useDeprecatedNdk=true"

我该如何解决这个问题?感谢您的帮助。

注意:尝试使用 K 1.7.0_80,它不起作用

最佳答案

没有您提到的具体错误日志显示您的代码有任何错误。

添加平台时可能会出现一些 ionic/cordova 配置不匹配的情况。

请使用以下代码之一删除并添加平台,然后再次尝试工作。

1) cordova platform rm android and cordova platform add android

or

2) ionic platform rm android and ionic platform add android

关于java - Ionic 构建 Android 失败解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37934083/

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