Android Question Error - Application cannot be cast to android.app.Activity

William Hunter

Active Member
Licensed User
Longtime User
I am working with thedesolatesoul ‘s ooVoo library and I’m getting an error on one device that does not appear on three other devices. I get this error on an HP Slate 7 Plus running Android 4.2.2. It does not appear on the three other devices running Android 4.0.4, Android 4.1.2 or Android 4.4.4.

When using the B4A bridge there is no logged error. I’m unable to use USB debugging as HP does not provide a USB Debug driver.

The error occurs on trying to connect. Has anyone had a similar experience and can shed some light on this for me?

This is the error:
B4X:
An error has occured in the Sub:main-vvvvvvv1(java line:653)java.lang.ClassCastException:android.app.Application cannot be cast to android.app.Activity
This is the manifest:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17"/>
<supports-screens android:largeScreens="true"
  android:normalScreens="true"
  android:smallScreens="true"
  android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.
AddManifestText(  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
  <uses-permission android:name="android.permission.RECORD_AUDIO" />
  <uses-permission android:name="android.permission.RECORD_VIDEO" />
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.CAMERA" />
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
   <uses-permission android:name="android.permission.READ_PHONE_STATE" />
     <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
  <uses-feature android:name="android.hardware.camera" />
  <uses-feature android:name="android.hardware.camera.autofocus" />
  <!-- Tell the system this app requires OpenGL ES 2.0. -->
  <uses-feature
  android:glEsVersion="0x00020000"
  android:required="true" />)
AddApplicationText(  <meta-data
  android:name="AppId"
  android:value="\ 12349983354818" />
  <meta-data
  android:name="AppToken"
  android:value="\ MDAxMDAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABhZVxW2%2F4hdu8qoC2Y8mqBEdh5etTttzecEvzPi3qaLiJYDIM4V1g5iaivqot1WYV%2Bijv9O0bcRE%2FDrXVDisZp40El2k4BJ9jOwbZOxrW843cEHVqVy%2FQylVo5AyA3pkg%3D" />)
AddApplicationText(  <!--  Phone State listener -->
  <receiver android:name="com.oovoo.core.phone.CallReceiver" >
  <intent-filter>
  <action android:name="android.intent.action.PHONE_STATE" />
  </intent-filter>
  <intent-filter>
         <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
       </intent-filter>
  </receiver>)
Any help is greatly appreciated. :(

Best regards
 

William Hunter

Active Member
Licensed User
Longtime User
Run your app in debug mode to see the line that raised the error.
Thank you for your reply Erel. I had done this and found the line below to have caused the error. This line is directed at the ooVoo library and initiates the connection. This would indicate that the error occurred within that library. I'm at a loss to understand why a particular version of Android has this error while others do not. My app is not overly complex. It's simply thedesolatesoul's basic demo app with a few enhancements, but the core remains unchanged. There doesn't seem to be much community activity with this library. Perhaps this mystery will have to remain unsolved.
B4X:
CC.JoinConference("TEST_SESSION_123", etParticipanID.Text, "TEST_INFO")
Best regards :)
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
It is still useful to post the full error message from the logs. It might allow the library developer to fix this issue.
Hello Erel. I would like to do as you suggest. Unfortunately, when using B4A Bridge no error is loged. I would like to use USB debugging, but HP does not provide the necessary driver for this purpose. If I ever find the USB Debugging driver I will post the log.

If any member has ever sucessfully configured a HP Slate 7 Plus tablet for USB Debugging, perhaps they would share the solution. ;)

Best regards
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
Hello Erel. I would like to do as you suggest. Unfortunately, when using B4A Bridge no error is loged. I would like to use USB debugging, but HP does not provide the necessary driver for this purpose. If I ever find the USB Debugging driver I will post the log.

Best regards
Well, here I am again. I did manage to get USB deugging working with this device. The Error Log is shown below. I hope it is of some help to the developer.
B4X:
LogCat connected to: CNU342B617
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **
initsdk: OK
ConferenceCore initSdk is OK
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
WakeLock already held.
Set Icon
Set Icons visible
Done
Set Icon
Set Icon
Set Icon
Set Icon
Set Icon
Set Icon
Set Icon
Error occurred on line: 234 (Main)
java.lang.ClassCastException: android.app.Application cannot be cast to android.app.Activity
   at com.oovoo.core.ConferenceCore.isTablet(ConferenceCore.java:1261)
   at com.oovoo.core.device.deviceconfig.MediaDeviceConfig.getVideoCallScreenOrientation(MediaDeviceConfig.java:80)
   at com.oovoo.core.ConferenceCore.InitCameraDevices(ConferenceCore.java:422)
   at com.oovoo.core.ConferenceCore.updateDeviceConfig(ConferenceCore.java:1482)
   at com.oovoo.core.ConferenceCore.joinConference(ConferenceCore.java:1407)
   at com.maximussoft.conferencecore.ConferenceCoreWrapper.JoinConference(ConferenceCoreWrapper.java:133)
   at wfh.videochat.main._joinconference(main.java:939)
   at wfh.videochat.main._popupmenu_itemclicked(main.java:410)
   at wfh.videochat.main._abpop_itemclicked(main.java:391)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
   at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
   at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
   at anywheresoftware.b4a.BA$1.run(BA.java:293)
   at android.os.Handler.handleCallback(Handler.java:725)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:5041)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
   at dalvik.system.NativeStart.main(Native Method)
Best regards :D
 
Upvote 0
Top