Archived

This forum has been archived. Please start a new discussion on GitHub.

Ice 3.4.1 + IceAndroid 0.1.1 + Eclipse

Hi! I'm student from a Spanish university and when I try to mix all the stuff that I said in the topic title, it crashes.

I mean, when I tried to add the IceAndroid.jar to the new android project, there are a few libraries that they don't exists in the IceAndroid.jar but with the Ice.jar it doesn't happens.

the point is, if I try to execute any line of Ice code without the IceAndroid.jar, always crashes.

I tried to merge the both jars in only one but it doesn't work too.

Any ideas?

PS: I work with Ubuntu 9.10 Eclipse Galileo.

Comments

  • matthew
    matthew NL, Canada
    You cannot mix both Ice 3.4.1 and the Ice for Android jar. On Android you must use Ice for android, not regular Ice.

    Do the Ice android demos work for you? If not, then please describe the issue in full detail. If they do work, then you should look for differences between your project and the demos.
  • It doesn't work neither, I've already tried :( I forgot to posted it. It's the same fail. And also I've tried with regular Ice, Ice for Android and my useless jar file.

    It's like there are a missing library or a missing class in the Ice for Android jar file.

    Tomorrow morning I'll try to reproduce the fail and detail all the info than I can take like screenshots, traces and so :) (I'm not in the campus right now)

    I appreciate so much all this help !


    PS (I):

    And by the way, when you try to install IceAndroid with Ice 3.4.1, it's impossible because it looks for Ice 3.3.1. I guess that I can fix it creating a new link with this name (Something like Ice.3.3.1->Ice.jar)

    I suppose that because I hadn't install the 3.3.1 version, I've installed directly the 3.4.1 v.

    PS (II):
    Sorry if my english it's not propied, but it's hard to explain myself exactly than I want to do it in spanish :o
  • There are a few screen shots about my problem :)
  • matthew
    matthew NL, Canada
    Did you follow the directions in the README? Particularly the following:
    5. Your workspace is configured with a linked resource that allows
        the sample projects to locate the Ice for Android run time JAR
        file. Perform the following steps to add the resource:
    
        1. In Eclipse, choose Window->Preferences
        2. Open the General->Workspace folder
        3. Select the Linked Resources entry
        4. Click New... to add a new path variable
        5. Enter ICE_JAR_HOME in the Name field
        6. Enter the path name <IceAndroid-install>/java/lib in the Location
           field, such as C:\IceAndroid-0.1.1\java\lib on Windows or
           /opt/IceAndroid-0.1.1/java/lib on Linux.
        7. Click OK to save the path variable
    
        It is not necessary to define this resource in your own projects,
        and you can remove it as soon as you are finished using the sample
        projects.
    
  • I did it time ago, but I did it again today, and this is what I got
    [2010-11-01 06:57:37 - HelloWorld]
    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.IllegalArgumentException: already added: LGlacier2/AMD_Router_createSession;
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.command.dexer.Main.processClass(Main.java:299)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:276)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.command.dexer.Main.access$100(Main.java:56)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:228)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.command.dexer.Main.processOne(Main.java:245)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.dx.command.dexer.Main.run(Main.java:139)
    [2010-11-01 06:57:37 - HelloWorld] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [2010-11-01 06:57:37 - HelloWorld] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [2010-11-01 06:57:37 - HelloWorld] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [2010-11-01 06:57:37 - HelloWorld] at java.lang.reflect.Method.invoke(Method.java:597)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.ide.eclipse.adt.internal.sdk.DexWrapper.run(Unknown Source)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.ide.eclipse.adt.internal.build.PostCompilerHelper.executeDx(Unknown Source)
    [2010-11-01 06:57:37 - HelloWorld] at com.android.ide.eclipse.adt.internal.build.PostCompilerBuilder.build(Unknown Source)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
    [2010-11-01 06:57:37 - HelloWorld] at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
    [2010-11-01 06:57:37 - HelloWorld] 1 error; aborting
    [2010-11-01 06:57:37 - HelloWorld] Conversion to Dalvik format failed with error 1

    I had this error when I tried to put in the same build path Ice-3.4.1.jar and IceAndroid.jar.

    I tried to clean the project and re-built again but I get the same error!
  • matthew
    matthew NL, Canada
    What is your build path now? You should not put both the Ice jars and the android jars in the build path, nor should put the Android jar manually in the build path; the plugin does all that for you.

    I recommend that you first get the demos that accompany the Ice for Android distribution working out of the box without any changes before you try and create your own project.
  • Hi Matthew, thanks for your help again!

    I tried to import directly the demo project of the Ice for android downloaded file. It doesn't work neither. (I did File->New->Project->Android Project->Create project from an existing source)

    Is this what you mean when you said: "get the demos that accompany the Ice for Android distribution working out of the box" ?

    I only added the project to my workspace, I did touch nothing!

    In the screenshot that I'm sending, shows that there are a missing library or something similar. You can see that the ICE_JAR_HOME is correct!


    PD: I get rid off the last error. I was because I double added the IceAndroid.jar. My fault. :o
  • Well, I've tried another thing but it doesn't work neither.

    When I configure the build path correctly, there are a few classes that they are missing(I've attached the ".jar" file with the missing classes that I found on the Ice.jar, not in the IceAndroid.jar and the hello project need them!)

    When I solved all the dependencies of the project adding to the IceAndroid.jar file the missing classes, there is only one error. This one:

    "Cannot instantiate the type OutgoingAsync".

    It happens in this part of HelloPrxHelper.java

    private Ice.AsyncResult begin_sayHello(int delay, java.util.Map<String, String> __ctx, boolean __explicitCtx, IceInternal.CallbackBase __cb)
    {
    IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __sayHello_name, __cb);
    try
    {
    __result.__prepare(__sayHello_name, Ice.OperationMode.Idempotent, __ctx, __explicitCtx);
    IceInternal.BasicStream __os = __result.__os();
    __os.writeInt(delay);
    __os.endWriteEncaps();
    __result.__send(true);
    }
    catch(Ice.LocalException __ex)
    {
    __result.__exceptionAsync(__ex);
    }
    return __result;
    }

    And in the "Ice.AsyncResult begin_shutdown" too. The methods colored in red said that this method is not implemented for this arguments. I guess that it's for adding the regular Ice libraries.

    Any ideas??
  • matthew
    matthew NL, Canada
    private Ice.AsyncResult begin_sayHello(int delay, java.util.Map<String, String> __ctx, boolean __explicitCtx, IceInternal.CallbackBase __cb)
    

    This is incorrect. The problem here is that you have your slice2java plugin configuration pointing at Ice 3.4.x not at the Ice 3.3.1 SDK. You can fix that in your Slice2java Eclipse preferences and change "SDK Location" to point to the correct location.
  • It means that I'm not able to use the Ice-3.4.1 for Android? I'm going to try this!
  • matthew
    matthew NL, Canada
    It shouldn't be a big surprise :) It is plastered all over the pages and documentation that Ice 3.3 is required. Since Ice for Android is a labs product, we haven't taken the time yet to update it to the latest version of Ice (and Android for that matter). Its possible that it works with the latest version of Android, but we haven't fully tested it so use at your own discretion.
  • Yeah! I knew it, but I understood that "Ice 3.3 is required = Ice 3.4 should work" and It don't seems haha.

    I'm trying to compile de DB Berkeley for install Ice 3.3.

    When I try with the 3.3 version I'll tell to you!
  • matthew
    matthew NL, Canada
    If you use one of the supported platforms it shouldn't be necessary to compile anything to install Ice.
  • That's the point, I'm using Ubuntu :o

    But I've got a huge mess with the libraries and all the stuff. I started to trying in Windows Vista, and for the moment it works...

    I'll post in 15 minutes my impressions :)
  • Well, I can execute Ice code under Android :) But it fails. I'll try to explain a little.

    First of all, I've tried this code between 2 computers and it works!

    I've got a regular pc server running in 192.168.205.196 in tcp with port 60000. Just the Hello sample in Ice.

    I try to connect the Android device with the other computer and it crashes a lot.

    I'll send the Activity Class, the Interface, and the error Log.

    I'm going crazy with this!:confused:
  • matthew
    matthew NL, Canada
    The key piece of information is this:
     Caused by: java.net.SocketException: Permission denied (maybe missing INTERNET permission)
    

    That means the requested permissions are incorrect for the Android application (missing INTERNET). We tried the hello demo on a Mac with Android 2.1 and it worked, so I'm not 100% sure what issue you are running into. Check your manifest permission contents to ensure that INTERNET is present. In AndroidManifest.xml something like:
    <manifest xlmns:android...>
     ...
     <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    </manifest>
    
  • I've got good news ,bad news and big news.

    I finally tried the hello demo app, and I've got a few suggestions for the README file in IceAndroid(in a couple of hours I'll send here)

    The bad news are that I didn't understand so much the code and I couldn't making it work, but I'm starting to study the 3 demo projects for making the mine :)

    And the great news are in the image attached :)
  • Hi,

    I'm also trying to test AndroidIce with Android SDK 1.1 r1.
    Normally we should use ADT 0.8.0 with Android SDK 1.1 r1 but it is no more available for download from official website.
    With the last one (ADT 0.9.9), no targets are found in "Android SDK 1.1 r1" directory.

    How to get ADT 0.8.0 ?

    Thanks,
    Fernand
  • The ADT plugin is provided by Google so I don't really know. Try asking in developers.google.es forums.

    By the way, you must try it with Ice 3.3.1, no 3.4.1

    I tried Ice 3.3.1, IceAndroid 0.1.1, SDK 1.6 and it works!
  • Thanks Israel. For SDK 1.6, do you mean Android SDK 1.6 r1 ? And what ADT are you using ?
  • Thanks a lot Israel. That's much better :)
    Using Android SDK 1.6 + ADT 0.9.9.
  • I'm having similar problems

    I'm using Ice 3.4.1 and its Java translator (slice2java). The Eclipse plugin works fine, apparently, and if I create a "desktop" Java project using the Ice.jar for 3.4.1, it works nice.

    But trying to use IceAndroid 0.1.1, the translator generates a lot of code incompatible, apparently, with IceAndroid 0.1.1.

    For example, one of my slices generates a call to the method BasicStream::readAndCheckSeqSize, that is not present on IceAndroid.

    Other examples are the class Ice.ObjectHolderBase or the Ice.AsyncResult. The translator generates perfect Ice 3.4.1 code, but not IceAndroid 0.1.1.

    Is there some way to say to the translator that generates the code with Ice 3.3.1 compatibility?
  • matthew
    matthew NL, Canada
    No, you should use Ice 3.3.1 not Ice 3.4.1 with Ice for Android.
  • matthew wrote: »
    No, you should use Ice 3.3.1 not Ice 3.4.1 with Ice for Android.

    Well.

    For my problem I was able to use the slice2java 3.3.1 version to generate the .java files, disabling the slice2java plugin on my Android project and doing it on the terminal.

    I tried my Android Ice client with a Ice 3.4.1 servant and it worked. I'm lucky, I suppose :-P

    Are some plan to continue with the IceAndroid development and make it compatible with 3.4.1?
  • bernard
    bernard Jupiter, FL

    I tried my Android Ice client with a Ice 3.4.1 servant and it worked. I'm lucky, I suppose :-P

    That's actually expected (not luck). All versions of Ice inter-operate: you can mix an match programming languages, platforms and even Ice versions.

    It's just that right now the Ice for Android lab project (for use on Android devices) is based on Ice 3.3.1.

    Cheers,
    Bernard
  • matthew
    matthew NL, Canada
    Well.

    For my problem I was able to use the slice2java 3.3.1 version to generate the .java files, disabling the slice2java plugin on my Android project and doing it on the terminal.

    ...

    You should be able to use the slice2java plugin too if you point it at the Ice 3.3.1 installation instead of the Ice 3.4.1 one.
  • matthew wrote: »
    You should be able to use the slice2java plugin too if you point it at the Ice 3.3.1 installation instead of the Ice 3.4.1 one.

    Of course! I didn't do that because a need a working 3.4.1 installation, only for that I disable the slice2java plugin :)