paddybyers/anode

Building ANode

gentijo opened this issue · 5 comments

I am trying to build the anode project and I have a few questions as well as running into an error.

I am building the project under Eclipse Juno, with an updated SDK r17 and NDK r8d running on OS/X.

What I have done so far.
I built the node project in , which builds and runs fine. In I then did a git clone https://github.com/paddybyers/anode.git and imported any existing projects into Eclipse that existed in

This resulted in the following projects, app, bridge-java, bridge-stub-generator, libnode, and sdk.

Most all the projects compiled fine except for bridge-stub-generator which failed because of the following error but I am assuming that the bridge-stub-generator is not a run-time requirement.

The constructor InterfaceManager(ClassLoader, boolean) is undefined StubGen.java    /bridge-stub-generator/src/org/meshpoint/anode/stub/util    line 153* 

When I try to run App, I get the following error.

[2013-04-20 23:39:38 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/meshpoint/anode/AndroidContext;
[2013-04-20 23:39:38 - app] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/meshpoint/anode/AndroidContext;

The question I have is, how is the node project connected as a dependency to the ANode project ?

Thank you
John Gentilin

The node project is a dependency only on the native side. If you got as far as building libjninode.so then the node dependencies are all OK.

You're correct that the stub generator doesn't need to be part of the runtime.

The app project builds with bridge-java and libnode as source dependencies. I've seen that paritcular error before and I think it's to do with how those projects are made to be dependencies of the app project. If you can't find a solution I'll set up a clean environment and see if I can replicate your problem, but essentially you need to set up the build path for app and link the src directories for both of those other projects. Don't depend on them as projects.

I solved this same error for myself by

  1. Ensuring that my Java Compiler settings in Eclipse (Project Settings, Java Compiler, Compliance Level) was set to 1.6 for all projects.
  2. For the bridge-java project, the Java Build Path was set to Java1.6SE (Project Settings, Java Build Path, select JRE, click Edit, select Execution Environment of JavaSE-1.6.

I'm not an Eclipse expert, but this worked for me to get anode compiling above and beyond the build instructions on the wiki. I am running on Open-jdk7 amd64, Ubuntu 12.10 x64, using the ADT v21.1.0-569685

Daniel, I was hopeful there for a second. After a fresh checkout and import into Eclipse I noticed that the app and libnode projects came up as default with project specific settings for 1.6 compliance, then the bridge-java and sdk projects imported with workspace default settings, which in my case was 1.7. So I set up my Eclipse workspace to use JDK 1.6 then rebuilt the whole workspace.. Unfortunately, same problem.

Most of the references on stackoverflow referenced something about referring one or more libraries twice at different versions.. So I started poking around some more. I then noticed that the App project reefers to the lib node as a dependent library in the Android settings and it also has the same code included in the project as a linked folder with the name libnode_src. I deleted the linked folder from the project and it ran.

So bottom line, the JDK compliance settings seem odd and may cause another issue, but the thing that fixed for me was deleting the linked folder, libnode_src, in the App project.

-John Gentilin

What is the other issue you are seeing when you set your compliance settings to 1.6?

I think setting the execution environment made the actual difference for me to be able to build the project, but I may be mistaken there.

I was assuming that having 4 projects somewhat dependent on each other, 2 with project specific settings and 2 with workspace wide settings that there could be a problem. I don't think it was causing me a problem but I haven't changed it back once I deleted the linked folder. I think the duplicate code issue with the linked folder can be different based on the SDK version, host platform, etc.

I am just getting into how this whole project works, once I have reviewed the code some more I will start another "how it works" thread with some specific questions / assumptions.