Adding java files with Ant
Monkey Targets Forums/Android/Adding java files with Ant
| ||
Hi all, I just integrate Pubnub for Android and ran into problems with the pubnub packages. Basically I have now several .java files (the pubnub packages) which I want to compile together with the Monkeygame.java. The compiler tells me: -compile: [javac] Compiling 2 source files to D:\Projekte\pubnub\test.build\android\bin\classes [javac] D:\Projekte\pubnub\test.build\android\src\com\codeknitters\test3d\MonkeyGame.java:40: package pubnub does not exist [javac] import pubnub.Pubnub; [javac] ^ which is obvious as it's not in the path. I just have the pubnub files parallel in the native folder in the modules section. |
| ||
I faced the same problem yesterday. I created two .jave files in the native folder of the module. And I got the same error for only one of them. Where did you list your import line? in the native monkey file or in another java file? |
| ||
I tried several things. If I put it parallel to my monkey interface file: #If( TARGET = "android" ) Import "native/src/pubnub/Callback.java" Import "native/src/pubnub/MD5.java" Import "native/src/pubnub/Pubnub.java" #End If Import "native/mnet.${TARGET}.${LANG}" I get that error: -compile: [javac] d:\Programme\Android\android-sdk\tools\ant\build.xml:600: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [javac] Compiling 2 source files to E:\Projekte\pubnub\test.build\android\bin\classes [javac] E:\Projekte\pubnub\test.build\android\src\com\monkey\MonkeyGame.java:2096: class, interface, or enum expected [javac] package pubnub; [javac] ^ [javac] E:\Projekte\pubnub\test.build\android\src\com\monkey\MonkeyGame.java:2119: class, interface, or enum expected [javac] package pubnub; [javac] ^ For now I just copy the stuff from the several Java files into one and it works. But of course it would be nice to have the original ones separated... |
| ||
Yeah, this is what I did as well. Should this be considered a bug? |
| ||
No, I don't think it's a bug, it's just the way Java "works" and one of the reasons I never fell in love with Java. ;) All this path stuff is a real mess in Java. I think it's just a problem with the name of the package and where it is relative to the other ones. I think the build.xml has to be modified for Ant... |