I'm having BUILD FAILED everytime I try to build using phonegap build android --release. Here's what I get by adding --verbose,
BUILD FAILED
Total time: 5.791 secs
Command finished with error code 1: cmd /s /c ""D:\Phonegap Projects\Project - GAMEHOBEY\GameHobe-final\platforms\android\gradlew.bat" cdvBuildRelease -b "D:\Phonegap Projects\Project - GAMEHOBEY\GameHobe-final\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true"
(node:3344) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
Dex: Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:775)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:741)
at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1683)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:695)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:321)
at com.android.dx.command.dexer.Main.run(Main.java:292)
at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:173)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:787)
at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722)
at com.android.dx.command.dexer.Main.processClass(Main.java:773)
... 16 more
1 error; aborting
I'm not sure how can I fix this.
Related
I'm trying to make an APK of a web app, I wrapped it into Cordova.
I followed various tutorials, installed Gradle and made it work.
When i run cordova build android ---verbose from CMD, I get this error:
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\USER\AppData\Local\Android\sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
Running command: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew cdvBuildDebug -b C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\build.gradle
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
Command finished with error code 1: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew cdvBuildDebug,-b,C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\build.gradle
C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
Error: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
at ChildProcess.whenDone (C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\node_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:310:20)
at ChildProcess.cp.emit (C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\node_modules\cordova-common\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
Using Gradle 6.3
I tried a lot of tutorials and StackOverflow solution, but none of them work for me.
My gradle-wrapper.properties
Tue Oct 16 17:39:45 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=C:\Users\USER\Downloads\gradle-6.3-bin.zip
I am using gradle 5.1.1 for cordova9.0.
There is no problems.
I have a problem when I generate signed Apk file in Android studio. I get a messages below:
Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
Error:1 error; aborting
:app:transformClassesWithDexForRelease FAILED
Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_67\bin\java.exe'' finished with non-zero exit value 1
I use proguard in build gradle:
classpath 'com.android.tools.build:gradle:2.1.0'
I was searching through many existing answers, but it's not worked.
I refer this topic, but i can not find anything like this.
When try to use gradlew assembleRelease, I find the message:
Cause: java.lang.RuntimeException: Exception parsing classes
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:761)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:727)
at com.android.dx.command.dexer.Main.access$1200(Main.java:87)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1655)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:681)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:578)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:315)
at com.android.dx.command.dexer.Main.run(Main.java:286)
at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:52)
at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1511)
at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1507)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.dx.cf.iface.ParseException: name already added: string{"a"}
at com.android.dx.cf.direct.AttributeListParser.parse(AttributeListParser.java:156)
at com.android.dx.cf.direct.AttributeListParser.parseIfNecessary(AttributeListParser.java:115)
at com.android.dx.cf.direct.AttributeListParser.getEndOffset(AttributeListParser.java:96)
at com.android.dx.cf.direct.MemberListParser.parse(MemberListParser.java:213)
at com.android.dx.cf.direct.MemberListParser.parseIfNecessary(MemberListParser.java:108)
at com.android.dx.cf.direct.FieldListParser.getList(FieldListParser.java:54)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:536)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:773)
at com.android.dx.command.dexer.Main.access$1600(Main.java:87)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1694)
at com.android.dx.command.dexer.Main.processClass(Main.java:758)
... 17 more
Caused by: java.lang.IllegalArgumentException: name already added: string{"a"}
at com.android.dx.rop.annotation.Annotation.add(Annotation.java:208)
at com.android.dx.cf.direct.AnnotationParser.parseAnnotation(AnnotationParser.java:264)
at com.android.dx.cf.direct.AnnotationParser.parseAnnotations(AnnotationParser.java:223)
at com.android.dx.cf.direct.AnnotationParser.parseAnnotationAttribute(AnnotationParser.java:152)
at com.android.dx.cf.direct.StdAttributeFactory.runtimeVisibleAnnotations(StdAttributeFactory.java:632)
at com.android.dx.cf.direct.AnnotationParser.parseAnnotations(AnnotationPa
at com.android.dx.cf.direct.AnnotationParser.parseAnnotationAttribute(Anno
at com.android.dx.cf.direct.StdAttributeFactory.runtimeVisibleAnnotations(
at com.android.dx.cf.direct.StdAttributeFactory.parse0(StdAttributeFactory
at com.android.dx.cf.direct.AttributeFactory.parse(AttributeFactory.java:9
at com.android.dx.cf.direct.AttributeListParser.parse(AttributeListParser.
... 30 more
1 error; aborting
:app:transformClassesWithDexForRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.proce
s.ProcessException: Return code 1 for dex process
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug op
BUILD FAILED
I tried create new project and copy all gradle, proguard-pro and it build ok.
I don't know why?
What can be other possible solution please ?
I am trying to integrate DHIS2 SDK into my app by trying to import the library project.
My settings.gradle looks like
include ':app', ':sdk', ':core', ':persistence', ':core-java', ':models'
project(':sdk').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/app')
project(':core').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/core')
project(':persistence').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/persistence')
project(':core-java').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/core-java')
project(':models').projectDir = new File(settingsDir, '../dhis2-android-sdk-master/models')
Now after the gradle sync when I try to run the app it gives me the following build error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:752)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:672)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
at com.android.dx.command.dexer.Main.processClass(Main.java:749)
... 12 more
1 error; aborting
Error:Execution failed for task ':app:preDexDebug'.
> 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
Any idea how can I solve this?
I have tried to add a library (odata4j) in Android Studio 1.1.0.
I used the Project Structure:
When Gradle started to sync, it gave me this error:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find org.eclipse.persistence:eclipselink:2.1.2.
Searched in the following locations:
https://jcenter.bintray.com/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.pom
https://jcenter.bintray.com/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.jar
file:/C:/Users/Nestor/AppData/Local/Android/sdk/extras/android/m2repository/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.pom
file:/C:/Users/Nestor/AppData/Local/Android/sdk/extras/android/m2repository/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.jar
file:/C:/Users/Nestor/AppData/Local/Android/sdk/extras/google/m2repository/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.pom
file:/C:/Users/Nestor/AppData/Local/Android/sdk/extras/google/m2repository/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.jar
Required by:
MyApp:app:unspecified > org.odata4j:odata4j-dist:0.7.0 > org.odata4j:odata4j-core:0.7.0
So, to take care of it, I searched for eclipselink in the library dependency selector:
After I added it, Gradle could sync but on compile, I get another error:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
...while parsing org/eclipse/persistence/internal/indirection/jdk8/IndirectCollectionsProvider.class
1 error; aborting
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
It seems, eclipselink uses Java 8 so it can't work together with my Java 7 Android application.
What should I do to make this work?
I got an error while compiling my libgdx project with gradle.
Execution failed for task ':android:preDexAmazonDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/SDK-PATH/Android/build-tools/21.0.1/dx --dex --output /PATH/android/build/intermediates/pre-dexed/Amazon/debug/core-1.0-47e2423a0159bad5774996683a8ab834009ab7ed.jar /PATH/core/build/libs/core-1.0.jar
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:82)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:279)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
...while parsing org/mars3142/OwnClass.class
1 error; aborting
I didn't include core twice into my Android project. I double checked, if I include some external libs, but it seems, that my own project is the failure, which I can't understand, because I never changed something. I only added an android-wear project into my project. And if I go back into time (with git), it also is not compileable.
EDIT: If I hit run in IntelliJ for the same build variant (AmazonDebug) it works like expected. That's really strange.