4

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.

Community
  • 1
  • 1
Bill The Ape
  • 3,261
  • 25
  • 44
  • 1
    As for the .aidl files, they only generate .java classes into gen -folder (same place as R.java for the project). It should be removed on project clean but double checking shouldn't do any harm. – harism Jan 12 '12 at 00:05
  • @harism Thanks for the tip. I'll check this but I suspect a nastier problem than just `.aidl` because it now complains about an `EditPreferences` file that really exists only one of the library projects. I may have done something I don't recall while duplicating the project. I hate IDEs with hysteresis... +1 for now. – Bill The Ape Jan 12 '12 at 00:13
  • @harism OK I checked and the .java class resulting from the .aidl isn't in any of the gen folders (multiple library projects). I temporarily remvoed the .aidl file, so this is OK. What I discovered, however, is that the `EditPreferences` file now being complained about, is the 1st .java in a Library project used by 2 other library projects. This used to work flawlessly. What happened? – Bill The Ape Jan 12 '12 at 00:22
  • Unfortunately I have no idea what has happened. It sounds like there's some "thrash" left on actual build directory but I don't know Android SDK well enough to tell where it is. Only idea I can come up with is to ask, when you cleaned your project, did you check "clean all projects" radio button? – harism Jan 12 '12 at 00:44
  • 1
    @harism Of course I did. I even tried disabling auto rebuild, cleaning all, existing Eclipse, restarting Eclipse, then re-enabling auto rebuild - to no avail. This **unpredictable** behavior of the Android development tools (Eclipse+SDK+ADT) is becoming more and more [frustrating](http://stackoverflow.com/a/7884908/1124861). – Bill The Ape Jan 12 '12 at 00:53
  • I'd say it's more of a question about OS you're running Eclipse + Android SDK on than development tools themselves. At least based on a few comments I've read I'm glad I'm developing on other than Windows myself. – harism Jan 12 '12 at 01:10
  • 1
    @harism Eclipse/Java should be OS-neutral. In reality it isn't. But I don't think this is the source problem here. The source of the problem is that Google doesn't let you control configuration management of your development environment. If you want to change one tiny thing, you can't - you must change everything with it. This makes it impossible to know what changed, to speed up troubleshooting. Agrrrr... – Bill The Ape Jan 12 '12 at 03:12

2 Answers2

6

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!

Community
  • 1
  • 1
Bill The Ape
  • 3,261
  • 25
  • 44
  • Related: the only problem is that you can't export library in self-contained JAR file for use in multiple workspaces (you always need to reference library source). Anyways, thanks for documenting your journey and answering your own question - links you left help a lot. – nikib3ro Feb 05 '13 at 23:34
1

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