Conversion to Dalvik format failed with error 1 -

2019-02-24 04:07发布

I only added to an existing fully working project, the file com/android/vending/billing/IMarketBillingService.aidl

(I didn't add anything else (from the market_billing sample) yet, since I am not even trying to use the service yet)

It compiles and builds perfectly, but when I try to run it, I receive the following in the console:

java.lang.IllegalArgumentException: already added: Lcom/android/vending/billing/IMarketBillingService$Stub$Proxy;
Dx  at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
Dx  at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
Dx  at com.android.dx.command.dexer.Main.processClass(Main.java:486)
Dx  at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
Dx  at com.android.dx.command.dexer.Main.access$400(Main.java:67)
Dx  at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
Dx  at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
Dx  at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
Dx  at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
Dx  at com.android.dx.command.dexer.Main.processOne(Main.java:418)
Dx  at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
Dx  at com.android.dx.command.dexer.Main.run(Main.java:206)
Dx  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Dx  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
Dx  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Dx  at java.lang.reflect.Method.invoke(Unknown Source)
Dx  at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
Dx  at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:745)
Dx  at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:634)
Dx  at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
Dx  at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
Dx  at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
Dx  at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:282)
Dx  at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
Dx  at org.eclipse.core.internal.resources.Project$1.run(Project.java:545)
Dx  at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
Dx  at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:524)
Dx  at org.eclipse.core.internal.resources.Project.build(Project.java:123)
Dx  at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:961)
Dx  at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:146)
Dx  at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
Dx  at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
Dx  at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:924)
Dx  at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1128)
Dx  at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Dx 3 errors; aborting
Conversion to Dalvik format failed with error 1

Any idea why this is happening?

Note: This added .aidl file is not an external jar, so the answer here doesn't help in my case.

Update: I removed that suspicious .aidl file, clean the project, but the problem didn't go away. Weird.

Update: I knew it! I just tried running an existing project that used to run perfectly before I "upgraded" the SDK from 9 to 16 and I get the same error there as well. I knew I should have avoided that "upgrade". Now I have to waste time on troubleshooting a problem that shouldn't have been there until I upgrade according to plan, not when I am forced to, without being able to do a planned & controlled migration. App release delayed...

Update: There seems to be a connection to the buggy automatic conversion from default.properties to project.properties but despite me correcting all conversion errors manually, the problem still persists. I am now left with no development environment. This is ridiculous.

2条回答
\"骚年 ilove
2楼-- · 2019-02-24 04:29

Problem finally solved, using this solution from the amazing @TheTerribleSwiftTomato .

This was all caused by "Changes to Library Projects in Android SDK Tools, r14".

Thank you @Google for making my life so miserable. If you introduce a radical change in the system's behavior, don't force me to "upgrade" from SDK 9 to SDK 16 when I am not ready yet to gobble up all the information that comes with it (or at least, issue an error message that can point directly to this change).

On the other hand, truly thank you @Google for introducing the long awaited, much yearned for, feature that generates each library project into its own JAR file. This is a true life saver, which is only available from SDK Tools r14 on. Wow!

查看更多
Melony?
3楼-- · 2019-02-24 04:41

if you are using cocos2dx. Simply issue is that your workspace is not configure with android sdk. just make a new workspace or existing workspace configure with your IDE (eclipse or android studio).it work for me

查看更多
登录 后发表回答