Taking on Cling

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Taking on Cling

James_Carr
On android, I create a project, follow the instructions in the user manual, but on my phone, I couldn't get any sign. Provided that my other application has been debugged successfully on this same device, my problem with Cling would be a wrong usage of the sample code. Can somebody help?
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

Christian Bauer
Administrator
The example from the manual is available in source and as a working APK (which you can download/install directly on the phone) here: http://www.teleal.org/projects/download/misc/

Compare it with your application. If you have problems in the future, it is important that you provide details such as log messages and code snippets. Android unfortunately has a broken logging system which doesn't let you log debugging messages, so use this:

        // Fix the logging integration between java.util.logging and Android internal logging
        LoggingUtil.resetRootHandler(new FixedAndroidHandler());
        Logger.getLogger("org.teleal.cling").setLevel(Level.INFO);

        // UDP communication
        Logger.getLogger("org.teleal.cling.transport.spi.DatagramIO").setLevel(Level.FINE);
        Logger.getLogger("org.teleal.cling.transport.spi.MulticastReceiver").setLevel(Level.FINE);

        // Discovery
        Logger.getLogger("org.teleal.cling.protocol.ProtocolFactory").setLevel(Level.FINER);
        Logger.getLogger("org.teleal.cling.protocol.async").setLevel(Level.FINER);

        // Description
        Logger.getLogger("org.teleal.cling.protocol.ProtocolFactory").setLevel(Level.FINER);
        Logger.getLogger("org.teleal.cling.protocol.RetrieveRemoteDescriptors").setLevel(Level.FINE);
        Logger.getLogger("org.teleal.cling.protocol.sync.ReceivingRetrieval").setLevel(Level.FINE);
        Logger.getLogger("org.teleal.cling.binding.xml.DeviceDescriptorBinder").setLevel(Level.FINE);
        Logger.getLogger("org.teleal.cling.binding.xml.ServiceDescriptorBinder").setLevel(Level.FINE);

        // Registry
        Logger.getLogger("org.teleal.cling.registry.Registry").setLevel(Level.FINER);
        Logger.getLogger("org.teleal.cling.registry.LocalItems").setLevel(Level.FINER);
        Logger.getLogger("org.teleal.cling.registry.RemoteItems").setLevel(Level.FINER);
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

James_Carr
In reply to this post by James_Carr
Thanks so much. It gonna be very helpfull for me. I realy want to take it on.
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

James_Carr
In reply to this post by Christian Bauer

When i load your project UpnpBrowser-100804, I obtain this on my phone screen .
 this are the log messages :
--------------------------------------------------------------------------------------------------------------------------------------------

09-17 17:05:34.948: DEBUG/dalvikvm(3135): GC freed 45 objects / 2472 bytes in 101ms
09-17 17:05:37.338: DEBUG/DragLayer(265): touch event action ACTION_DOWN
09-17 17:05:37.398: DEBUG/DragLayer(265): touch event action ACTION_UP
09-17 17:05:38.648: DEBUG/DragLayer(265): touch event action ACTION_DOWN
09-17 17:05:38.691: DEBUG/DragLayer(265): touch event action ACTION_UP
09-17 17:05:38.788: INFO/ActivityManager(78): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.teleal.cling.android.browser/.MainActivity }
09-17 17:05:38.878: INFO/ActivityManager(78): Start proc org.teleal.cling.android.browser for activity org.teleal.cling.android.browser/.MainActivity: pid=6352 uid=10070 gids={3003}
09-17 17:05:38.928: INFO/dalvikvm(6352): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=38)
09-17 17:05:38.938: DEBUG/AK8973(61): Compass Start
09-17 17:05:38.938: DEBUG/Sensors(78): open_akm, fd=103
09-17 17:05:38.948: INFO/dalvikvm(6352): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=68)
09-17 17:05:38.968: DEBUG/AndroidRuntime(6352): Shutting down VM
09-17 17:05:38.968: WARN/dalvikvm(6352): threadid=3: thread exiting with uncaught exception (group=0x4001b390)
09-17 17:05:38.968: ERROR/AndroidRuntime(6352): Uncaught handler: thread main exiting due to uncaught exception
09-17 17:05:38.978: ERROR/AndroidRuntime(6352): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.teleal.cling.android.browser/org.teleal.cling.android.browser.MainActivity}: java.lang.ClassNotFoundException: org.teleal.cling.android.browser.MainActivity in loader dalvik.system.PathClassLoader@46362578
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2497)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.app.ActivityThread.access$2200(ActivityThread.java:126)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.os.Looper.loop(Looper.java:123)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.app.ActivityThread.main(ActivityThread.java:4595)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at java.lang.reflect.Method.invokeNative(Native Method)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at java.lang.reflect.Method.invoke(Method.java:521)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at dalvik.system.NativeStart.main(Native Method)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352): Caused by: java.lang.ClassNotFoundException: org.teleal.cling.android.browser.MainActivity in loader dalvik.system.PathClassLoader@46362578
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2489)
09-17 17:05:38.978: ERROR/AndroidRuntime(6352):     ... 11 more
09-17 17:05:38.978: INFO/Process(78): Sending signal. PID: 6352 SIG: 3
09-17 17:05:38.978: INFO/dalvikvm(6352): threadid=7: reacting to signal 3
09-17 17:05:38.978: ERROR/dalvikvm(6352): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
09-17 17:05:39.208: WARN/Rosie(265): mAddHtcWidgetByOtherActivity = false, mIsOpenSlideWhenLeaveLaunch = true
09-17 17:05:48.808: WARN/ActivityManager(78): Launch timeout has expired, giving up wake lock!
09-17 17:05:48.949: WARN/ActivityManager(78): Activity idle timeout for HistoryRecord{467a8c38 org.teleal.cling.android.browser/.MainActivity}
09-17 17:05:54.048: DEBUG/dalvikvm(265): GC freed 1280 objects / 64656 bytes in 97ms
09-17 17:05:55.628: WARN/TimeThread(224): catch: The operation timed out
--------------------------------------------------------------------------------------------------------------------------

my phone is a HTC desire. so i loaded the project with the 2.1 android version.
Is there anything i can do to make it work?
thanks
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

Christian Bauer
Administrator
A ClassNotFoundException probably means that your packaging is wrong because well, classes are missing. This has nothing to do with Cling or the example but is likely a problem with your toolchain/Eclipse/whatever.
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

James_Carr
Thanks. I'm still looking for a solution. cause I have the newest version of eclipse, and my other applications launche succesfully. Had anyone worked with eclipse on this project?
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

James_Carr
In reply to this post by Christian Bauer
I confirm. My problem was that my packaging was wrong. It's now working. tkx
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

Praveen
Hi
Can you help in solving the problem you were having, coz i am facing the same !!
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

Sathish
In reply to this post by James_Carr
Hi
I'm facing the same issue which you have posted, can you Suggest me what are the changes you have done to compile the project
Reply | Threaded
Open this post in threaded view
|

Re: Taking on Cling

sathish
i fixed it,Hope this would be helpful to people facing problem like me and it took lot time in getting this issue sorted out,
The solution to this issue is to change the package structure as it is in the exception show,The Mainactivity is not in the path where it is supposed to be.