简体   繁体   中英

Ionic build Android failed parse error

I have a problem with Ionic build Android: When I try to build my app with Android platform, I get a error

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

when I run command:

>ionic build android 

I have this error:

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"

How can I do to solve this problem? Thank you for your help.

Note: try with K 1.7.0_80 , it's not working

There is not specific error logs what you mentioned that shows any error with your code.

There may be some ionic/cordova configuration miss-match while add platform.

please remove and add platform with one of following code and try for work again.

1) cordova platform rm android and cordova platform add android

or

2) ionic platform rm android and ionic platform add android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM