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
Related
After attempting to run my code on my device(Nexus 4) and it crashing repeatedly,I searched the forums for answers,I have tried re factoring my code into a new Android Project, I have also removed the Android Private Dependencies from my project build-path and I have also Cleaned my code close to 15 times within the last 3 hours. I believe something maybe wrong with how I'm compiling my project main.Java and whatnot.I’m just trying to learn so if you can point me into the right direction that would be great.
MainActivity.Java
04-04 04:21:06.403: E/AndroidRuntime(2430): FATAL EXCEPTION: main
04-04 04:21:06.403: E/AndroidRuntime(2430): Process: com.foobar.app, PID: 2430
04-04 04:21:06.403: E/AndroidRuntime(2430): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.foobar.app/com.foobar.app.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.foobar.app.MainActivity" on path: DexPathList[[zip file "/data/app/com.foobar.app-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.foobar.app-2, /vendor/lib, /system/lib]]
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.os.Handler.dispatchMessage(Handler.java:102)
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.os.Looper.loop(Looper.java:136)
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-04 04:21:06.403: E/AndroidRuntime(2430): at java.lang.reflect.Method.invokeNative(Native Method)
04-04 04:21:06.403: E/AndroidRuntime(2430): at java.lang.reflect.Method.invoke(Method.java:515)
04-04 04:21:06.403: E/AndroidRuntime(2430): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-04 04:21:06.403: E/AndroidRuntime(2430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-04 04:21:06.403: E/AndroidRuntime(2430): at dalvik.system.NativeStart.main(Native Method)
04-04 04:21:06.403: E/AndroidRuntime(2430): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.foobar.app.MainActivity" on path: DexPathList[[zip file "/data/app/com.foobar.app-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.foobar.app-2, /vendor/lib, /system/lib]]
04-04 04:21:06.403: E/AndroidRuntime(2430): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-04 04:21:06.403: E/AndroidRuntime(2430): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
04-04 04:21:06.403: E/AndroidRuntime(2430): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
04-04 04:21:06.403: E/AndroidRuntime(2430): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
04-04 04:21:06.403: E/AndroidRuntime(2430): ... 11 more
ActivityManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.foobar.app" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCblB2SWMJ6E0dfQSJ_W21gZ3FRNaobvIg" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.foobar.app.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>
<activity
android:name="com.foobar.app.MapActivity"
android:label="#string/title_activity_map" >
</activity>
<activity
android:name="com.foobar.app.GPSActivity"
android:label="#string/title_activity_gps" >
</activity>
</application>
</manifest>
Thanks for your help.
Try changing the activity name in manifest as
android:name=".MainActivity"
instead of
android:name="com.foobar.app.MainActivity"
and do a clean and rebuild your project.
If this doesn't workout try renaming the package name, it should also update the manifest.
Im doing the following tutorial on creating an Android App using Google App Engine: https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial
I am using Eclipse in Windows 7. I got to the part where you run the application to display the newly uploaded information from "places.csv". The problem is I'm getting the following error:
03-15 17:00:31.137: E/AndroidRuntime(1151): FATAL EXCEPTION: main
03-15 17:00:31.137: E/AndroidRuntime(1151): Process: com.apps.mobileassistant, PID: 1151
03-15 17:00:31.137: E/AndroidRuntime(1151): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.apps.mobileassistant/com.apps.mobileassistant.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.apps.mobileassistant.MainActivity" on path: DexPathList[[zip file "/data/app/com.apps.mobileassistant-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.apps.mobileassistant-2, /system/lib]]
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2102)
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.app.ActivityThread.access$700(ActivityThread.java:135)
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.os.Handler.dispatchMessage(Handler.java:102)
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.os.Looper.loop(Looper.java:137)
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.app.ActivityThread.main(ActivityThread.java:4998)
03-15 17:00:31.137: E/AndroidRuntime(1151): at java.lang.reflect.Method.invokeNative(Native Method)
03-15 17:00:31.137: E/AndroidRuntime(1151): at java.lang.reflect.Method.invoke(Method.java:515)
03-15 17:00:31.137: E/AndroidRuntime(1151): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
03-15 17:00:31.137: E/AndroidRuntime(1151): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
03-15 17:00:31.137: E/AndroidRuntime(1151): at dalvik.system.NativeStart.main(Native Method)
03-15 17:00:31.137: E/AndroidRuntime(1151): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.apps.mobileassistant.MainActivity" on path: DexPathList[[zip file "/data/app/com.apps.mobileassistant-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.apps.mobileassistant-2, /system/lib]]
03-15 17:00:31.137: E/AndroidRuntime(1151): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-15 17:00:31.137: E/AndroidRuntime(1151): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
03-15 17:00:31.137: E/AndroidRuntime(1151): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
03-15 17:00:31.137: E/AndroidRuntime(1151): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2093)
MobileAssistant App Manifest.xml
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.apps.mobileassistant">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.INTERNET"/>
<permission android:name="com.apps.mobileassistant.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="com.apps.mobileassistant.permission.C2D_MESSAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<application android:allowBackup="true" android:icon="#drawable/ic_launcher" android:label="#string/app_name" android:theme="#style/AppTheme">
<activity android:label="#string/app_name" android:name="com.apps.mobileassistant.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<service android:name=".GCMIntentService"/>
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.apps.mobileassistant"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.apps.mobileassistant"/>
</intent-filter>
</receiver>
<activity android:launchMode="singleTop" android:name=".RegisterActivity"/>
</application>
</manifest>
Also when in debug mode I get a "Source Not Found" error in Thread[<1> main].
Can someone help me with this?
Just as it is exactly what your current message error is saying to you:
ComponentInfo{com.apps.mobileassistant/com.apps.mobileassistant.MainActivity}:
java.lang.ClassNotFoundException:
Didn't find class "com.apps.mobileassistant.MainActivity"
on path: DexPathList[[zip file "/data/app/com.apps.mobileassistant-2.apk"],
nativeLibraryDirectories=[/data/app-lib/com.apps.mobileassistant-2
You either have made some mistake on setting up your project and required library, or simply has some class missing, or has not informed in your code the respective class through import and the class name.
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"/>
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.