Android Unexpected Shutdown - android

I've tried to get some data from the nasa rss ( I'm following Android HeadFirst book ) using the Simple Framework.
The problem that I face is that the application closes down automatically when the main activity is loaded.
Here is the code :
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
print();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
and here is the print method:
public void print() throws Exception
{
Rss rss = new Rss();
Serializer serializer = new Persister();
File source = new File("http://www.nasa.gov/rss/dyn/image_of_the_day.rss");
serializer.read(rss, source);
TextView text = (TextView) this.findViewById(R.id.imageTitle);
text.setText(rss.channel.title);
}
logcat:
> 12-11 18:27:03.459: D/AndroidRuntime(20621): Shutting down VM
12-11 18:27:03.459: W/dalvikvm(20621): threadid=1: thread exiting with uncaught exception (group=0x400205a0)
12-11 18:27:03.469: E/AndroidRuntime(20621): FATAL EXCEPTION: main
12-11 18:27:03.469: E/AndroidRuntime(20621): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.nasadailyimage/com.example.nasadailyimage.MainActivity}: java.lang.ClassNotFoundException: com.example.nasadailyimage.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.nasadailyimage-1.apk]
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1743)
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.os.Handler.dispatchMessage(Handler.java:99)
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.os.Looper.loop(Looper.java:150)
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.app.ActivityThread.main(ActivityThread.java:4277)
12-11 18:27:03.469: E/AndroidRuntime(20621): at java.lang.reflect.Method.invokeNative(Native Method)
12-11 18:27:03.469: E/AndroidRuntime(20621): at java.lang.reflect.Method.invoke(Method.java:507)
12-11 18:27:03.469: E/AndroidRuntime(20621): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-11 18:27:03.469: E/AndroidRuntime(20621): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-11 18:27:03.469: E/AndroidRuntime(20621): at dalvik.system.NativeStart.main(Native Method)
12-11 18:27:03.469: E/AndroidRuntime(20621): Caused by: java.lang.ClassNotFoundException: com.example.nasadailyimage.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.nasadailyimage-1.apk]
12-11 18:27:03.469: E/AndroidRuntime(20621): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
12-11 18:27:03.469: E/AndroidRuntime(20621): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
12-11 18:27:03.469: E/AndroidRuntime(20621): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
12-11 18:27:03.469: E/AndroidRuntime(20621): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1735)
12-11 18:27:03.469: E/AndroidRuntime(20621): ... 11 more
Here is the manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nasadailyimage"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.nasadailyimage.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>
I've create a brand new android project. And it works
However even if I remove all the libraries I added ( simple.org) and if I comment out everything that I've added in MainActivity.java is still makes the application close down
I have been able to observe that the line:
Serializer serialezer = new Persister();
causes the error. Is the framework simple used for android applications? Does it usually cause these kind of errors?
Update
I have also tried different versions of the jar.
None seem to work
Closing Eclipse does not help whatsoever
The program only runs when the Serializer line is commented out

The line
Serializer ser = new Persister();
is what causes the error. I don't have the smallest idea weather the simple Framework is causing this somehow.

Related

java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer"

I recently moved to MoPub and it all appears to be working well except for I have started getting this exception saying that com.millennialmedia.android.VideoPlayer can not be found. I looked and it isn't on the Millennial jar (I just got the latest from their site). Also my AndroidManifest mentions that class and Android Studio also says it can't be found.
This is what I have there:
<activity android:name="com.millennialmedia.android.MMActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|keyboard" />
<activity android:name="com.millennialmedia.android.VideoPlayer" android:configChanges="keyboardHidden|orientation|keyboard" />
On Android Studio the VideoPlayer part is red.
This is the exception I got:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{mypackage/com.millennialmedia.android.VideoPlayer}: java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer" on path: /data/app/mypackage-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Method.java)
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(NativeStart.java)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer" on path: /data/app/mypackage-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Method.java)
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(NativeStart.java)
Looking at the latest Millennial Media documentation, it looks like
com.millennialmedia.android.VideoPlayer
isn't included. This may be an update that needs to be made.
Alice

Android 5.0.1 app stops and returns InvocationTargetException Error

I have built an Android app that until updating the Android API, from 19 to 21, ran successfully. Now when I run the app, the login page does appear, but just as a user logs in and starts the MainActivity, the app crashes stating 'App has stopped', while the error is thrown:
12-11 17:46:21.411: E/ActivityThread(12327): Pause GC
12-11 17:46:21.411: E/ActivityThread(12327): java.lang.reflect.InvocationTargetException
12-11 17:46:21.411: E/ActivityThread(12327): at java.lang.reflect.Method.invokeNative(Native Method)
12-11 17:46:21.411: E/ActivityThread(12327): at java.lang.reflect.Method.invoke(Method.java:515)
12-11 17:46:21.411: E/ActivityThread(12327): at android.app.ActivityThread.pauseGC(ActivityThread.java:5410)
12-11 17:46:21.411: E/ActivityThread(12327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2277)
12-11 17:46:21.411: E/ActivityThread(12327): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
12-11 17:46:21.411: E/ActivityThread(12327): at android.app.ActivityThread.access$900(ActivityThread.java:169)
12-11 17:46:21.411: E/ActivityThread(12327): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
12-11 17:46:21.411: E/ActivityThread(12327): at android.os.Handler.dispatchMessage(Handler.java:102)
12-11 17:46:21.411: E/ActivityThread(12327): at android.os.Looper.loop(Looper.java:146)
12-11 17:46:21.411: E/ActivityThread(12327): at android.app.ActivityThread.main(ActivityThread.java:5487)
12-11 17:46:21.411: E/ActivityThread(12327): at java.lang.reflect.Method.invokeNative(Native Method)
12-11 17:46:21.411: E/ActivityThread(12327): at java.lang.reflect.Method.invoke(Method.java:515)
12-11 17:46:21.411: E/ActivityThread(12327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
12-11 17:46:21.411: E/ActivityThread(12327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
12-11 17:46:21.411: E/ActivityThread(12327): at dalvik.system.NativeStart.main(Native Method)
12-11 17:46:21.411: E/ActivityThread(12327): Caused by: java.lang.UnsatisfiedLinkError: Native method not found: dalvik.system.VMRuntime.pauseGc:(Ljava/lang/String;)I
12-11 17:46:21.411: E/ActivityThread(12327): at dalvik.system.VMRuntime.pauseGc(Native Method)
12-11 17:46:21.411: E/ActivityThread(12327): ... 15 more
12-11 17:46:21.446: D/AndroidRuntime(12327): Shutting down VM
12-11 17:46:21.446: W/dalvikvm(12327): threadid=1: thread exiting with uncaught exception (group=0x41daec08)
12-11 17:46:21.451: E/AndroidRuntime(12327): FATAL EXCEPTION: main
12-11 17:46:21.451: E/AndroidRuntime(12327): Process: com.example.feastapp, PID: 12327
12-11 17:46:21.451: E/AndroidRuntime(12327): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.feastapp/com.example.feastapp.MainActivity}: java.lang.NullPointerException
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.app.ActivityThread.access$900(ActivityThread.java:169)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.os.Handler.dispatchMessage(Handler.java:102)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.os.Looper.loop(Looper.java:146)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.app.ActivityThread.main(ActivityThread.java:5487)
12-11 17:46:21.451: E/AndroidRuntime(12327): at java.lang.reflect.Method.invokeNative(Native Method)
12-11 17:46:21.451: E/AndroidRuntime(12327): at java.lang.reflect.Method.invoke(Method.java:515)
12-11 17:46:21.451: E/AndroidRuntime(12327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
12-11 17:46:21.451: E/AndroidRuntime(12327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
12-11 17:46:21.451: E/AndroidRuntime(12327): at dalvik.system.NativeStart.main(Native Method)
12-11 17:46:21.451: E/AndroidRuntime(12327): Caused by: java.lang.NullPointerException
12-11 17:46:21.451: E/AndroidRuntime(12327): at com.example.feastapp.MainActivity.onCreate(MainActivity.java:77)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.app.Activity.performCreate(Activity.java:5451)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
12-11 17:46:21.451: E/AndroidRuntime(12327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
12-11 17:46:21.451: E/AndroidRuntime(12327): ... 11 more
This is a very perplexing situation as just before the update, the app ran just fine. Absolutely no changes were made to the code. At present, the login page can appear but when entering credentials and pressing send the app crashes immediately. Any Idea on how to alleviate?

Unable to resolve superclass of FragmentActivity

I had my environment setup on a previous machine, and I'm on a differnt MacBook. For some strange reason, I keep getting an issue with one of my classes which exend FragmentActivity. It keeps saying it can't find the FragmentActivity class, although I have the support jar in my class path, as per the image:
The detailed error message that I'm seeing is here:
10-23 23:10:16.300 26062-26062/com.testapp W/dalvikvm﹕ Unable to resolve superclass of Lcom/testapp/views/loginregistration/LoginView; (92)
10-23 23:10:16.300 26062-26062/com.testapp W/dalvikvm﹕ Link of class 'Lcom/testapp/views/loginregistration/LoginView;' failed
10-23 23:10:16.300 26062-26062/com.testapp D/AndroidRuntime﹕ Shutting down VM
10-23 23:10:16.300 26062-26062/com.testapp W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x414f8700)
10-23 23:10:16.330 26062-26062/com.testapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.testapp/com.testapp.views.loginregistration.LoginView}: java.lang.ClassNotFoundException: Didn't find class "com.testapp.views.loginregistration.LoginView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.testapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.testapp-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.testapp.views.loginregistration.LoginView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.testapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.testapp-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Is there someting else i'm missing?
In your IDE (as shown in your screenshot), check the 'export' box next to the classpath entry that contains the missing class.
I had a similar problem with a class from the Android Support library (Unable to resolve superclass of Lcom ... PagerAdapter). It turned out a library referenced in the .classpath needed to be exported:
From:
<classpathentry
To:
<classpathentry exported="true" ...
For Eclipse users, I fixed the problem by exporting Android Private Libraries in the Java Build Path menu.

AndroidActivity extends GameBaseActivity crashes

I am having a class
public class GameActivity extends Activity implements
GLSurfaceView.Renderer, OnTouchListener{
The code does not have any problems, all needed methods are implemented. When I start the Activity it crashes with the following message:
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{[left out].GameActivity}:
java.lang.ClassNotFoundException: Didn't find class "...GameActivity"
on path [...]
I want to integreate the Google Game Service and Achievements in my game. Therefore I added the libary project and the GameBaseUtils as projects and also checkt that they should be exported inside my generated apk file. It compiles, the .jar for the google play services is also uploaded and will b e found. All includes are working. But when I start the game, it crashed immediately with the error message above.
I followed the tutorials on developers.android.com https://developers.google.com/games/services/android/init
Can someone tell me what I am doing wrong? Here is my Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package=""
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<!--
Tell the market, that the the app requires at least OpenGLES 2.0
This is not really the truth but it will decrease the rate of error
-->
<uses-feature android:glEsVersion="0x00020000"
android:required="true" />
<!-- Maybe not neccessary -->
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/> -->
<application
android:allowBackup="true"
android:icon="#drawable/launcher_icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="sensorLandscape" >
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="13465798" />
<activity
android:name="GameActivity"
android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- For the implementation of Adds in this App -->
</application>
</manifest>
Edit: Locat output
07-21 01:13:47.730: W/dalvikvm(22578): Unable to resolve superclass of
LGameActivity; (1182) 07-21 01:13:47.730:
W/dalvikvm(22578): Link of class
'L/GameActivity;' failed 07-21 01:13:47.730:
D/AndroidRuntime(22578): Shutting down VM 07-21 01:13:47.730:
W/dalvikvm(22578): threadid=1: thread exiting with uncaught exception
(group=0x4159f930) 07-21 01:13:47.746: E/AndroidRuntime(22578): FATAL
EXCEPTION: main 07-21 01:13:47.746: E/AndroidRuntime(22578):
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{GameActivity}:
java.lang.ClassNotFoundException: Didn't find class
"GameActivity" on path:
.apk 07-21 01:13:47.746:
E/AndroidRuntime(22578): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
android.app.ActivityThread.access$600(ActivityThread.java:141) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
android.os.Handler.dispatchMessage(Handler.java:99) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
android.os.Looper.loop(Looper.java:137) 07-21 01:13:47.746:
E/AndroidRuntime(22578): at
android.app.ActivityThread.main(ActivityThread.java:5041) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
java.lang.reflect.Method.invokeNative(Native Method) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
java.lang.reflect.Method.invoke(Method.java:511) 07-21 01:13:47.746:
E/AndroidRuntime(22578): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
dalvik.system.NativeStart.main(Native Method) 07-21 01:13:47.746:
E/AndroidRuntime(22578): Caused by: java.lang.ClassNotFoundException:
Didn't find class "GameActivity" on path:
-1.apk 07-21 01:13:47.746:
E/AndroidRuntime(22578): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
android.app.Instrumentation.newActivity(Instrumentation.java:1054)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
07-21 01:13:47.746: E/AndroidRuntime(22578): ... 11 more
I've found the error:
I had to mark both projects I am using for the app (GameBaseUtils and google-play-services_lib) as a libary project and add them to android libaries I want to use. The rest is handled by android on its own.

Classnot found exception while dealing with android admob Banner

I am getting this very annoying error in LogCat
12-11 13:40:53.178: E/AndroidRuntime(4483): FATAL EXCEPTION: main
12-11 13:40:53.178: E/AndroidRuntime(4483): java.lang.RuntimeException: Unable to resume activity {com.vahzay.android.smstrove/com.vahzay.android.smstrove.ListMessages}: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2491)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2519)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2033)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.ActivityThread.access$600(ActivityThread.java:127)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1179)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.os.Handler.dispatchMessage(Handler.java:99)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.os.Looper.loop(Looper.java:137)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.ActivityThread.main(ActivityThread.java:4508)
12-11 13:40:53.178: E/AndroidRuntime(4483): at java.lang.reflect.Method.invokeNative(Native Method)
12-11 13:40:53.178: E/AndroidRuntime(4483): at java.lang.reflect.Method.invoke(Method.java:511)
12-11 13:40:53.178: E/AndroidRuntime(4483): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
12-11 13:40:53.178: E/AndroidRuntime(4483): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
12-11 13:40:53.178: E/AndroidRuntime(4483): at dalvik.system.NativeStart.main(Native Method)
12-11 13:40:53.178: E/AndroidRuntime(4483): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.view.LayoutInflater.rInflate(LayoutInflater.java:741)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-11 13:40:53.178: E/AndroidRuntime(4483): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:252)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.Activity.setContentView(Activity.java:1837)
12-11 13:40:53.178: E/AndroidRuntime(4483): at com.vahzay.android.smstrove.ListMessages.onResume(ListMessages.java:650)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1159)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.Activity.performResume(Activity.java:4553)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2481)
12-11 13:40:53.178: E/AndroidRuntime(4483): ... 12 more
12-11 13:40:53.178: E/AndroidRuntime(4483): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView
12-11 13:40:53.178: E/AndroidRuntime(4483): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-11 13:40:53.178: E/AndroidRuntime(4483): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-11 13:40:53.178: E/AndroidRuntime(4483): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.view.LayoutInflater.createView(LayoutInflater.java:554)
12-11 13:40:53.178: E/AndroidRuntime(4483): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
12-11 13:40:53.178: E/AndroidRuntime(4483): ... 22 more
I have included the admob-sdk-android.jar through order and import from
properties-->android-->java Build Path.
Is there something else I need to deal with to add adds in my app? My Xml file has following code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android1="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000" >
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="xxxx"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR"
ads:loadAdOnCreate="true"/> ...
I am able to resolve the problem by adding GoogleAdMobAdsSdk.jar in my project/libs folder.

Categories

Resources