Creating Android app using OpenMAX library in GB, but showing not found? - android

I'm trying to develop android app, in gingerbread using OpenMAX-AL.
Basically openMAX-AL library not supporatable in GingerBread.So im using the openmax-al libray from ics (by building source).I able to compile my sample application using that library without error after installing in Ginger bread its showing error as below..And also i tried to push the library inside my application lib folder still same error.
What should i do to use openmax-al library in gingerbread. Can u any one suggest me idea ,im struggling for last one week? Thanks in advance.
used in Android.mk file to compile:
LOCAL_LDLIBS := $(LIB)/libOpenMAXAL.so
05-21 16:31:37.270: E/AndroidRuntime(28217): java.lang.ExceptionInInitializerError
05-21 16:31:37.270: E/AndroidRuntime(28217): at java.lang.Class.newInstanceImpl(Native Method)
05-21 16:31:37.270: E/AndroidRuntime(28217): at java.lang.Class.newInstance(Class.java:1409)
05-21 16:31:37.270: E/AndroidRuntime(28217): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-21 16:31:37.270: E/AndroidRuntime(28217): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1610)
05-21 16:31:37.270: E/AndroidRuntime(28217): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716)
05-21 16:31:37.270: E/AndroidRuntime(28217): at android.app.ActivityThread.access$1500(ActivityThread.java:124)
05-21 16:31:37.270: E/AndroidRuntime(28217): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968)
05-21 16:31:37.270: E/AndroidRuntime(28217): at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 16:31:37.270: E/AndroidRuntime(28217): at android.os.Looper.loop(Looper.java:123)
05-21 16:31:37.270: E/AndroidRuntime(28217): at android.app.ActivityThread.main(ActivityThread.java:3806)
05-21 16:31:37.270: E/AndroidRuntime(28217): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 16:31:37.270: E/AndroidRuntime(28217): at java.lang.reflect.Method.invoke(Method.java:507)
05-21 16:31:37.270: E/AndroidRuntime(28217): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-21 16:31:37.270: E/AndroidRuntime(28217): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-21 16:31:37.270: E/AndroidRuntime(28217): at dalvik.system.NativeStart.main(Native Method)
05-21 16:31:37.270: E/AndroidRuntime(28217): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1964]: 1240 could not load needed library 'libOpenMAXAL.so' for 'libnative-media-jni.so' (load_library[1106]: Library 'libOpenMAXAL.so' not found)
05-21 16:31:37.270: E/AndroidRuntime(28217): at java.lang.Runtime.loadLibrary(Runtime.java:434)
05-21 16:31:37.270: E/AndroidRuntime(28217): at java.lang.System.loadLibrary(System.java:554)
05-21 16:31:37.270: E/AndroidRuntime(28217): at com.example.nativemedia.NativeMedia.<clinit>(NativeMedia.java:338)
05-21 16:31:37.270: E/AndroidRuntime(28217): ... 15 more
regards
VS

During linking loader will only look for symbol references in dynamically linked libraries.
What you tried is may be copied OPENMAXAL.so to the android-8/usr/lib then compiled,, but when app runs, any library linked as below
LOCAL_LDLIBS += -lOpenMAXAL
should be in android's /system/libs/.
As for GB, this will not be the case! Have you tried pushing the so to /system/lib/?

Related

jetty on android is crashing

hey I am developing an android application and I came to a problem, I want to develop a web http server for my android application and through my research I came across this example
Integrate Jetty Server In Your Application
and whenever I tried to run it I get this type of error that I don't know how to solve it, has any one came across this error or similar? I'm using eclipse and trying to run it on android 4.2.2 and also on 4.1.2
05-23 12:53:18.351: D/dalvikvm(626): Not late-enabling CheckJNI (already on)
05-23 12:53:19.112: E/Trace(626): error opening trace file: No such file or directory (2)
05-23 12:53:19.461: W/dalvikvm(626): Unable to resolve superclass of Lcom/example/jettytest/MainActivity$1; (641)
05-23 12:53:19.461: W/dalvikvm(626): Link of class 'Lcom/example/jettytest/MainActivity$1;' failed
05-23 12:53:19.461: E/dalvikvm(626): Could not find class 'com.example.jettytest.MainActivity$1', referenced from method com.example.jettytest.MainActivity.<init>
05-23 12:53:19.461: W/dalvikvm(626): VFY: unable to resolve new-instance 536 (Lcom/example/jettytest/MainActivity$1;) in Lcom/example/jettytest/MainActivity;
05-23 12:53:19.461: D/dalvikvm(626): VFY: replacing opcode 0x22 at 0x0003
05-23 12:53:19.471: E/dalvikvm(626): Could not find class 'org.eclipse.jetty.server.Server', referenced from method com.example.jettytest.MainActivity.onCreate
05-23 12:53:19.471: W/dalvikvm(626): VFY: unable to resolve new-instance 640 (Lorg/eclipse/jetty/server/Server;) in Lcom/example/jettytest/MainActivity;
05-23 12:53:19.471: D/dalvikvm(626): VFY: replacing opcode 0x22 at 0x0008
05-23 12:53:19.471: W/dalvikvm(626): Unable to resolve superclass of Lcom/example/jettytest/MainActivity$1; (641)
05-23 12:53:19.471: W/dalvikvm(626): Link of class 'Lcom/example/jettytest/MainActivity$1;' failed
05-23 12:53:19.471: D/dalvikvm(626): DexOpt: unable to opt direct call 0x0ff3 at 0x05 in Lcom/example/jettytest/MainActivity;.<init>
05-23 12:53:19.471: D/dalvikvm(626): DexOpt: unable to opt direct call 0x10bf at 0x0c in Lcom/example/jettytest/MainActivity;.onCreate
05-23 12:53:19.481: D/AndroidRuntime(626): Shutting down VM
05-23 12:53:19.481: W/dalvikvm(626): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
05-23 12:53:19.491: E/AndroidRuntime(626): FATAL EXCEPTION: main
05-23 12:53:19.491: E/AndroidRuntime(626): java.lang.NoClassDefFoundError: com.example.jettytest.MainActivity$1
05-23 12:53:19.491: E/AndroidRuntime(626): at com.example.jettytest.MainActivity.<init>(MainActivity.java:26)
05-23 12:53:19.491: E/AndroidRuntime(626): at java.lang.Class.newInstanceImpl(Native Method)
05-23 12:53:19.491: E/AndroidRuntime(626): at java.lang.Class.newInstance(Class.java:1319)
05-23 12:53:19.491: E/AndroidRuntime(626): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
05-23 12:53:19.491: E/AndroidRuntime(626): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
05-23 12:53:19.491: E/AndroidRuntime(626): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
05-23 12:53:19.491: E/AndroidRuntime(626): at android.app.ActivityThread.access$600(ActivityThread.java:130)
05-23 12:53:19.491: E/AndroidRuntime(626): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
05-23 12:53:19.491: E/AndroidRuntime(626): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 12:53:19.491: E/AndroidRuntime(626): at android.os.Looper.loop(Looper.java:137)
05-23 12:53:19.491: E/AndroidRuntime(626): at android.app.ActivityThread.main(ActivityThread.java:4745)
05-23 12:53:19.491: E/AndroidRuntime(626): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 12:53:19.491: E/AndroidRuntime(626): at java.lang.reflect.Method.invoke(Method.java:511)
05-23 12:53:19.491: E/AndroidRuntime(626): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
05-23 12:53:19.491: E/AndroidRuntime(626): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-23 12:53:19.491: E/AndroidRuntime(626): at dalvik.system.NativeStart.main(Native Method)
05-23 12:53:21.291: I/Process(626): Sending signal. PID: 626 SIG: 9
For starters, use Jetty 7, as it is compatible with the JDK that Android uses.
(Jetty 8 uses advanced features of JDK 6 not present in Android, and Jetty 9 has a minimum requirement of JDK 7 which is too new for Android)
The error you got Could not find class 'org.eclipse.jetty.server.Server' is typically a sign that you tried to use Jetty 8/9 with Android (or more rarely, you had a packaging mistake)
You also have to replace the standard JVM classloader that Jetty uses with one that is Android compatible.
An open source example of Jetty 7 on Android can be found at the i-jetty project at code.google.com/p/i-jetty/. The i-jetty project is maintained by the Jetty developers.

I am trying to follow a tutorial here:

trying to follow this tutorial:
http://www.youtube.com/watch?annotation_id=annotation_413231&feature=iv&src_vid=lQW1WQOCri0&v=zVIZSKP3tR8
to use AndEngine and by the time I reach the end I got two errors with the styles.xml files in the "values-v11" and "values-v14" folders (res parrent folder).
resources-->values-v11--> style.xml
Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
in resources-->values-v14--> style.xml
Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.
I looked them up and was told to replace them with this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomWindowTitleBackground">
</style>
</resources>
Then I got an error in the main.xml file saying: “No resource identifier found for attribute 'showAsAction' in package 'android'” and was told to remove the "android:showAsAction="never" line resulting in this:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/action_settings"
android:orderInCategory="100"
android:title="#string/action_settings"/>
</menu>
This got rid of the errors. But now when I run it on my phone the phone says "Unfortunately, myTestProject has stopped"
Why is this? here is my logcat errors:
05-21 06:52:24.701: W/dalvikvm(8377): threadid=1: thread exiting with uncaught exception (group=0x40ac19d8)
05-21 06:52:24.701: E/AndroidRuntime(8377): FATAL EXCEPTION: main
05-21 06:52:24.701: E/AndroidRuntime(8377): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mystuff/com.mystuff.MainActivity}: java.lang.ClassNotFoundException: com.mystuff.MainActivity
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.os.Looper.loop(Looper.java:137)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-21 06:52:24.701: E/AndroidRuntime(8377): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 06:52:24.701: E/AndroidRuntime(8377): at java.lang.reflect.Method.invoke(Method.java:511)
05-21 06:52:24.701: E/AndroidRuntime(8377): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
05-21 06:52:24.701: E/AndroidRuntime(8377): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
05-21 06:52:24.701: E/AndroidRuntime(8377): at dalvik.system.NativeStart.main(Native Method)
05-21 06:52:24.701: E/AndroidRuntime(8377): Caused by: java.lang.ClassNotFoundException: com.mystuff.MainActivity
05-21 06:52:24.701: E/AndroidRuntime(8377): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-21 06:52:24.701: E/AndroidRuntime(8377): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-21 06:52:24.701: E/AndroidRuntime(8377): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
05-21 06:52:24.701: E/AndroidRuntime(8377): ... 11 more

Google MAP Navigation for android to get driving directions

i am working on google map navigation for android . for 2.3 android version .
i searched on google found some examples but not sure showing all errors . .all are showing same errors .. here i am posting the one last i tried
https://docs.google.com/uc?export=download&id=0B0MdROeR0jbvWVVNUV9jbk1OeEE
check the above code and test on 2.3.3 ... is that working or not.
my logcat information is
05-21 13:46:53.219: E/AndroidRuntime(557): FATAL EXCEPTION: main
05-21 13:46:53.219: E/AndroidRuntime(557): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
05-21 13:46:53.219: E/AndroidRuntime(557): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
05-21 13:46:53.219: E/AndroidRuntime(557): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-21 13:46:53.219: E/AndroidRuntime(557): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.Activity.setContentView(Activity.java:1657)
05-21 13:46:53.219: E/AndroidRuntime(557): at app.akexorcist.googlemapsv2direction.Main.onCreate(Main.java:27)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.os.Looper.loop(Looper.java:130)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-21 13:46:53.219: E/AndroidRuntime(557): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 13:46:53.219: E/AndroidRuntime(557): at java.lang.reflect.Method.invoke(Method.java:507)
05-21 13:46:53.219: E/AndroidRuntime(557): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-21 13:46:53.219: E/AndroidRuntime(557): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-21 13:46:53.219: E/AndroidRuntime(557): at dalvik.system.NativeStart.main(Native Method)
it looks like you did not import google play services library because it is looking for a styleable resource
Maybe you not add the google play services project into your Eclipse workspace and after need to add the dependency to Google Play Services into your project GoogleMapsV2Direction
check this:
https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw
for me this project works
You might not have imported required libraries for it.
Check this if you need help on how to import google-play-services to project,
Make sure that you haven't included any libraries as projects on the Java Build Path. That's taken care of in the Android tab now. If that doesn't work, try checking more choices in the Java Build Path -> Order and Export.

Android ComponentInfo ClassNotFoundException on some devices

Please help to understand strange application behaviour.
In almost all devices in production everything is OK, I'm using ACRA to collect crash reports. But here is what I've got from Alpha GTR device:
ComponentInfo{com.xxxxxxxxxxx /com.xxxxxxxxxxx.xxxxActivity}: java.lang.ClassNotFoundException: com.xxxxxxxxxxx.xxxxActivity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2108)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.access$600(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:4987)
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:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.xxxxxxxxxxx.xxxxActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2099)
... 11 more
java.lang.ClassNotFoundException: com.xxxxxxxxxxx.xxxxActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2099)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.access$600(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:4987)
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:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
So application failed to start with strange exception. I've already checked SO questions about it, and just adding libraries as Unable to instantiate activity... Caused by ClassNotFoundException doesn't help here.
Could it be some device-specific exception? My app uses Camera, Google Maps and GPS.
Maybe you have to check if GPS or Camera are supported by the device first?
LocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

Is there a way to use junit.extensions.TestSetup for tests on Android?

The android sdk source includes source for junit.extensions, but the classes are not in android.jar even though junit.framework and junit.runner are in there. I tried creating my own junit.extensions package and using the source included in the android sdk source, but I get a ClassCastException (see below). Something in android.test.suitebuilder is trying to cast the return value from the suite() method to a TestCase, even though suite returns a Test interface.
I want to use TestSetup class from junit.extensions, as in the following example (see http://etutorials.org/Programming/Java+extreme+programming/Chapter+4.+JUnit/4.7+One-Time+Set+Up+and+Tear+Down/):
public SomeTestCase extends TestCase {
public static Test suite() {
TestSetup setup = new TestSetup(new TestSuite(SomeTestCase.class)) {
#Override
protected void setUp( ) throws Exception {
// do your one-time setup here!
}
#Override
protected void tearDown( ) throws Exception {
// do your one-time tear down here!
}
};
return setup;
}
public void someTestMethod() { }
}
However, I get the following error:
05-21 08:10:14.152: I/TestRunner(1316): java.lang.RuntimeException: Exception during suite construction
05-21 08:10:14.152: I/TestRunner(1316): at android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests.testSuiteConstructionFailed(TestSuiteBuilder.java:238)
05-21 08:10:14.152: I/TestRunner(1316): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 08:10:14.152: I/TestRunner(1316): at java.lang.reflect.Method.invoke(Method.java:511)
05-21 08:10:14.152: I/TestRunner(1316): at junit.framework.TestCase.runTest(TestCase.java:154)
05-21 08:10:14.152: I/TestRunner(1316): at junit.framework.TestCase.runBare(TestCase.java:127)
05-21 08:10:14.152: I/TestRunner(1316): at junit.framework.TestResult$1.protect(TestResult.java:106)
05-21 08:10:14.152: I/TestRunner(1316): at junit.framework.TestResult.runProtected(TestResult.java:124)
05-21 08:10:14.152: I/TestRunner(1316): at junit.framework.TestResult.run(TestResult.java:109)
05-21 08:10:14.152: I/TestRunner(1316): at junit.framework.TestCase.run(TestCase.java:118)
05-21 08:10:14.152: I/TestRunner(1316): at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
05-21 08:10:14.152: I/TestRunner(1316): at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
05-21 08:10:14.152: I/TestRunner(1316): at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545)
05-21 08:10:14.152: I/TestRunner(1316): at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)
05-21 08:10:14.152: I/TestRunner(1316): Caused by: java.lang.ClassCastException: com.somebody.test.SomeTestCase$1 cannot be cast to junit.framework.TestCase
05-21 08:10:14.152: I/TestRunner(1316): at android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:188)
05-21 08:10:14.152: I/TestRunner(1316): at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:379)
05-21 08:10:14.152: I/TestRunner(1316): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3920)
05-21 08:10:14.152: I/TestRunner(1316): at android.app.ActivityThread.access$1300(ActivityThread.java:123)
05-21 08:10:14.152: I/TestRunner(1316): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
05-21 08:10:14.152: I/TestRunner(1316): at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 08:10:14.152: I/TestRunner(1316): at android.os.Looper.loop(Looper.java:137)
05-21 08:10:14.152: I/TestRunner(1316): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-21 08:10:14.152: I/TestRunner(1316): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 08:10:14.152: I/TestRunner(1316): at java.lang.reflect.Method.invoke(Method.java:511)
05-21 08:10:14.152: I/TestRunner(1316): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-21 08:10:14.152: I/TestRunner(1316): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-21 08:10:14.152: I/TestRunner(1316): at dalvik.system.NativeStart.main(Native Method)
The suite() method of a TestCase is supposed to return a Test, but it appears something in android os is trying to cast it to a TestCase.
As one attempt to resolve the problem, I tweaked the TestDecorator class so that it subclassed TestCase instead of Test, but it still gave the same ClassCastException, which really mystified me.
By the way, there seems to be some doubt about android.jar containing junit, so here is a partial listing of android.jar contents:
$ jar tf android.jar | more
META-INF/
META-INF/MANIFEST.MF
assets/
assets/images/
assets/images/android-logo-mask.png
assets/images/android-logo-shine.png
assets/sounds/
assets/sounds/bootanim1.raw
assets/sounds/bootanim0.raw
assets/webkit/
assets/webkit/android-weberror.png
assets/webkit/togglePlugin.png
assets/webkit/nullPlugin.png
assets/webkit/youtube.html
assets/webkit/missingImage.png
assets/webkit/youtube.png
assets/webkit/textAreaResizeCorner.png
assets/webkit/play.png
junit/
junit/framework/
junit/framework/TestSuite.class
junit/framework/ComparisonFailure.class
junit/framework/Assert.class
junit/framework/TestListener.class
junit/framework/TestResult.class
junit/framework/Test.class
junit/framework/TestFailure.class
junit/framework/Protectable.class
junit/framework/TestCase.class
junit/framework/AssertionFailedError.class
junit/runner/
junit/runner/TestSuiteLoader.class
junit/runner/Version.class
junit/runner/BaseTestRunner.class
You can also see it listed in the package contents on the android reference site at https://developer.android.com/reference/packages.html. If you continue to doubt, please browse your copy of android.jar.
Any helpful suggestions? Has anyone successfully used junit.extensions.TestSetup with android?

Categories

Resources