i want to open a map when i click a button but unfortunately my app forces down...this is my logcat:
01-31 18:11:49.465: VERBOSE/InputDevice(2836): ID[0]=0(0) Up(1=>0)
01-31 18:11:49.606: WARN/dalvikvm(6111): Class resolved by unexpected DEX: Lkostas/menu/olympiakos/GoogleMaps;(0x486356d8):0x22f5d8 ref [Lcom/google/android/maps/MapActivity;] Lcom/google/android/maps/MapActivity;(0x486356d8):0x21dca0
01-31 18:11:49.606: WARN/dalvikvm(6111): (Lkostas/menu/olympiakos/GoogleMaps; had used a different Lcom/google/android/maps/MapActivity; during pre-verification)
01-31 18:11:49.606: WARN/dalvikvm(6111): Unable to resolve superclass of Lkostas/menu/olympiakos/GoogleMaps; (67)
01-31 18:11:49.606: WARN/dalvikvm(6111): Link of class 'Lkostas/menu/olympiakos/GoogleMaps;' failed
01-31 18:11:49.610: DEBUG/AndroidRuntime(6111): Shutting down VM
01-31 18:11:49.610: WARN/dalvikvm(6111): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): FATAL EXCEPTION: main
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): java.lang.NoClassDefFoundError: kostas.menu.olympiakos.GoogleMaps
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at kostas.menu.olympiakos.DialogActivity$1.onItemClick(DialogActivity.java:47)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.widget.ListView.performItemClick(ListView.java:3672)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.os.Handler.handleCallback(Handler.java:587)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.os.Handler.dispatchMessage(Handler.java:92)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.os.Looper.loop(Looper.java:123)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at java.lang.reflect.Method.invokeNative(Native Method)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at java.lang.reflect.Method.invoke(Method.java:521)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at dalvik.system.NativeStart.main(Native Method)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at dalvik.system.DexFile.defineClass(Native Method)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:209)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-31 18:11:49.641: ERROR/AndroidRuntime(6111): ... 13 more
01-31 18:11:49.660: WARN/ActivityManager(2836): Force finishing activity kostas.menu.olympiakos/.DialogActivity
thats the way i m calling the map activity:
Intent newActivity111 = new Intent(DialogActivity.this, GoogleMaps.class);
startActivity(newActivity111);
Somehow, your device or emulator has a different implementation of com.google.android.maps.MapActivity than what your compiler used. That should not be possible under normal circumstances. It suggests that you have seriously messed up your build process, such as manually adding the Maps add-on JAR to your build path rather than just setting a Maps-enabled target.
Not too sure whether your problem is related to the libraries available.
Map library is not part of the Standard Android library. Hence you need to declare it in the Manifest file.
Follow the link: http://developer.android.com/resources/tutorials/views/hello-mapview.html
Since the library is not available your Activity "GoogleMaps" which extends MapActivity doesn't get loaded into the system.
All the questions and answers related to getting the Fatal Exception java.lang.NoClassDefFoundError when using a MapActivity did not help me. CommonsWare's response gave me a hint that helped me arrive at my solution.
When I copied my project to a new environment, my setup did not include the Google Maps library. I added the maps.jar file manually into my project and was able to link the application successfully but when I attempted to start the activity that derived from MapActivity I got the fatal exception.
I removed the reference to the maps.jar library. I then noticed I was building against the Android 2.2 SDK. I did not have the Google APIs SDK installed. After downloading and installing the Google APIs SDK, and specifying this SDK as my target, my problem went away.
Related
I am writing an app which works fine. There are a lot of activities. Every activity runs in landscape mode. Now suppose that user is seeing an activity and he presses device's power button, now the device is in sleep mode.
But when he again presses the power button the device wakes up, now my app should continue from where user left it but my app just closes down without even a force close message, means user suddenly comes to Home Screen.
In logcat it shows the following error -
01-31 12:22:40.010: E/AndroidRuntime(10591): FATAL EXCEPTION: main
01-31 12:22:40.010: E/AndroidRuntime(10591): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.reflexapp/com.example.reflexapp.Login}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030023
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.ActivityThread.access$700(ActivityThread.java:150)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.os.Looper.loop(Looper.java:137)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.ActivityThread.main(ActivityThread.java:5283)
01-31 12:22:40.010: E/AndroidRuntime(10591): at java.lang.reflect.Method.invokeNative(Native Method)
01-31 12:22:40.010: E/AndroidRuntime(10591): at java.lang.reflect.Method.invoke(Method.java:511)
01-31 12:22:40.010: E/AndroidRuntime(10591): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
01-31 12:22:40.010: E/AndroidRuntime(10591): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
01-31 12:22:40.010: E/AndroidRuntime(10591): at dalvik.system.NativeStart.main(Native Method)
01-31 12:22:40.010: E/AndroidRuntime(10591): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030023
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.content.res.Resources.getValue(Resources.java:1883)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.content.res.Resources.loadXmlResourceParser(Resources.java:3028)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.content.res.Resources.getLayout(Resources.java:1722)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.view.LayoutInflater.inflate(LayoutInflater.java:395)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
01-31 12:22:40.010: E/AndroidRuntime(10591): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:364)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.Activity.setContentView(Activity.java:1930)
01-31 12:22:40.010: E/AndroidRuntime(10591): at com.example.reflexapp.Login.onCreate(Login.java:18)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.Activity.performCreate(Activity.java:5283)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
01-31 12:22:40.010: E/AndroidRuntime(10591): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
01-31 12:22:40.010: E/AndroidRuntime(10591): ... 11 more
I don't understand what I am doing wrong here. In each activity I am doing like this -
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.userlogin);
init();
}
Please help me out. Thanks in advance.
I solved my problem. I was making a mistake, as my app was meant to work only in landscape mode I was putting all my layout xml files in layout-land folder. There was nothing in layout folder.
But it turned out when device is put to sleep android system tries to bring everything in portrait mode, so it looks for portrait xmls in layout folder but gets nothing. Hence it gives Resource not found exception and app exits.
So mental note, even though your app will show only landscape layouts , you must provide portrait xmls in the layout folder. :-)
I also had this problem when my Activity was crashing when I pressed the Home or Back button keys. I didn't have the files in the "layout" folder because they were only in the "layout-land" folder. I simply copied my files from "layout-land" to "layout" and now the activity doesn't crash when hit the Home key or Back key. This was a bit frustrating at first but everything seems to work fine now.
Decided to use Scandit SDK to get the barcode scanning feature in my app. Unfortunately, since I'm relatively new to Android development and Java in general I've run into a few issues that I can't seem to work out. The demo that Scandit provided doesn't give any errors(runs fine) but crashes when I try to start it up (pressing a button from one activity is meant to start it up). I've tried reading the logcat and googling a solution to the problems but I'm not getting the right solutions. Does anyone have an idea of what I'm doing wrong?
Logcat is provided below:
10-08 23:30:00.807 21563-21563/com.kwesimbia.management D/AndroidRuntime? Shutting down VM
10-08 23:30:00.807 21563-21563/com.kwesimbia.management W/dalvikvm? threadid=1: thread exiting with uncaught exception (group=0x40aa4228)
10-08 23:30:00.817 21563-21563/com.kwesimbia.management E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3082)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.kwesimbia.management.ScanditSDKDemoSimple
at com.kwesimbia.management.Activity_D.initiateCodeScan(Activity_D.java:63)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Process: com.kwesimbia.management
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Package: com.kwesimbia.management v1 (1.0)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger?
Application Label: firstapp
10-08 23:30:00.827 32726-587/? W/ActivityManager?
Force finishing activity com.kwesimbia.management/.Activity_D
I came across this problem as well, my solution was to extract the library files and put them as their files in the lib folder
The library basically isn't being exported with it
EDIT
So I checked out my project, basically I did these things:
In the libs folder I have a new folder called armeabi and inside that I have libscanditsdk-android-3.3.1.so
Then in my build path I have also referenced the jar file that they provide:
<classpathentry exported="true" kind="lib" path="C:/GIT/Android/FwayScannerProject/FwayScanner/libs/scanditsdk-barcodepicker-android-3.3.1.jar"/>
After importing the actionbarsherlock module, my app crashes on any activity that extends the SherlockActivity. I am not sure if I had imported it incorrectly or something needs to be adjusted but I have followed a guide that was previously posted here on stackoverflow. If i extend Activity and not sherlockActivity there will be no crash.
Guide https://stackoverflow.com/a/16591272/1671933
Logcat
05-24 08:41:46.072 1241-1241/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.example.sandbox.TestingCam
at com.example.sandbox.LoginActivity$CheckLogin.onPostExecute(LoginActivity.java:204)
at com.example.sandbox.LoginActivity$CheckLogin.onPostExecute(LoginActivity.java:155)
at android.os.AsyncTask.finish(AsyncTask.java:417)
at android.os.AsyncTask.access$300(AsyncTask.java:127)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
You need to make sure that the dependency scope is set to "compile". In some cases it seem to be set to "provided" which will cause a NoClassDefFoundError.
I am new in Google Map and so many things aren't clear enough to me for that reason.So i expect some expert's direction on this regard.I read This Guide and did everything what it says.I use google map api v2 and get a map key.Then i make a sample project following that link and select target version android 2.2(while running the project).But a list of error occurs after running then example in eclipse android emulator.My logcat view shows:
01-31 00:51:59.226: W/dalvikvm(329): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
01-31 00:51:59.236: E/AndroidRuntime(329): FATAL EXCEPTION: main
01-31 00:51:59.236: E/AndroidRuntime(329): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.googleMapApp/com.googleMapApp.LocationProfileManagerActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.os.Looper.loop(Looper.java:123)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.reflect.Method.invokeNative(Native Method)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.reflect.Method.invoke(Method.java:521)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-31 00:51:59.236: E/AndroidRuntime(329): at dalvik.system.NativeStart.main(Native Method)
01-31 00:51:59.236: E/AndroidRuntime(329): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.Activity.setContentView(Activity.java:1647)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.googleMapApp.LocationProfileManagerActivity.onCreate(LocationProfileManagerActivity.java:14)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-31 00:51:59.236: E/AndroidRuntime(329): ... 11 more
01-31 00:51:59.236: E/AndroidRuntime(329): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.googleMapApp-1.apk]
01-31 00:51:59.236: E/AndroidRuntime(329): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
My Manifest.xml is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googleMapApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<permission
android:name="com.googleMapApp.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.googleMapApp.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<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"/>
<!-- Require OpenGL ES version 2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".LocationProfileManagerActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="myMapKey"/>
</application>
</manifest>
My main.xml is:
<?xml version="1.0" encoding="utf-8"?>
<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"/>
My activity.java is:
package com.googleMapApp;
import android.app.Activity;
import android.os.Bundle;
public class LocationProfileManagerActivity extends Activity {
/** Called when the activity is first created. */
//private GoogleMap map;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
}
}
Sorry for this lengthy description,but i want to show you exactly what i did.I think as a newcomer i did a lot of mistake on this way.so i expect someone will guide me that.
You are using features only available in later APIs, namely Fragment. If you want to compile to support 2.2, you need to include the Support Library in your project. You will also have to make the following changes to use support fragments instead of regular fragments --
In main.xml, change
class="com.google.android.gms.maps.MapFragment"/>
to
class="com.google.android.gms.maps.SupportMapFragment"/>
and in your activity.java, change
public class LocationProfileManagerActivity extends Activity {
to
public class LocationProfileManagerActivity extends FragmentActivity {
you need to make two changes
Since as you are sdk version is below 12, need to make following change
1)
main.xml
Replace
class="com.google.android.gms.maps.MapFragment"/>
with
class="com.google.android.gms.maps.SupportMapFragment"/>
2) activity.java
Need to extend FragmentActivity instead of Activity
If you want to test in emulator , then download the google_play_services_apk and install it in emulator.
Maps API v2 cannot be run in an emulator because of its dependency on Google Play Services, which is bundled in the Google Play Store .apk. It can be hacked together though, you can read about it here on the first Google result for "Google maps v2 emulator". Also you can still use V1 for a limited time, you can get started here.
Two days ago, when my android project in eclipse still worked, I added "android SDK 4.0.3" to my SDKs (in addition to android SDK 2.1).
From that moment on, I have a trouble with slf4j-android library; here's the exception:
Uncaught handler: thread main exiting due to uncaught exception
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1479)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at it.cefriel.swa.urbanopoly.client.game.UrbanopolyActivity.<clinit>(UrbanopolyActivity.java:11)
The JAR I use is slf4j-android-1.5.8.jar. The build path seems correctly setted. I also tried to create another project using slf4j and I got the same error..
Any Ideas?
Thanks in advance
Try adding the slf4j-api-1.5.8.jar or latest version as well with the current slf4j-android-1.5.8.jar