I'm new to Android development and I'm having a weird issue. I am trying to pull and display calendar events from an AsyncTask. This works in debug mode, but if I try to install the application through the apk the application crashes with this error :
12-18 08:57:16.768: E/AndroidRuntime(8642): FATAL EXCEPTION: AsyncTask #2
12-18 08:57:16.768: E/AndroidRuntime(8642): java.lang.RuntimeException: An error occured while executing doInBackground()
12-18 08:57:16.768: E/AndroidRuntime(8642): at android.os.AsyncTask$3.done(AsyncTask.java:299)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
12-18 08:57:16.768: E/AndroidRuntime(8642): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.lang.Thread.run(Thread.java:856)
12-18 08:57:16.768: E/AndroidRuntime(8642): Caused by: java.lang.IllegalArgumentException: unable to create new instance of class com.a.b.b.a.a.b because it has no accessible default constructor
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.e.aa.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.e.aa.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.e.i.b(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source) 12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.g.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.f.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.d.f.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.c.t.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.a.b.a.b.d.c.d(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.promevo.bookit.a.f(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.promevo.bookit.a.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.promevo.bookit.f.a(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at com.promevo.bookit.f.doInBackground(Unknown Source)
12-18 08:57:16.768: E/AndroidRuntime(8642): at android.os.AsyncTask$2.call(AsyncTask.java:287)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
12-18 08:57:16.768: E/AndroidRuntime(8642): ... 5 more
12-18 08:57:16.768: E/AndroidRuntime(8642): Caused by: java.lang.InstantiationException: can't instantiate class com.a.b.b.a.a.b; no empty constructor
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.lang.Class.newInstanceImpl(Native Method)
12-18 08:57:16.768: E/AndroidRuntime(8642): at java.lang.Class.newInstance(Class.java:1319)
The call that I am making :
Events feed = client.events().list(CalendarSampleActivity.getCalId()).setTimeMin(startPass)
.setTimeMax(endPass).setSingleEvents(true).execute();
Anyone have any ideas? Thanks in advance.
Ok so after some troubleshooting it seems that something is going wrong when using Proguard. If I remove this line from my project.properties file, my application now works:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt
Anyone know exactly why this would make a difference?
Read about Proguard and Android here: http://developer.android.com/tools/help/proguard.html
Since you are getting a "No accessible default constructor" exception it is most likely that Proguard has removed this constructor from the package because it couldn't find users of this constructor (Proguard removes inaccessible or unused code from the package to make it smaller). You will have to tell Proguard to keep certain code in the package even though it isn't obviously used.
The other alternative is to disable Proguard for release builds.
Related
I made sure the key hash I send to Facebook is the same as defined in the app settings on Facebook.
I added the following to the proguard-project.txt file:
-keep class com.facebook.** { *; }
-keepattributes Signature
and still I get the following error when my app starts:
com.facebook.as: com.facebook.c.f got an unexpected method signature: public abstract org.json.JSONObject com.facebook.c.c.c() at com.facebook.c.h.a(Unknown Source) at com.facebook.c.f.b(Unknown Source) at com.facebook.c.f.invoke(Unknown Source) at $Proxy0.c(Native Method) at com.facebook.b.bo.a(Unknown Source) at com.facebook.b.bo.onPostExecute(Unknown Source) at android.os.AsyncTask.finish(AsyncTask.java:632) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5118) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610) at dalvik.system.NativeStart.main(Native Method) java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: com.facebook.as: com.facebook.c.f got an unexpected method signature: public abstract org.json.JSONObject com.facebook.c.c.c() at com.facebook.c.h.a(Unknown Source) at com.facebook.c.f.b(Unknown Source) at com.facebook.c.f.invoke(Unknown Source) at $Proxy0.c(Native Method) at com.facebook.b.bn.a(Unknown Source) at com.facebook.widget.c.a(Unknown Source) at com.facebook.widget.c.doInBackground(Unknown Source) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) ... 4 more
What am I doing wrong?
I'm trying to integrate Facebook into my app and whenever the app starts, I get the following error:
com.facebook.as: com.facebook.c.f got an unexpected method signature: public abstract org.json.JSONObject com.facebook.c.c.c() at com.facebook.c.h.a(Unknown Source) at com.facebook.c.f.b(Unknown Source) at com.facebook.c.f.invoke(Unknown Source) at $Proxy0.c(Native Method) at com.facebook.b.bo.a(Unknown Source) at com.facebook.b.bo.onPostExecute(Unknown Source) at android.os.AsyncTask.finish(AsyncTask.java:632) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5118) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610) at dalvik.system.NativeStart.main(Native Method) java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: com.facebook.as: com.facebook.c.f got an unexpected method signature: public abstract org.json.JSONObject com.facebook.c.c.c() at com.facebook.c.h.a(Unknown Source) at com.facebook.c.f.b(Unknown Source) at com.facebook.c.f.invoke(Unknown Source) at $Proxy0.c(Native Method) at com.facebook.b.bn.a(Unknown Source) at com.facebook.widget.c.a(Unknown Source) at com.facebook.widget.c.doInBackground(Unknown Source) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) ... 4 more
Reading on the internet made me realize that it relates to proguard so I added the following to proguard-project.txt as instructed:
-keep class com.facebook.** { *; }
-keepattributes Signature
but the same happens... what am I missing?
I have an app that use Camera API that works perfectly on a nexus 7 with kitkat, but after update to lollipop my app crash.
I've decide to use new Camera2 API without success: code works well on a nexus5 but fail on nexus 7.
So i would use old API until i find out where's the problem with new api.
Portion of code that crash is when i initialize camera surface:
#SuppressWarnings("deprecation")
#SuppressLint("InlinedApi")
#Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
Camera.Parameters params = mCamera.getParameters();
Camera.Size result = getBestPreviewSize(params, width, height);
Log.i("TAG", surfaceView.getWidth() + " " + surfaceView.getHeight());
params.setPreviewSize(result.width, result.height);
params.setPictureFormat(ImageFormat.JPEG);
params.setJpegQuality(100);
params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
// params.setFlashMode(Camera.Parameters.FLASH_MODE_ON);
// params.setp
params.setPictureSize(dpWidth, dpWidth);
// default orientation is in landscape
params.setRotation(90);
mCamera.setParameters(params);
mCamera.startPreview();
}
crash is on setParameters() instruction:
12-18 10:44:54.130: E/AndroidRuntime(31543): FATAL EXCEPTION: main
12-18 10:44:54.130: E/AndroidRuntime(31543): Process: it.ictinnova.hipstamemostylist, PID: 31543
12-18 10:44:54.130: E/AndroidRuntime(31543): java.lang.RuntimeException: setParameters failed
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.hardware.Camera.native_setParameters(Native Method)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.hardware.Camera.setParameters(Camera.java:1876)
12-18 10:44:54.130: E/AndroidRuntime(31543): at it.ictinnova.hipstamemostylist.ScattaFoto.surfaceChanged(ScattaFoto.java:137)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.SurfaceView.updateWindow(SurfaceView.java:590)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:176)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1956)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.Choreographer.doCallbacks(Choreographer.java:580)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.Choreographer.doFrame(Choreographer.java:550)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.os.Handler.handleCallback(Handler.java:739)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.os.Handler.dispatchMessage(Handler.java:95)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.os.Looper.loop(Looper.java:135)
12-18 10:44:54.130: E/AndroidRuntime(31543): at android.app.ActivityThread.main(ActivityThread.java:5221)
12-18 10:44:54.130: E/AndroidRuntime(31543): at java.lang.reflect.Method.invoke(Native Method)
12-18 10:44:54.130: E/AndroidRuntime(31543): at java.lang.reflect.Method.invoke(Method.java:372)
12-18 10:44:54.130: E/AndroidRuntime(31543): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
12-18 10:44:54.130: E/AndroidRuntime(31543): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
What's wrong?
this is the same code i used on kitcat
what returns if there is not best preview size in the function of getBestPreviewSize().maybe,code control resolution of the display and the real machine test resolution is different.
try to annotate the code "params.setPreviewSize(result.width, result.height);" and run the code.
I have a problem with my app. I searched for a solution on stackoverflow, but i didn't find one.
I'm still a beginner in developing android apps. I created my first app on my own in the last week.
The problem: When I start the app everything works fine. Also when I start my app, go to menu and resume immediately, but when i switch to menu, clean my memory and then restart my app, it seems, that the app was still running, because it crashes now. I have a similar effect when I start the app, switch to some other apps and then return to my app. In this case, the app also crashes.
So, why the app is still running, altough I cleaned my memory? Should I override onFinish()- or onPause()-method with some basic code I don't know?
And why does the app crash, when i don't use it for a while?
LogCat:
12-18 23:19:06.850: E/AndroidRuntime(25262): FATAL EXCEPTION: main
12-18 23:19:06.850: E/AndroidRuntime(25262): java.lang.NullPointerException
12-18 23:19:06.850: E/AndroidRuntime(25262): at de.dzapps.isoapp.IsoToleranzen.update(IsoToleranzen.java:1293)
12-18 23:19:06.850: E/AndroidRuntime(25262): at de.dzapps.isoapp.IsoToleranzen$4.onItemClick(IsoToleranzen.java:441)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.widget.AbsListView.performItemClick(AbsListView.java:1283)
12-18 23:19:06.850: E/AndroidRuntime(25262): at de.dzapps.isoapp.IsoToleranzen$1.onGlobalLayout(IsoToleranzen.java:174)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:682)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1875)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1131)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4611)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.view.Choreographer.doFrame(Choreographer.java:525)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.os.Handler.handleCallback(Handler.java:615)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.os.Handler.dispatchMessage(Handler.java:92)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.os.Looper.loop(Looper.java:137)
12-18 23:19:06.850: E/AndroidRuntime(25262): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-18 23:19:06.850: E/AndroidRuntime(25262): at java.lang.reflect.Method.invokeNative(Native Method)
12-18 23:19:06.850: E/AndroidRuntime(25262): at java.lang.reflect.Method.invoke(Method.java:511)
12-18 23:19:06.850: E/AndroidRuntime(25262): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
12-18 23:19:06.850: E/AndroidRuntime(25262): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
12-18 23:19:06.850: E/AndroidRuntime(25262): at dalvik.system.NativeStart.main(Native Method)
Since I get a NullPointerException, it seems, that the system deletes the variables...
But when I doubleclick the third line, eclipse marks this line:
int am_offset = list.getChildAt(0).getTop();
I can't explain this behaviour, because I set a breakpoint at this line and the system never call this expression when I resume the app. list is a ListView.
How can I prevent, that the system deletes the variables, when then app is not used for a while?
Can somebody help me?
Many thanks!
From what I've read, the system deleting variables should be more or less left alone as the system does what it must to keep device performance. It may help to avoid these NullPointerExceptions and restore state by writing safety checks in the onResume of the activity to recreate any lost variables. Also, if they hold data that must persist for long periods of time, SharedPreferences may be of some use for small values and an SQLiteDatabase for when there's a lot to save.
ok I have a solution. I replaced int am_offset = list.getChildAt(0).getTop(); with:
View am_top = list.getChildAt(0);
am_offset = (am_top == null) ? 0 : am_top.getTop();
Now I don't get an exception anymore.
But can somebody explain to me, why the system throws an exception, altough int am_offset = list.getChildAt(0).getTop(); is never called while resuming?
Many thanks!
I have an activity, what I'm trying to do is to start a new activity that holds a Google Maps Fragment API v2 following this example (https://developers.google.com/maps/documentation/android/start). I get an runtime error
"Binary XML file line #4: Error inflating class fragment"
This the XML of activity:
<?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" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>
and this is the activity's class:
import android.app.Activity;
import android.os.Bundle;
public class MapsActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_act);
// TODO Auto-generated method stub
}
}
and this is the logcat:
12-18 11:59:37.584: W/dalvikvm(9480): threadid=1: thread exiting with uncaught exception (group=0x2b6a3300)
12-18 11:59:37.594: E/AndroidRuntime(9480): FATAL EXCEPTION: main
12-18 11:59:37.594: E/AndroidRuntime(9480): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dimacroitori.supermarket/com.dimacroitori.supermarket.MapsActivity}: android.view.InflateException: Binary XML file line #4: Error inflating class fragment
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2190)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2215)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.access$600(ActivityThread.java:144)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.os.Handler.dispatchMessage(Handler.java:99)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.os.Looper.loop(Looper.java:137)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.main(ActivityThread.java:4939)
12-18 11:59:37.594: E/AndroidRuntime(9480): at java.lang.reflect.Method.invokeNative(Native Method)
12-18 11:59:37.594: E/AndroidRuntime(9480): at java.lang.reflect.Method.invoke(Method.java:511)
12-18 11:59:37.594: E/AndroidRuntime(9480): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
12-18 11:59:37.594: E/AndroidRuntime(9480): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
12-18 11:59:37.594: E/AndroidRuntime(9480): at dalvik.system.NativeStart.main(Native Method)
12-18 11:59:37.594: E/AndroidRuntime(9480): Caused by: android.view.InflateException: Binary XML file line #4: Error inflating class fragment
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-18 11:59:37.594: E/AndroidRuntime(9480): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:257)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Activity.setContentView(Activity.java:1867)
12-18 11:59:37.594: E/AndroidRuntime(9480): at com.exmaple.MapsActivity.onCreate(MapsActivity.java:12)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Activity.performCreate(Activity.java:5008)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
12-18 11:59:37.594: E/AndroidRuntime(9480): ... 11 more
12-18 11:59:37.594: E/AndroidRuntime(9480): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Fragment.instantiate(Fragment.java:584)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Fragment.instantiate(Fragment.java:552)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Activity.onCreateView(Activity.java:4656)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
12-18 11:59:37.594: E/AndroidRuntime(9480): ... 20 more
12-18 11:59:37.594: E/AndroidRuntime(9480): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
12-18 11:59:37.594: E/AndroidRuntime(9480): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-18 11:59:37.594: E/AndroidRuntime(9480): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-18 11:59:37.594: E/AndroidRuntime(9480): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-18 11:59:37.594: E/AndroidRuntime(9480): at android.app.Fragment.instantiate(Fragment.java:574)
12-18 11:59:37.594: E/AndroidRuntime(9480): ... 23 more
Can someone explain me what I'm doing wrong?
Make sure that you have added the Google Play Services Android library project to your application, where that class is defined. Also make sure that you are running your app on an API Level 11 or higher environment, since you are attempting to use native fragments (rather than the Android Support package's backport).