i have just a blank project with prime31 google play game services plugin in it and im trying to run the demo scene and i keep getting this error, i feel like its something simple like setting environment variables or something, any help is greatly appreciated thank you
Error building Player: CommandInvokationFailure: Unable to convert
classes into dex format. See the Console for details. C:Program Files
(x86)Javajdk1.7.0_51binjava.exe -Xmx1024M
-Dcom.android.sdkmanager.toolsdir="C:/Users/John P. Rowan III/android-sdkstools" -Dfile.encoding=UTF8 -jar "C:/Program Files
(x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayersdktools.jar" -
stderr[
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic
(00051607) or version (0000.0002) 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:665) at
com.android.dx.command.dexer.Main.processFileBytes(Main.java:634) at
com.android.dx.command.dexer.Main.access$600(Main.java:78) at
com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572) 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.processDirectory(ClassPathOpener.java:229)
at
com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at
com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596) at
com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) at
com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) at
com.android.dx.command.dexer.Main.run(Main.java:230) at
com.android.dx.command.dexer.Main.main(Main.java:199) at
com.android.dx.command.Main.main(Main.java:103) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
SDKMain.main(SDKMain.java:129) ...while parsing
__MACOSX/com/google/android/gms/ads/._a.class
1 error; aborting
Interesting as for environment variables, no, that will only help you find files that are missing, in this case we have a parsing error in your plugin.
There are multiple things you can try to resolve it, one weird thing i notice in the log was the path to java: C:Program Files (x86)Javajdk1.7.0_51binjava.exe There are no dashes "\" in the path, might be wrong but that might be neeeded.
Secondly, if you open the project in eclipse and try to compile it from there, if it still gets you error's you might want to contact prime31 for support, since this is a parsing error in the code, which you can see from the log.
"UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.cf.iface.ParseException: bad class file magic " means that there are lines or characters in places that do not belong there.
Related
I have a Xamarin Forms (1.3-pre1) application, which needs to integrate with Office 365. In my Android project, my build breaks when I reference the NuGet package in subject (https://www.nuget.org/packages/Microsoft.Office365.OAuth.Xamarin/)
After this package is referenced, I get following error at the end of my build:
3> UNEXPECTED TOP-LEVEL EXCEPTION:
3> java.lang.IllegalArgumentException: already added: Landroid/support/v4/util/TimeUtils;
3> at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
3> at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
3> at com.android.dx.command.dexer.Main.processClass(Main.java:732)
3> at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
3> at com.android.dx.command.dexer.Main.access$300(Main.java:82)
3> at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
3> at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
3> at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
3> at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
3> at com.android.dx.command.dexer.Main.processOne(Main.java:632)
3> at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
3> at com.android.dx.command.dexer.Main.runMonoDex(Main.java:279)
3> at com.android.dx.command.dexer.Main.run(Main.java:245)
3> at com.android.dx.command.dexer.Main.main(Main.java:214)
3> at com.android.dx.command.Main.main(Main.java:106)
3> 1 error; aborting
3>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1243,3): error MSB6006: "java.exe" exited with code 1.
3>Done executing task "CompileToDalvik" -- FAILED.
3>Done building target "_CompileDex" in project "KwhApp.Forms.Android.csproj" -- FAILED.
3>
3>Build FAILED.
Removing the package reference, I get my build to complete instead.
Anyone having the same issue? Any suggestion?
Ah ok. I checked with the engineering folks, and they're aware of the issue. Details (and a workaround) here: http://chakkaradeep.com/index.php/getting-started-with-office-365-apis-and-xamarin-projects/.
I had that problem after update android packages.
My solution was opening packages.config in Android project and remove android support v4 from xml:
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid70" />
After that, I go to package folder. and add it again from nuget. When I do that, new Android packages was added. And project build and run again.
Hope this help.
I just started trying to use Felix with Android. I followed the instruction at Apache Felix homepage (http://felix.apache.org/site/apache-felix-framework-and-google-android.html), but failed at very first steps.
After setting path for Android SDK, I executed this command:
dx --dex --output=classes.dex felix.jar
But the exception came out:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.io.FileNotFoundException: felix.jar (The system cannot find the file specif
ied)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.zip.ZipFile.<init>(ZipFile.java:158)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:206)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:422)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
at com.android.dx.command.dexer.Main.run(Main.java:209)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
1 error; aborting
I am sure that the file felix.jar was there. This is what I got from dir command:
Directory of D:\QuangND\OSGi\felix-framework-4.2.1\bin
08/30/2013 11:11 AM <DIR> .
08/30/2013 11:11 AM <DIR> ..
03/08/2013 10:19 PM 529,233 felix.jar
1 File(s) 529,233 bytes
2 Dir(s) 198,324,461,568 bytes free`
What is problem here? Thank you very much! (Sorry for my bad English :()
OK, I solved this problem. I need to start dx command from where it located (in sdk/platform-tools), not everywhere
When I try to compile (not execute) one of my projects, I recently get the following error:
Tool /usr/bin/java execution started with arguments: -jar /Applications/android-sdk-mac_x86/platform-tools/lib/dx.jar --no-strict --dex --output=obj/Debug/android/bin/classes.dex obj/Debug/android/bin/classes /Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8/mono.android.jar FlurryAnalytics/Jars/FlurryAgent.jar Jars/android-support-v4.jar
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
at com.android.dx.rop.code.RegisterSpecSet.<init>(RegisterSpecSet.java:49)
at com.android.dx.rop.code.RegisterSpecSet.mutableCopy(RegisterSpecSet.java:383)
at com.android.dx.ssa.LocalVariableInfo.mutableCopyOfStarts(LocalVariableInfo.java:169)
at com.android.dx.ssa.LocalVariableExtractor.processBlock(LocalVariableExtractor.java:104)
at com.android.dx.ssa.LocalVariableExtractor.doit(LocalVariableExtractor.java:90)
at com.android.dx.ssa.LocalVariableExtractor.extract(LocalVariableExtractor.java:56)
at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:50)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:99)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
at com.android.dx.command.dexer.Main.processClass(Main.java:487)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:422)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
at com.android.dx.command.dexer.Main.run(Main.java:209)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
Other projects build as expected. I think I need to increase the heap size for this java build step? But how?
There is an option in Xamarin Studio to increase the Java Heap Size.
Project Options -> Android Build -> Advanced -> Java Heap Size.
This suggestion did the trick:
$ export _JAVA_OPTIONS="-Xmx1g"
$ /Applications/MonoDevelop.app/Contents/MacOS/MonoDevelop
I have a few jar files in my project. Flurry, Maps and Newtonsoft... aparently this is enough to bomb the build.
Thanks to the awesome Xamarin Support team for their quick response and pointing out the solution! They are working on reducing the needed memory footprint for external jars.
I have created an android application that uses android-support-v4.jar.
Now when I add an android library to this project I get this error when building:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;
[2012-11-08 16:02:31 - ShoppingApp Android] Conversion to Dalvik format failed with error 1
The library I'm trying to add is Facebook SDK, which also happens to use android-support-v4.jar.
Only solution for this error I found was removing library from one of build paths, but I can't do it - all options all disabled when I select this jar.
Here is full error trace:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
at com.android.dx.command.dexer.Main.processClass(Main.java:486)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:418)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:180)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:703)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:577)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1000)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
[2012-11-08 16:02:31 - ShoppingApp Android] Dx 1 error; aborting
[2012-11-08 16:02:31 - ShoppingApp Android] Conversion to Dalvik format failed with error 1
The build process checks the checksum of every jar and raises this error if the jar is found twice and the jars have different checksums.
This means you have the same library twice but two different versions of the jar file, which doesn't make sense.
If you added a library project, you don't need the support library in your app, you can delete it as it is inherited from the project library.
You might want to update the jar of the support library into the library project.
Edit: you don't play with the build path anymore, your libraries folders should be "libs" and it will appear in the project as "Android dependencies". Then you remove the jar from your libs folder of your app, and maybe update the one from the library project.
This error means that you have some classes included more than once in your build. I've solved quite the same problem with mvn dependencies in eclipse by unchecking "Export maven decencies" in Project configuration/Java Build Path/Export.
I am trying to run Emma on the tests for an Android project that is a combination of Java and C/JNI code. The build and tests work fine, but whenever I add emma, I get a mysterious exception. I'm using the Android SDK v20.1 and NDK r8b.
The project is here, its an Android library project:
https://github.com/guardianproject/IOCipher
and the tests are here:
https://github.com/guardianproject/IOCipherTests
The build.xml file is generated using android update test-project. Running ant clean debug install test works everytime while ant clean emma debug install test triggers the exception:
here's the exception:
-dex:
[dex] Converting compiled files and external libraries into /var/lib/jenkins/workspace/IOCipherTests/IOCipherTests/bin/classes.dex...
[dx]
[dx] EXCEPTION FROM SIMULATION:
[dx] local variable type mismatch: attempt to set or access a value of type int using a local variable of type info.guardianproject.libcore.io.ErrnoException. This is symptomatic of .class transformation tools that ignore local variable information.
[dx]
[dx] ...at bytecode offset 0000002e
[dx] locals[0000]: Linfo/guardianproject/iocipher/File;
[dx] locals[0001]: Linfo/guardianproject/iocipher/FileDescriptor;
[dx] locals[0002]: <invalid>
[dx] locals[0003]: <invalid>
[dx] locals[0004]: <invalid>
[dx] locals[0005]: [Z
[dx] stack[top0]: int{0x00000001 / 1}
[dx] ...while working on block 002c
[dx] ...while working on method createNewFile:()Z
[dx] ...while processing createNewFile ()Z
[dx] ...while processing info/guardianproject/iocipher/File.class
[dx]
[dx] 1 error; aborting
BUILD FAILED
/opt/android-sdk/tools/ant/build.xml:850: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:852: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:864: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:266: null returned: 1
I was getting the same error. In my project we had a unit test app in one project, which wrapped another project containing the unit tests themselves. Both projects held references to my SDK which, as chaitanya suggested, was causing emma to instrument the SDK code twice. By removing the reference to the SDK in the unit test project I was able to resolve the error.
I build the Android APK project from the command line (without ant, but with some help of CMake. I guess this is not important here) and I met the same error, two things helped me:
From here, I got the info that "If you instrument class files that have local variable debug information in them emma does not correctly maintain the local variable table. This will cause an error when you try to convert the class files for Android. The workaround for this to compile the java classes with only line and source debug information, not local information.", so I add a flag to java compiler-g:{lines,source}
I also excluded Emma classes itself from instrumentation. My instrumentation command is java -cp emma/emma_device.jar emma instr -ix -*.test.*,-com.google.android.*,-com.vladium.* -m overwrite -cp ${CMAKE_JAVA_TARGET_OUTPUT_DIR}. Pay attention to -ix -com.vladium.* parameter, this excludes Emma classes