libgdx my first triangle tutorial not working? - android

Following the My First Triangle tutorial from this link: My First Triangle
the desktop version works perfectly fine, however when i deploy the android emulator version i get this error:
Unfortunately, MyFirstTriangleAndroid has stopped.
Any suggestions to help fix this problem? I'm using libgdx-0.9.4.
here is the catlog:
06-10 15:32:00.623: D/dalvikvm(528): Not late-enabling CheckJNI (already on)
06-10 15:32:01.653: E/dalvikvm(528): Could not find class 'com.test.myfirsttriangle.MyFirstTriangle', referenced from method com.test.myfirsttriangle.MyFirstTriangleAndroidActivity.onCreate
06-10 15:32:01.653: W/dalvikvm(528): VFY: unable to resolve new-instance 684 (Lcom/test/myfirsttriangle/MyFirstTriangle;) in Lcom/test/myfirsttriangle/MyFirstTriangleAndroidActivity;
06-10 15:32:01.653: D/dalvikvm(528): VFY: replacing opcode 0x22 at 0x0003
06-10 15:32:01.653: D/dalvikvm(528): DexOpt: unable to opt direct call 0x1c88 at 0x05 in Lcom/test/myfirsttriangle/MyFirstTriangleAndroidActivity;.onCreate
06-10 15:32:01.713: D/dalvikvm(528): Trying to load lib /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8
06-10 15:32:01.713: D/dalvikvm(528): Added shared lib /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8
06-10 15:32:01.713: D/dalvikvm(528): No JNI_OnLoad found in /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8, skipping init
06-10 15:32:01.783: D/AndroidRuntime(528): Shutting down VM
06-10 15:32:01.783: W/dalvikvm(528): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
06-10 15:32:01.793: E/AndroidRuntime(528): FATAL EXCEPTION: main
06-10 15:32:01.793: E/AndroidRuntime(528): java.lang.NoClassDefFoundError: com.test.myfirsttriangle.MyFirstTriangle
06-10 15:32:01.793: E/AndroidRuntime(528): at com.test.myfirsttriangle.MyFirstTriangleAndroidActivity.onCreate(MyFirstTriangleAndroidActivity.java:11)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.Activity.performCreate(Activity.java:4465)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.os.Looper.loop(Looper.java:137)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-10 15:32:01.793: E/AndroidRuntime(528): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 15:32:01.793: E/AndroidRuntime(528): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 15:32:01.793: E/AndroidRuntime(528): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-10 15:32:01.793: E/AndroidRuntime(528): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-10 15:32:01.793: E/AndroidRuntime(528): at dalvik.system.NativeStart.main(Native Method)
06-10 15:32:06.703: I/Process(528): Sending signal. PID: 528 SIG: 9

This tutorial is kind of outdated. Google decided to change the way dependencies are referenced, you need to go to your Android project's properties -> Java Build Path -> Order & Export tab, and make sure everything is exported (check the boxes).
I'd highly recommend reading this new article detailing the steps required to setup a libgdx project in Eclipse: http://code.google.com/p/libgdx/wiki/ProjectSetupNew?ts=1339344711&updated=ProjectSetupNew
Additionally i'd recommend going through the new developer guide wiki articles, here is the table of contents: http://code.google.com/p/libgdx/wiki/TableOfContents?tm=6

Related

AVD crashes saying 'Unfortunately, libcocos2dx has crashed'

I just loaded my app created by cocos2dx-3.10 and when I open with it an AVD (again I haven't done any modifications to the app) the app crashes and gives the error: Unfortunately, libcocos2dx has crashed.
here is what I get in my android Monitor:
03-05 18:34:56.668 1435-1435/? D/dalvikvm: Not late-enabling CheckJNI (already on)
03-05 18:34:56.989 1435-1435/com.trying.name E/Trace: error opening trace file: No such file or directory (2)
03-05 18:34:57.419 1435-1435/com.trying.name D/AndroidRuntime: Shutting down VM
03-05 18:34:57.419 1435-1435/com.trying.name W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb2f2b288)
03-05 18:34:57.518 1435-1435/com.trying.name E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: Couldn't load cocos2dcpp: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:263)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
03-05 18:35:11.559 1435-1435/? I/Process: Sending signal. PID: 1435 SIG: 9

unable connect to server from application on device

I have problem with testing my application on device.
I already successfully open the localhost in browser from my device, but when i enter my ip to connect my application with web service it didn't work.
I always get the "unfortunately, [my apps name] has stopped" message.
Anyone who knows about this problem, please help me. I really need help to solve this. thank you very much
logcat - i get it from usb debug on device
06-10 11:31:15.551: D/dalvikvm(14590): Late-enabling CheckJNI
06-10 11:31:15.809: D/TextLayoutCache(14590): Using debug level: 0 - Debug Enabled: 0
06-10 11:31:15.902: D/libEGL(14590): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
06-10 11:31:15.910: D/libEGL(14590): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
06-10 11:31:15.910: D/libEGL(14590): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
06-10 11:31:16.160: D/OpenGLRenderer(14590): Enabling debug mode 0
06-10 11:31:19.770: D/OpenGLRenderer(14590): Flushing caches (mode 0)
06-10 11:31:22.309: D/OpenGLRenderer(14590): Flushing caches (mode 0)
06-10 11:31:30.848: D/TryLoginCheck(14590): Here
06-10 11:31:30.848: I/System.out(14590): UserNametes
06-10 11:31:30.848: I/System.out(14590): passwordTes12345*
06-10 11:31:30.848: D/Parameters(14590): username=tes&password=Tes12345*
06-10 11:31:30.863: D/AndroidRuntime(14590): Shutting down VM
06-10 11:31:30.863: W/dalvikvm(14590): threadid=1: thread exiting with uncaught exception (group=0x40bd31f8)
06-10 11:31:30.863: E/AndroidRuntime(14590): FATAL EXCEPTION: main
06-10 11:31:30.863: E/AndroidRuntime(14590): android.os.NetworkOnMainThreadException
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.io.IoBridge.connect(IoBridge.java:112)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.net.Socket.connect(Socket.java:842)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:188)
06-10 11:31:30.863: E/AndroidRuntime(14590): at com.karismaelearning.Login.tryLogin(Login.java:128)
06-10 11:31:30.863: E/AndroidRuntime(14590): at com.karismaelearning.Login$3.onClick(Login.java:73)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.view.View.performClick(View.java:3558)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.view.View$PerformClick.run(View.java:14157)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.os.Handler.handleCallback(Handler.java:605)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.os.Handler.dispatchMessage(Handler.java:92)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.os.Looper.loop(Looper.java:137)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.app.ActivityThread.main(ActivityThread.java:4514)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 11:31:30.863: E/AndroidRuntime(14590): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
06-10 11:31:30.863: E/AndroidRuntime(14590): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
06-10 11:31:30.863: E/AndroidRuntime(14590): at dalvik.system.NativeStart.main(Native Method)
06-10 11:31:30.918: D/dalvikvm(14590): GC_CONCURRENT freed 237K, 6% free 6863K/7239K, paused 2ms+2ms
you are getting android.os.NetworkOnMainThreadException :
The exception that is thrown when an application attempts to perform a networking operation on its main thread.
This is only thrown for applications targeting the Honeycomb SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it's heavily discouraged.
do your code this way in side AsyncTask

Classnotfound exception while running the facebook sample app in android

Trying with the facebook sdk and want to try running the sample app profilepicture .Follow all the step of configuration given in the facebook.developer official site .While import of the facebook sdk some error and exclaimation mark came but that thing are solved .But while running the simple app profilepicture some exception are showing on the logcat.here the details of the logcat with classnotfound exception:
06-10 18:06:48.039: I/Process(621): Sending signal. PID: 621 SIG: 9
06-10 18:08:22.509: W/dalvikvm(697): Unable to resolve superclass of Lcom/facebook/samples/profilepicture/ProfilePictureSampleActivity; (59)
06-10 18:08:22.621: W/dalvikvm(697): Link of class 'Lcom/facebook/samples/profilepicture/ProfilePictureSampleActivity;' failed
06-10 18:08:22.621: D/AndroidRuntime(697): Shutting down VM
06-10 18:08:22.640: W/dalvikvm(697): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
06-10 18:08:22.689: E/AndroidRuntime(697): FATAL EXCEPTION: main
06-10 18:08:22.689: E/AndroidRuntime(697): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.facebook.samples.profilepicture/com.facebook.samples.profilepicture.ProfilePictureSampleActivity}: java.lang.ClassNotFoundException: com.facebook.samples.profilepicture.ProfilePictureSampleActivity
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.access$600(ActivityThread.java:122)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.os.Looper.loop(Looper.java:137)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.main(ActivityThread.java:4340)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 18:08:22.689: E/AndroidRuntime(697): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-10 18:08:22.689: E/AndroidRuntime(697): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-10 18:08:22.689: E/AndroidRuntime(697): at dalvik.system.NativeStart.main(Native Method)
06-10 18:08:22.689: E/AndroidRuntime(697): Caused by: java.lang.ClassNotFoundException: com.facebook.samples.profilepicture.ProfilePictureSampleActivity
06-10 18:08:22.689: E/AndroidRuntime(697): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
06-10 18:08:22.689: E/AndroidRuntime(697): ... 11 more
so can anyone tell me what will be the solution for this exception.and this exception is coming for every sample app which came with the facebook sdk.Thanks for any hint.

Could not find class 'oauth.signpost.commonshttp.CommonsHttpOAuthConsumer'

Recently, I encountered a problem,My android app always stopped unexpectedly and some errors are printed on the log.In fact, I do not know how to debug my program base on logcat which everybody I asked for help wanted.please help me!
Here's my log.
04-22 11:57:20.653: W/dalvikvm(346): VFY: unable to resolve new-instance 41 (Loauth/signpost/commonshttp/CommonsHttpOAuthConsumer;) in LOAuth4Sina/com/AuthActivity;
04-22 11:57:20.653: D/dalvikvm(346): VFY: replacing opcode 0x22 at 0x000f
04-22 11:57:20.673: D/dalvikvm(346): VFY: dead code 0x0011-0039 in LOAuth4Sina/com/AuthActivity;.onCreate (Landroid/os/Bundle;)V
04-22 11:57:20.673: I/dalvikvm(346): Could not find method oauth.signpost.OAuthProvider.setOAuth10a, referenced from method OAuth4Sina.com.AuthActivity.onNewIntent
04-22 11:57:20.693: W/dalvikvm(346): VFY: unable to resolve interface method 41: Loauth/signpost/OAuthProvider;.setOAuth10a (Z)V
04-22 11:57:20.693: D/dalvikvm(346): VFY: replacing opcode 0x72 at 0x0010
04-22 11:57:20.733: W/dalvikvm(346): VFY: unable to resolve exception class 44 (Loauth/signpost/exception/OAuthMessageSignerException;)
04-22 11:57:20.733: W/dalvikvm(346): VFY: unable to find exception handler at addr 0x68
04-22 11:57:20.733: W/dalvikvm(346): VFY: rejected LOAuth4Sina/com/AuthActivity;.onNewIntent (Landroid/content/Intent;)V
04-22 11:57:20.766: W/dalvikvm(346): VFY: rejecting opcode 0x0d at 0x0068
04-22 11:57:20.766: W/dalvikvm(346): VFY: rejected LOAuth4Sina/com/AuthActivity;.onNewIntent (Landroid/content/Intent;)V
04-22 11:57:20.766: W/dalvikvm(346): Verifier rejected class LOAuth4Sina/com/AuthActivity;
04-22 11:57:20.766: W/dalvikvm(346): Class init failed in newInstance call (LOAuth4Sina/com/AuthActivity;)
04-22 11:57:20.785: D/AndroidRuntime(346): Shutting down VM
04-22 11:57:20.785: W/dalvikvm(346): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-22 11:57:20.812: E/AndroidRuntime(346): FATAL EXCEPTION: main
04-22 11:57:20.812: E/AndroidRuntime(346): java.lang.VerifyError: OAuth4Sina.com.AuthActivity
04-22 11:57:20.812: E/AndroidRuntime(346): at java.lang.Class.newInstanceImpl(Native Method)
04-22 11:57:20.812: E/AndroidRuntime(346): at java.lang.Class.newInstance(Class.java:1429)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.os.Handler.dispatchMessage(Handler.java:99)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.os.Looper.loop(Looper.java:123)
04-22 11:57:20.812: E/AndroidRuntime(346): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-22 11:57:20.812: E/AndroidRuntime(346): at java.lang.reflect.Method.invokeNative(Native Method)
04-22 11:57:20.812: E/AndroidRuntime(346): at java.lang.reflect.Method.invoke(Method.java:521)
04-22 11:57:20.812: E/AndroidRuntime(346): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-22 11:57:20.812: E/AndroidRuntime(346): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-22 11:57:20.812: E/AndroidRuntime(346): at dalvik.system.NativeStart.main(Native Method)

Problem inflating MapView

I'm going through the documentation at Hello, MapView to add a MapView to my Activity.
When I launch my Activity, I get an inflation error on the MapView.
Here is the MapView in my layout xml:
<com.google.android.maps.MapView
android:id="#+id/mymap"
android:layout_width="fill_parent"
android:layout_height="200dip"
android:clickable="true"
android:apiKey="withheld"
/>
Here is the code in my MapActivity (the class is named ActivityDetails and extends MapActivity) class:
MapView mMap;
mMap = (MapView) findViewById(R.id.mymap);
mMap.setBuiltInZoomControls(true);
Here is the error:
06-10 09:15:24.277: ERROR/AndroidRuntime(228): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.my.app.activity.ActivityDetails}: android.view.InflateException: Binary XML file line #35: Error inflating class com.google.android.maps.MapView
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.os.Looper.loop(Looper.java:123)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.main(ActivityThread.java:4363)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Method.invoke(Method.java:521)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at dalvik.system.NativeStart.main(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class com.google.android.maps.MapView
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.Activity.setContentView(Activity.java:1622)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.my.app.activity.ActivityDetails.onCreate(ActivityDetails.java:128)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 11 more
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: java.lang.reflect.InvocationTargetException
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:237)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Constructor.constructNative(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 23 more
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: java.lang.NullPointerException
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapActivity.setupMapView(MapActivity.java:183)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:279)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:254)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 27 more
As far as I can tell, I've done everything correct as described in the documentation. I've set my build target to Google APIs, I've added the uses-library tag to my Manifest, I'm running in an emulator with the Google API target...
The problem was I was calling super.onCreate() after setContentView() in the MapActivity.
You are using the wrong xml for your MapView
The class extending the MapActivity should call setContentView() with the xml containing stuff like this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/racemap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_x="0px"
android:enabled="true"
android:clickable="true"
android:apiKey="blahblahblah" />
</LinearLayout>
So instead of using layout_details.xml use layout.xml
Insert this on your xml declaration of the MapView
xmlns:android="http://schemas.android.com/apk/res/android"

Categories

Resources