【发布时间】:2016-06-21 01:05:59
【问题描述】:
我在使用 Ionic build 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,它不起作用
【问题讨论】:
-
您是否尝试过删除平台并再次添加然后进行构建?
-
我删除了平台并再次添加,然后再次构建。 ==> 建立成功。问题已解决。
-
那么结果如何?
-
建立成功。谢谢你的想法。
-
哇哦.. 很高兴为您提供帮助。 :) 我可以回答它并且您批准作为答案吗? ;)
标签: java android cordova build ionic-framework