Why does my video playing app crash when I try to run on a Droid 2.1 device, but works fine with myTouch 1.6?
Thanks
Chris
LogCat shows
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): java.lang.IllegalStateException
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at android.media.MediaPlayer.getVideoWidth(Native Method)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at android.widget.VideoView$2.onPrepared(VideoView.java:290)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:1152)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at android.os.Looper.loop(Looper.java:123)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at android.app.ActivityThread.main(ActivityThread.java:4363)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at java.lang.reflect.Method.invokeNative(Native Method)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at java.lang.reflect.Method.invoke(Method.java:521)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-07 18:13:13.444: ERROR/AndroidRuntime(4252): at dalvik.system.NativeStart.main(Native Method)
This VideoView-based sample works fine on all Android devices I have tested it upon, including the Magic and DROID. Experiment with it and your media clip and see what happens.
Related
I've made my Android app tablet optimized and I followed the tutorial here:
Everything is great, but I am trying to select an item (say, the 1st item) with a button in the ActionBar.
I tried this answer to use performItemClick but on I've got error reports of java.lang.IllegalStateException
in android.support.v4.app.ListFragment.ensureList, java.lang.IllegalStateException: Content view not yet created, and java.lang.NullPointerException
in android.content.ComponentName.<init>
I've tried checking if the ListView is null and still get the error reports on the Play Store. How do I properly select an item in my list programmatically?
Update to add logcat and the code is virtually identical to the tutorials in the links:
Logcat A:
java.lang.IllegalStateException: Content view not yet created
at android.support.v4.app.ListFragment.ensureList(ListFragment.java:328)
at android.support.v4.app.ListFragment.getListView(ListFragment.java:222)
at com.ccwilcox.meteorshower.MeteorList.showMeteorDetails(MeteorList.java:69)
at com.ccwilcox.meteorshower.MeteorList.onListItemClick(MeteorList.java:62)
at android.support.v4.app.ListFragment$2.onItemClick(ListFragment.java:58)
at android.widget.AdapterView.performItemClick(AdapterView.java:298)
at android.widget.AbsListView.performItemClick(AbsListView.java:1280)
at com.ccwilcox.meteorshower.MainActivity.viewUpcomingEvent(MainActivity.java:648)
at com.ccwilcox.meteorshower.MainActivity.onOptionsItemSelected(MainActivity.java:534)
at android.app.Activity.onMenuItemSelected(Activity.java:2606)
at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:361)
at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:1045)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:592)
at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:149)
at android.view.View.performClick(View.java:4222)
at android.view.View$PerformClick.run(View.java:17273)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
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:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(Native Method)
Logcat B:
java.lang.NullPointerException
at android.content.ComponentName.<init>(ComponentName.java:75)
at android.content.Intent.<init>(Intent.java:2874)
at com.ccwilcox.meteorshower.MeteorList.showMeteorDetails(MeteorList.java:86)
at com.ccwilcox.meteorshower.MeteorList.onListItemClick(MeteorList.java:62)
at android.support.v4.app.ListFragment$2.onItemClick(ListFragment.java:58)
at android.widget.AdapterView.performItemClick(AdapterView.java:284)
at android.widget.ListView.performItemClick(ListView.java:3701)
at com.ccwilcox.meteorshower.MainActivity.viewUpcomingEvent(MainActivity.java:648)
at com.ccwilcox.meteorshower.MainActivity.onOptionsItemSelected(MainActivity.java:534)
at android.app.Activity.onMenuItemSelected(Activity.java:2205)
at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:361)
at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:779)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:861)
at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
at android.view.View$PerformClick.run(View.java:9152)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Update 2
And here is the code that is causing the problem:
if (mListFragment.listView != null) {
mListFragment.listView.performItemClick(mListFragment.listView.getAdapter().getView(position, null, null), position, mListFragment.listView.getAdapter().getItemId(position));
}
why does my application crash whenever I inherit from SherlockActivity? It's probably a silly mistake but I really can't figure it out! Just inheriting from Activity does work. Here's the code, layout file, manifest and the logcat logs:
package com.p4p.joinme;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockActivity;
public class MainActivity extends SherlockActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
layout file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="I'm a textview." />
</LinearLayout>
manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.p4p.joinme"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
error logs:
06-07 12:03:22.613: E/ExternalAccountType(21992): Unsupported attribute readOnly
06-07 12:03:23.244: E/ExternalAccountType(21992): Unsupported attribute readOnly
06-07 12:03:25.316: E/AndroidRuntime(9285): FATAL EXCEPTION: main
06-07 12:03:25.316: E/AndroidRuntime(9285): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.p4p.joinme/com.p4p.joinme.MainActivity}: java.lang.ClassNotFoundException: com.p4p.joinme.MainActivity
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2229)
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.app.ActivityThread.access$600(ActivityThread.java:139)
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261)
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.os.Looper.loop(Looper.java:154)
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.app.ActivityThread.main(ActivityThread.java:4945)
06-07 12:03:25.316: E/AndroidRuntime(9285): at java.lang.reflect.Method.invokeNative(Native Method)
06-07 12:03:25.316: E/AndroidRuntime(9285): at java.lang.reflect.Method.invoke(Method.java:511)
06-07 12:03:25.316: E/AndroidRuntime(9285): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-07 12:03:25.316: E/AndroidRuntime(9285): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-07 12:03:25.316: E/AndroidRuntime(9285): at dalvik.system.NativeStart.main(Native Method)
06-07 12:03:25.316: E/AndroidRuntime(9285): Caused by: java.lang.ClassNotFoundException: com.p4p.joinme.MainActivity
06-07 12:03:25.316: E/AndroidRuntime(9285): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-07 12:03:25.316: E/AndroidRuntime(9285): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-07 12:03:25.316: E/AndroidRuntime(9285): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.app.Instrumentation.newActivity(Instrumentation.java:1039)
06-07 12:03:25.316: E/AndroidRuntime(9285): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
06-07 12:03:25.316: E/AndroidRuntime(9285): ... 11 more
06-07 12:03:25.326: E/EmbeddedLogger(239): App crashed! Process: com.p4p.joinme
06-07 12:03:25.326: E/EmbeddedLogger(239): App crashed! Package: com.p4p.joinme v1 (1.0)
06-07 12:03:25.326: E/EmbeddedLogger(239): Application Label: JoinMe!
06-07 12:07:33.959: E/ExternalAccountType(21992): Unsupported attribute readOnly
06-07 12:07:34.299: E/ExternalAccountType(21992): Unsupported attribute readOnly
06-07 12:07:37.452: E/EmbeddedLogger(239): App crashed! Process: com.p4p.joinme
06-07 12:07:37.452: E/EmbeddedLogger(239): App crashed! Package: com.p4p.joinme v1 (1.0)
06-07 12:07:37.452: E/AndroidRuntime(9610): FATAL EXCEPTION: main
06-07 12:07:37.452: E/AndroidRuntime(9610): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.p4p.joinme/com.p4p.joinme.MainActivity}: java.lang.ClassNotFoundException: com.p4p.joinme.MainActivity
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2229)
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.app.ActivityThread.access$600(ActivityThread.java:139)
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261)
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.os.Looper.loop(Looper.java:154)
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.app.ActivityThread.main(ActivityThread.java:4945)
06-07 12:07:37.452: E/AndroidRuntime(9610): at java.lang.reflect.Method.invokeNative(Native Method)
06-07 12:07:37.452: E/AndroidRuntime(9610): at java.lang.reflect.Method.invoke(Method.java:511)
06-07 12:07:37.452: E/AndroidRuntime(9610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-07 12:07:37.452: E/AndroidRuntime(9610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-07 12:07:37.452: E/AndroidRuntime(9610): at dalvik.system.NativeStart.main(Native Method)
06-07 12:07:37.452: E/AndroidRuntime(9610): Caused by: java.lang.ClassNotFoundException: com.p4p.joinme.MainActivity
06-07 12:07:37.452: E/AndroidRuntime(9610): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-07 12:07:37.452: E/AndroidRuntime(9610): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-07 12:07:37.452: E/AndroidRuntime(9610): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.app.Instrumentation.newActivity(Instrumentation.java:1039)
06-07 12:07:37.452: E/AndroidRuntime(9610): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
06-07 12:07:37.452: E/AndroidRuntime(9610): ... 11 more
06-07 12:07:37.472: E/EmbeddedLogger(239): Application Label: JoinMe!
06-07 12:07:38.933: E/ActivityManager(239): fail to set top app changed!
I have had the same issue about external library, maybe your external library is not exported to your apk, I suggest you to see this: Could not find class
You probably haven't linked the library correctly, make sure you added it to the library section in rightclick -> properies -> Android.
There is no issue on your code. Jst cross check with your library whether it is linked in your project.
Steps to cross check is rightclick on projct -> properies -> Android/ java build path
use below code:
<activity
android:name="com.p4p.joinme.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
clean your project and run..
I'm not sure if this has something to do with your error, but if you want to use Sherlock Action Bar you need to use their theme:
<application
android:allowBackup="false"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
Besides, if you just updated your ADT plugin you might need to check your Private Libraries in Java Build Path.
Right click on project->Properties->Java Build Path->Order and Export(tab)->Activate checkbox next to Andrid Private Libraries
I done few phone gap projects before, This time a new exception raised in my code .
In my new project i include phonegap jar(cordova 1.5) and in the manifest i declared droidgap class(tried with both com.hb.DroidGap and org.apache.cordova.DroidGap).
now if i extend to Activity the debugger entering to onCreate method but if i extend to DroidGap
the below exception is coming and app geting force close (Debugger in not coming to onCreate) ...
Is there any thing i am missing ?
Thanks in advance and sorry for my poor English
06-07 10:03:54.954: E/AndroidRuntime(554): FATAL EXCEPTION: main
06-07 10:03:54.954: E/AndroidRuntime(554): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hiddenbrains/com.hiddenbrains.HBPluginsActivity}: java.lang.ClassNotFoundException: com.hiddenbrains.HBPluginsActivity in loader dalvik.system.PathClassLoader[/data/app/com.hiddenbrains-1.apk]
06-07 10:03:54.954: E/AndroidRuntime(554): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
06-07 10:03:54.954: E/AndroidRuntime(554): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-07 10:03:54.954: E/AndroidRuntime(554): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-07 10:03:54.954: E/AndroidRuntime(554): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-07 10:03:54.954: E/AndroidRuntime(554): at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 10:03:54.954: E/AndroidRuntime(554): at android.os.Looper.loop(Looper.java:123)
06-07 10:03:54.954: E/AndroidRuntime(554): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-07 10:03:54.954: E/AndroidRuntime(554): at java.lang.reflect.Method.invokeNative(Native Method)
06-07 10:03:54.954: E/AndroidRuntime(554): at java.lang.reflect.Method.invoke(Method.java:521)
06-07 10:03:54.954: E/AndroidRuntime(554): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-07 10:03:54.954: E/AndroidRuntime(554): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-07 10:03:54.954: E/AndroidRuntime(554): at dalvik.system.NativeStart.main(Native Method)
06-07 10:03:54.954: E/AndroidRuntime(554): Caused by: java.lang.ClassNotFoundException: com.hiddenbrains.HBPluginsActivity in loader dalvik.system.PathClassLoader[/data/app/com.hiddenbrains-1.apk]
06-07 10:03:54.954: E/AndroidRuntime(554): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
06-07 10:03:54.954: E/AndroidRuntime(554): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
06-07 10:03:54.954: E/AndroidRuntime(554): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
06-07 10:03:54.954: E/AndroidRuntime(554): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-07 10:03:54.954: E/AndroidRuntime(554): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
06-07 10:03:54.954: E/AndroidRuntime(554): ... 11 more
I have this exact problem too. Everything was working until a specific time last night, then I started getting these errors. App crashes every time. I have traced the problem to the .java file in src>MyApp.name... if I remove the cordova line, eg. class MyApp extends DroidGap and set it to the default the app doesn't crash, but it doesn't work either.
I am trying to setup ad in my game but I am having a problem. It seems to be crashing. I have included the logcat below and it has something to do with the ad it seems.
06-07 18:49:54.594: E/dalvikvm(308): Could not find class 'com.google.ads.AdView', referenced from method com.blockyblaine.bobhoil.BlockyBlaine.onCreate
06-07 18:49:54.594: W/dalvikvm(308): VFY: unable to resolve check-cast 17 (Lcom/google/ads/AdView;) in Lcom/blockyblaine/bobhoil/BlockyBlaine;
06-07 18:49:54.603: D/dalvikvm(308): VFY: replacing opcode 0x1f at 0x0011
06-07 18:49:54.603: D/dalvikvm(308): VFY: dead code 0x0013-0069 in Lcom/blockyblaine/bobhoil/BlockyBlaine;.onCreate (Landroid/os/Bundle;)V
06-07 18:49:54.933: D/AndroidRuntime(308): Shutting down VM
06-07 18:49:54.933: W/dalvikvm(308): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-07 18:49:55.014: E/AndroidRuntime(308): FATAL EXCEPTION: main
06-07 18:49:55.014: E/AndroidRuntime(308): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blockyblaine.bobhoil/com.blockyblaine.bobhoil.BlockyBlaine}: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView
06-07 18:49:55.014: E/AndroidRuntime(308): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.os.Looper.loop(Looper.java:123)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-07 18:49:55.014: E/AndroidRuntime(308): at java.lang.reflect.Method.invokeNative(Native Method)
06-07 18:49:55.014: E/AndroidRuntime(308): at java.lang.reflect.Method.invoke(Method.java:521)
06-07 18:49:55.014: E/AndroidRuntime(308): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-07 18:49:55.014: E/AndroidRuntime(308): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-07 18:49:55.014: E/AndroidRuntime(308): at dalvik.system.NativeStart.main(Native Method)
06-07 18:49:55.014: E/AndroidRuntime(308): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView
06-07 18:49:55.014: E/AndroidRuntime(308): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
06-07 18:49:55.014: E/AndroidRuntime(308): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.app.Activity.setContentView(Activity.java:1647)
06-07 18:49:55.014: E/AndroidRuntime(308): at com.blockyblaine.bobhoil.BlockyBlaine.onCreate(BlockyBlaine.java:27)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-07 18:49:55.014: E/AndroidRuntime(308): ... 11 more
06-07 18:49:55.014: E/AndroidRuntime(308): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.blockyblaine.bobhoil-2.apk]
06-07 18:49:55.014: E/AndroidRuntime(308): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
06-07 18:49:55.014: E/AndroidRuntime(308): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
06-07 18:49:55.014: E/AndroidRuntime(308): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
06-07 18:49:55.014: E/AndroidRuntime(308): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
06-07 18:49:55.014: E/AndroidRuntime(308): ... 20 more
06-07 18:50:01.593: I/Process(308): Sending signal. PID: 308 SIG: 9
This link will take you to the admob developers docs. You will need to be sure to follow the directions to have the admob JAR included in your project.
I found a couple of other mentions related to other google api's. The issue there (giving a similar logcat) was this step was missed:
2. Declare com.google.ads.AdActivity in AndroidManifest.xml.
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
I would like to know if I can include a set of classes generated from an EMF (ecore) model into an Android project.
I am trying to do this, it compiles fine, but in run-time I get errors like the following ones:
06-07 11:37:04.261: INFO/dalvikvm(649): Failed resolving Lorg/mmi/events/Event; interface 318 'Lorg/eclipse/emf/ecore/EObject;'
06-07 11:37:04.261: WARN/dalvikvm(649): Link of class 'Lorg/mmi/events/Event;' failed
06-07 11:37:04.261: WARN/dalvikvm(649): VFY: unable to find class referenced in signature (Lorg/mmi/events/Event;)
and like this:
06-07 12:11:54.953: WARN/dalvikvm(721): threadid=1: thread exiting with uncaught exception (group=0x40014760)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): FATAL EXCEPTION: main
06-07 12:11:55.157: ERROR/AndroidRuntime(721): java.lang.NoClassDefFoundError: org.mmi.model.instantiator.MmiModelInstantiator
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at org.mmi.facades.MmiFacade.<init>(MmiFacade.java:30)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at com.mmi_android.instrumentation.InstrumentationContext.<init>(InstrumentationContext.java:15)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at com.mmi_android.instrumentation.InstrumentationContext.get(InstrumentationContext.java:21)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at com.example.helloandroid.HelloAndroid.onCreate(HelloAndroid.java:46)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at android.os.Looper.loop(Looper.java:126)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at android.app.ActivityThread.main(ActivityThread.java:3997)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at java.lang.reflect.Method.invokeNative(Native Method)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at java.lang.reflect.Method.invoke(Method.java:491)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
06-07 12:11:55.157: ERROR/AndroidRuntime(721): at dalvik.system.NativeStart.main(Native Method)
Thanks for your help!!!
At the end I solved this problem using a modified version of the classes compounding the EMF core packages. You can find these classes here:
forum thread:
http://dev.eclipse.org/mhonarc/lists/emf-dev/msg01001.html
project homepage and repository:
http://code.google.com/p/smatrt/source/browse/#svn%2Ftrunk%2Ftmp%2Forg%253Fstate%253Dclosed
I needed also the XML classes included in the javax.xml.* package. I removed the corresponding comments, added the javax.xml jar file and now everything compiles in Android.
Hope it can be helpful for you in the future.
Cheers!
In a recent comment on the related Eclipse bug, Paul Allen wrote the following:
Just thought I'd post a note that things are working. If I jar up the un-modified classes from the org.eclipse.emf.common, org.eclipse.emf.ecore, and org.eclipse.emf.ecore.xmi plugins along with my model's generated classes, and import that into the libs folder of my Android project, things just work. The compiler's happy. The app runs on my Nexus 7. Life is good.
That seems preferrable, as it doesn't involve patching core EMF classes. I haven't tried it myself yet, though.