Android project crashes whenever a Maps fragment is in the layouts xml - android

I'm currently trying to build an app with Google Map APIv2 for Android. I have spent a few hours trying to debug this error and have found nothing. I even tried creating
All I ever get when I try to include maps API fragment is "Unfortunately, myapp has"
LogCat
10-21 02:13:05.563: D/dalvikvm(2183): GC_FOR_ALLOC freed 61K, 4% free 3523K/3660K, paused 0ms, total 15ms
10-21 02:13:05.643: D/(2183): HostConnection::get() New Host Connection established 0xb8207700, tid 2183
10-21 02:13:05.663: W/EGL_emulation(2183): eglSurfaceAttrib not implemented
10-21 02:13:05.663: D/OpenGLRenderer(2183): Enabling debug mode 0
10-21 02:13:05.683: D/dalvikvm(2183): GC_FOR_ALLOC freed 99K, 5% free 3886K/4064K, paused 4ms, total 4ms
10-21 02:13:12.003: D/AndroidRuntime(2183): Shutting down VM
10-21 02:13:12.003: W/dalvikvm(2183): threadid=1: thread exiting with uncaught exception (group=0xb0cb0b20)
10-21 02:13:12.013: E/AndroidRuntime(2183): FATAL EXCEPTION: main
10-21 02:13:12.013: E/AndroidRuntime(2183): Process: com.example.myapp, PID: 2183
10-21 02:13:12.013: E/AndroidRuntime(2183): java.lang.IllegalStateException: Could not execute method of the activity
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.View$1.onClick(View.java:3823)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.View.performClick(View.java:4438)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.View$PerformClick.run(View.java:18422)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.os.Handler.handleCallback(Handler.java:733)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.os.Handler.dispatchMessage(Handler.java:95)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.os.Looper.loop(Looper.java:136)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.app.ActivityThread.main(ActivityThread.java:5017)
10-21 02:13:12.013: E/AndroidRuntime(2183): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 02:13:12.013: E/AndroidRuntime(2183): at java.lang.reflect.Method.invoke(Method.java:515)
10-21 02:13:12.013: E/AndroidRuntime(2183): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
10-21 02:13:12.013: E/AndroidRuntime(2183): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
10-21 02:13:12.013: E/AndroidRuntime(2183): at dalvik.system.NativeStart.main(Native Method)
10-21 02:13:12.013: E/AndroidRuntime(2183): Caused by: java.lang.reflect.InvocationTargetException
10-21 02:13:12.013: E/AndroidRuntime(2183): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 02:13:12.013: E/AndroidRuntime(2183): at java.lang.reflect.Method.invoke(Method.java:515)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.View$1.onClick(View.java:3818)
10-21 02:13:12.013: E/AndroidRuntime(2183): ... 11 more
10-21 02:13:12.013: E/AndroidRuntime(2183): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:714)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
10-21 02:13:12.013: E/AndroidRuntime(2183): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.app.Activity.setContentView(Activity.java:1929)
10-21 02:13:12.013: E/AndroidRuntime(2183): at com.example.myapp.MainActivity.onClick_Login(MainActivity.java:51)
10-21 02:13:12.013: E/AndroidRuntime(2183): ... 14 more
10-21 02:13:12.013: E/AndroidRuntime(2183): 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
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.app.Fragment.instantiate(Fragment.java:597)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.app.Fragment.instantiate(Fragment.java:561)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.app.Activity.onCreateView(Activity.java:4778)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
10-21 02:13:12.013: E/AndroidRuntime(2183): ... 21 more
10-21 02:13:12.013: E/AndroidRuntime(2183): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment" on path: DexPathList[[zip file "/data/app/com.example.myapp.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.myapp-2, /vendor/lib, /system/lib]]
10-21 02:13:12.013: E/AndroidRuntime(2183): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
10-21 02:13:12.013: E/AndroidRuntime(2183): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
10-21 02:13:12.013: E/AndroidRuntime(2183): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
10-21 02:13:12.013: E/AndroidRuntime(2183): at android.app.Fragment.instantiate(Fragment.java:583)
10-21 02:13:12.013: E/AndroidRuntime(2183): ... 24 more
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--
The following two permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="HIDDEN" />
</application>
</manifest>
activity
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/buttonLogout" />
<Button
android:id="#+id/buttonLogout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:onClick="onClick_Logout"
android:text="Logout" />
</RelativeLayout>

Related

Google map v2 in android fragment causing sometime error when back to this page

This is the error which i get in my logcat when back to googlemap fragment from other fragments.....
i did not understand what to do now....
09-14 12:08:37.638: E/AndroidRuntime(2183): Exception
09-14 12:08:37.648: E/AndroidRuntime(2183): FATAL EXCEPTION: main
09-14 12:08:37.648: E/AndroidRuntime(2183): android.view.InflateException: Binary XML file line #13: Error inflating class fragment
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
09-14 12:08:37.648: E/AndroidRuntime(2183): at com.example.sail.YS_MapFragment.onCreateView(YS_MapFragment.java:91)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.app.Fragment.performCreateView(Fragment.java:1700)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.app.BackStackRecord.run(BackStackRecord.java:684)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.os.Handler.handleCallback(Handler.java:733)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.os.Handler.dispatchMessage(Handler.java:95)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.os.Looper.loop(Looper.java:136)
09-14 12:08:37.648: E/AndroidRuntime(2183): at android.app.ActivityThread.main(ActivityThread.java:5127)
09-14 12:08:37.648: E/AndroidRuntime(2183): at java.lang.reflect.Method.invokeNative(Native Method)
09-14 12:08:37.648: E/AndroidRuntime(2183): at java.lang.reflect.Method.invoke(Method.java:515)
09-14 12:08:37.648: E/AndroidRuntime(2183): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
09-14 12:08:37.648: E/AndroidRuntime(2183): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
09-14 12:08:37.648: E/AndroidRuntime(2183): at dalvik.system.NativeStart.main(Native Method)
09-14 12:08:37.648: E/AndroidRuntime(2183): Caused by: java.lang.IllegalArgumentException: Binary XML file line
below is my xml code
<?xml version="1.0" encoding="utf-8"?>
<com.example.sail.MapWrapperLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map_relative_layoutNew"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="#+id/mapviewNew"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
</com.example.sail.MapWrapperLayout>
You can do it programatically and be sure you use getChildFragmentMananger instead of the classic getFragmentManager() to create the fragment.
If you are using below API level 16 then follow below
To use nested fragments on API Level 16 and below, you need to use the fragments backport from the support-v4 or support-v13 portion of the Android Support package. This, in turn, requires you to inherit from FragmentActivity and have your fragments inherit from android.support.v4.app.Fragment. Then, you can call getChildFragmentManager() to use nested fragments.

google map api v2 - first steps

I am new in using google map api v2.
i do every thing base on this tutorial:
Android SDK: Working with Google Maps - Application Setup
but in 5 :
Add a Map to the App
when i add fragment to may layout, i got some rendering error in my preview and show me stack overflow error.
and when I Run my code this i see this errors:
02-20 21:36:37.601 11893-11893/com.example.gmt3 I/Process﹕ Sending signal. PID: 11893 SIG: 9
02-20 21:41:30.941 12732-12732/com.example.gmt3 D/dalvikvm﹕ Late-enabling CheckJNI
02-20 21:41:31.021 12732-12732/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:41:31.041 12732-12732/com.example.gmt3 D/AndroidRuntime﹕ Shutting down VM
02-20 21:41:31.041 12732-12732/com.example.gmt3 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41662d88)
02-20 21:41:31.051 12732-12732/com.example.gmt3 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.gmt3, PID: 12732
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gmt3/com.example.gmt3.MyActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
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:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
at android.app.Activity.setContentView(Activity.java:1929)
at com.example.gmt3.MyActivity.onCreate(MyActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:212)
            at android.app.ActivityThread.main(ActivityThread.java:5137)
            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:902)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 5077000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
at com.google.android.gms.common.GooglePlayServicesUtil.x(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.maps.internal.u.F(Unknown Source)
at com.google.android.gms.maps.internal.u.E(Unknown Source)
at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.ju(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
at com.google.android.gms.dynamic.a.a(Unknown Source)
at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
at android.app.Activity.onCreateView(Activity.java:4785)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
            at android.app.Activity.setContentView(Activity.java:1929)
            at com.example.gmt3.MyActivity.onCreate(MyActivity.java:14)
            at android.app.Activity.performCreate(Activity.java:5231)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:212)
            at android.app.ActivityThread.main(ActivityThread.java:5137)
            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:902)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
            at dalvik.system.NativeStart.main(Native Method)
02-20 21:42:01.901 13963-13963/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:42:01.921 13963-13963/com.example.gmt3 D/AndroidRuntime﹕ Shutting down VM
02-20 21:42:01.921 13963-13963/com.example.gmt3 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41662d88)
02-20 21:44:41.511 15098-15098/com.example.gmt3 D/dalvikvm﹕ Late-enabling CheckJNI
02-20 21:44:41.641 15098-15098/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:44:41.671 15098-15098/com.example.gmt3 I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: RGURRAM_AU_LINUX_ANDROID_LNX.LA.3.5.2.2_RB1.04.04.04.087.030+PATCH[ES]_msm8974_LNX.LA.3.5.2.2_RB1__release_ENGG ()
OpenGL ES Shader Compiler Version: E031.24.00.15
Build Date: 08/12/14 Tue
Local Branch:
Remote Branch: quic/LNX.LA.3.5.2.2_rb1
Local Patches: 8b00bd16f3c1d9d35a2fa902df5e679888d2b2e3 Fixes an llvm crash with mini dEQP apk
38bad22e162dead4e008444520a0144c78a347bd Fixes a potential dEQP crash.
ce345e1c45c2ae2d1fb2cb125c8d2574f1af5f95 Rev
02-20 21:44:41.701 15098-15098/com.example.gmt3 D/OpenGLRenderer﹕ Enabling debug mode 0
02-20 21:44:41.761 15098-15098/com.example.gmt3 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#42e245d8 time:70662662
02-20 21:51:39.711 15098-15098/com.example.gmt3 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#42e245d8 time:71080619
02-20 21:51:45.771 16948-16948/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:51:45.811 16948-16948/com.example.gmt3 I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: RGURRAM_AU_LINUX_ANDROID_LNX.LA.3.5.2.2_RB1.04.04.04.087.030+PATCH[ES]_msm8974_LNX.LA.3.5.2.2_RB1__release_ENGG ()
OpenGL ES Shader Compiler Version: E031.24.00.15
Build Date: 08/12/14 Tue
Local Branch:
Remote Branch: quic/LNX.LA.3.5.2.2_rb1
Local Patches: 8b00bd16f3c1d9d35a2fa902df5e679888d2b2e3 Fixes an llvm crash with mini dEQP apk
38bad22e162dead4e008444520a0144c78a347bd Fixes a potential dEQP crash.
ce345e1c45c2ae2d1fb2cb125c8d2574f1af5f95 Rev
02-20 21:51:45.851 16948-16948/com.example.gmt3 D/OpenGLRenderer﹕ Enabling debug mode 0
02-20 21:51:45.921 16948-16948/com.example.gmt3 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#428164f0 time:71086820
02-20 21:52:30.821 18305-18305/com.example.gmt3 D/dalvikvm﹕ Late-enabling CheckJNI
02-20 21:52:30.911 18305-18305/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:52:30.931 18305-18305/com.example.gmt3 D/AndroidRuntime﹕ Shutting down VM
02-20 21:52:30.931 18305-18305/com.example.gmt3 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41662d88)
02-20 21:52:30.941 18305-18305/com.example.gmt3 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.gmt3, PID: 18305
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gmt3/com.example.gmt3.MyActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
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:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
at android.app.Activity.setContentView(Activity.java:1929)
at com.example.gmt3.MyActivity.onCreate(MyActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:212)
            at android.app.ActivityThread.main(ActivityThread.java:5137)
            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:902)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 5077000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
at com.google.android.gms.common.GooglePlayServicesUtil.x(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.maps.internal.u.F(Unknown Source)
at com.google.android.gms.maps.internal.u.E(Unknown Source)
at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.ju(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
at com.google.android.gms.dynamic.a.a(Unknown Source)
at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
at android.app.Activity.onCreateView(Activity.java:4785)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
            at android.app.Activity.setContentView(Activity.java:1929)
            at com.example.gmt3.MyActivity.onCreate(MyActivity.java:14)
            at android.app.Activity.performCreate(Activity.java:5231)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:212)
            at android.app.ActivityThread.main(ActivityThread.java:5137)
            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:902)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
            at dalvik.system.NativeStart.main(Native Method)
can some one guide me about this?
pn: sorry for such a silly q.
Edit:
my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gmt3"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="17"/>
<permission android:name="com.example.gmt3.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.example.gmt3.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<activity android:name="MyActivity"
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.gms.version" android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDg3mKRpkNhYeyxdrv2xjnkoS8mDt3qsmo" />
</application>
</manifest>
The answer is in the error log
The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 5077000 but found 0. You must have the following declaration within the <application> element:
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
Maybe you have only forgotten to add this refference to your manifest

osmdroid and display map

I can't display my map from Mapnik and I don't know what's the problem.
Can someone help me please! I need help!
here are my logs and my program
MainActivity
package com.formation.mapnick;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import android.app.Activity;
import android.os.Bundle;
//import android.view.Menu;
//import android.view.MenuItem;
public class MainActivity extends Activity {
//the MapView variable:
private MapView m_mapView;
private int MAP_DEFAULT_ZOOM = 15;
private double MAP_DEFAULT_LATITUDE = 49.292531;
private double MAP_DEFAULT_LONGITUDE = -12.276610;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Find the MapView controller in that layout
m_mapView = (MapView) findViewById(R.id.mapview);
m_mapView.setBuiltInZoomControls(true);
m_mapView.setClickable(true);
m_mapView.setMultiTouchControls(true);
m_mapView.setUseDataConnection(true);
m_mapView.getController().setZoom(MAP_DEFAULT_ZOOM);
m_mapView.getController().setCenter(new GeoPoint(MAP_DEFAULT_LATITUDE,MAP_DEFAULT_LONGITUDE));
m_mapView.setTileSource(TileSourceFactory.MAPNIK);
}
}
AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.formation.mapnick"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="20" />
<supports-screens
android:anyDensity="true"
android:resizeable="false"
android:largeScreens="true"
android:normalScreens="true"
/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
my activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
<org.osmdroid.views.MapView
android:id="#+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="#string/apiKey"
/>
</RelativeLayout>
an my logs:
10-21 08:24:42.709: E/Trace(1112): error opening trace file: No such file or directory (2)
10-21 08:24:43.180: E/dalvikvm(1112): Could not find class 'org.osmdroid.views.MapView', referenced from method com.formation.mapnick.MainActivity.onCreate
10-21 08:24:43.199: W/dalvikvm(1112): VFY: unable to resolve check-cast 979 (Lorg/osmdroid/views/MapView;) in Lcom/formation/mapnick/MainActivity;
10-21 08:24:43.199: D/dalvikvm(1112): VFY: replacing opcode 0x1f at 0x000f
10-21 08:24:43.229: D/dalvikvm(1112): DexOpt: unable to opt direct call 0x18bf at 0x3e in Lcom/formation/mapnick/MainActivity;.onCreate
10-21 08:24:43.609: D/AndroidRuntime(1112): Shutting down VM
10-21 08:24:43.609: W/dalvikvm(1112): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
10-21 08:24:43.661: E/AndroidRuntime(1112): FATAL EXCEPTION: main
10-21 08:24:43.661: E/AndroidRuntime(1112): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.formation.mapnick/com.formation.mapnick.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class org.osmdroid.views.MapView
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.os.Looper.loop(Looper.java:137)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.main(ActivityThread.java:5041)
10-21 08:24:43.661: E/AndroidRuntime(1112): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 08:24:43.661: E/AndroidRuntime(1112): at java.lang.reflect.Method.invoke(Method.java:511)
10-21 08:24:43.661: E/AndroidRuntime(1112): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-21 08:24:43.661: E/AndroidRuntime(1112): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-21 08:24:43.661: E/AndroidRuntime(1112): at dalvik.system.NativeStart.main(Native Method)
10-21 08:24:43.661: E/AndroidRuntime(1112): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class org.osmdroid.views.MapView
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-21 08:24:43.661: E/AndroidRuntime(1112): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.Activity.setContentView(Activity.java:1881)
10-21 08:24:43.661: E/AndroidRuntime(1112): at com.formation.mapnick.MainActivity.onCreate(MainActivity.java:24)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.Activity.performCreate(Activity.java:5104)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
10-21 08:24:43.661: E/AndroidRuntime(1112): ... 11 more
10-21 08:24:43.661: E/AndroidRuntime(1112): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.osmdroid.views.MapView" on path: /data/app/com.formation.mapnick-1.apk
10-21 08:24:43.661: E/AndroidRuntime(1112): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
10-21 08:24:43.661: E/AndroidRuntime(1112): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-21 08:24:43.661: E/AndroidRuntime(1112): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
10-21 08:24:43.661: E/AndroidRuntime(1112): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
10-21 08:24:43.661: E/AndroidRuntime(1112): ... 21 more
10-21 08:24:48.429: I/Process(1112): Sending signal. PID: 1112 SIG: 9
any idea? I have already tested it on a phone but no result!

Android Google maps application: getting error in android manifest.xml which is an lib file

I am developing a simple Android app which uses the Google Maps API,
I had registered with Google for the API key and added it to my app but I am getting an error:
FATAL EXCEPTION: main
Process: com.s56.maps, PID: 866
12-17 09:28:56.070: E/AndroidRuntime(866): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.s56.maps/com.s56.maps.MainActivity}: android.view.InflateException: Binary XML file line #15: Error inflating class fragment
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.ActivityThread.access$700(ActivityThread.java:135)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.os.Handler.dispatchMessage(Handler.java:102)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.os.Looper.loop(Looper.java:137)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.ActivityThread.main(ActivityThread.java:4998)
12-17 09:28:56.070: E/AndroidRuntime(866): at java.lang.reflect.Method.invokeNative(Native Method)
12-17 09:28:56.070: E/AndroidRuntime(866): at java.lang.reflect.Method.invoke(Method.java:515)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-17 09:28:56.070: E/AndroidRuntime(866): at dalvik.system.NativeStart.main(Native Method)
12-17 09:28:56.070: E/AndroidRuntime(866): Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class fragment
12-17 09:28:56.070: E/AndroidRuntime(866): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.Activity.setContentView(Activity.java:1928)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.s56.maps.MainActivity.onCreate(MainActivity.java:19)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.Activity.performCreate(Activity.java:5243)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
12-17 09:28:56.070: E/AndroidRuntime(866): ... 11 more
***12-17 09:28:56.070: E/AndroidRuntime(866): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />***
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.maps.internal.q.v(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.maps.internal.q.u(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.maps.MapFragment$b.cE(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.dynamic.a.a(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.app.Activity.onCreateView(Activity.java:4784)
12-17 09:28:56.070: E/AndroidRuntime(866): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
12-17 09:28:56.070: E/AndroidRuntime(866): ... 21 more
And my XML file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.s56.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
/>
<permission
android:name="com.s56.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<uses-permission
android:name="com.s56.maps.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"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.s56.maps.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="A***MY_API_KEY***M"/>
</application>
</manifest>
and my activity_main.xml has
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
And my main class i.e activity class has,
public class MainActivity extends Activity
{
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMap=
((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
final LatLng CIU = new LatLng(17.426944259701596, 78.5340459823017);
Marker c = mMap.addMarker(new MarkerOptions()
.position(CIU).title("s56 labs"));
}
#Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
} }
I had added Google Play services as library to Eclipse work space.
Kindly help me with this, and I am new to Android.
You must add this to your AndroidManifest.xml:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />

android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>

I am developing a simple android apllication and just completed the home screen. Now if the orientation of the screen changes more than two times, it is throwing the error and application is getting crashed abrubptly.
Here is my Java Class:
public class PasswordActivity extends Activity implements OnClickListener {
Button login;
Button forgot;
Button register;
private static final String PREFERENCES = "prefs";
private static final String PREFERENCES_NAME = "pref_name";
SharedPreferences settings;
private Cursor c;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
login=(Button)findViewById(R.id.login_login);
login.setOnClickListener(this);
register=(Button)findViewById(R.id.login_register);
register.setOnClickListener(this);
}
public void onClick(View v) {
}
}
And this is my Xml Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#drawable/listpic">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:paddingLeft="3dp"
android:paddingRight="3dp">
<TextView
android:layout_width="fill_parent"
android:layout_weight="0.75"
android:layout_height="wrap_content"
android:text="#string/login_user_name"
android:textStyle="bold"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:id="#+id/login_user_name"
android:inputType="text"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="3dp"
android:paddingRight="3dp">
<TextView
android:layout_width="fill_parent"
android:layout_weight="0.75"
android:layout_height="wrap_content"
android:text="#string/login_password"
android:textStyle="bold"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:inputType="textPassword"
android:id="#+id/login_password"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="3dp"
android:paddingRight="3dp">
<Button
style="#style/left_button"
android:text="#string/login_submit"
android:id="#+id/login_login"/>
<Button
style="#style/right_button"
android:id="#+id/login_register"
android:text="#string/register"/>
</LinearLayout>
</LinearLayout>
Log Cat Details:
10-21 12:05:59.982: D/dalvikvm(622): GC_EXTERNAL_ALLOC freed 774 objects / 56240 bytes in 61ms
10-21 12:06:15.031: D/dalvikvm(622): GC_EXTERNAL_ALLOC freed 737 objects / 30992 bytes in 59ms
10-21 12:06:18.022: E/dalvikvm-heap(622): 7596000-byte external allocation too large for this process.
10-21 12:06:18.022: E/GraphicsJNI(622): VM won't let us allocate 7596000 bytes
10-21 12:06:18.043: D/AndroidRuntime(622): Shutting down VM
10-21 12:06:18.043: W/dalvikvm(622): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
10-21 12:06:18.092: E/AndroidRuntime(622): FATAL EXCEPTION: main
10-21 12:06:18.092: E/AndroidRuntime(622): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ravi.password/com.ravi.password.PasswordActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
10-21 12:06:18.092: E/AndroidRuntime(622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.app.ActivityThread.main(ActivityThread.java:4627)
10-21 12:06:18.092: E/AndroidRuntime(622): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 12:06:18.092: E/AndroidRuntime(622): at java.lang.reflect.Method.invoke(Method.java:521)
10-21 12:06:18.092: E/AndroidRuntime(622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-21 12:06:18.092: E/AndroidRuntime(622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-21 12:06:18.092: E/AndroidRuntime(622): at dalvik.system.NativeStart.main(Native Method)
10-21 12:06:18.092: E/AndroidRuntime(622): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
10-21 12:06:18.092: E/AndroidRuntime(622): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
10-21 12:06:18.092: E/AndroidRuntime(622): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-21 12:06:18.092: E/AndroidRuntime(622): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.app.Activity.setContentView(Activity.java:1647)
10-21 12:06:18.092: E/AndroidRuntime(622): at com.ravi.password.PasswordActivity.onCreate(PasswordActivity.java:34)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
10-21 12:06:18.092: E/AndroidRuntime(622): ... 12 more
10-21 12:06:18.092: E/AndroidRuntime(622): Caused by: java.lang.reflect.InvocationTargetException
10-21 12:06:18.092: E/AndroidRuntime(622): at android.widget.LinearLayout.<init>(LinearLayout.java:115)
10-21 12:06:18.092: E/AndroidRuntime(622): at java.lang.reflect.Constructor.constructNative(Native Method)
10-21 12:06:18.092: E/AndroidRuntime(622): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
10-21 12:06:18.092: E/AndroidRuntime(622): ... 22 more
10-21 12:06:18.092: E/AndroidRuntime(622): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
10-21 12:06:18.092: E/AndroidRuntime(622): at android.graphics.Bitmap.nativeCreate(Native Method)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
10-21 12:06:18.092: E/AndroidRuntime(622): at android.view.ViewGroup.<init>(ViewGroup.java:285)
10-21 12:06:18.092: E/AndroidRuntime(622): ... 26 more
Images used are of very small size around 5kb.
At runtime, Android resize's images based on need (based on the screen size and resolution). It uses Bitmap's for doing the resizing internally. Which, obviously, is very memory intensive (kinda allocates memory like crazy). One quick way to fix such issues can be, that you copy all drawable files to drawable-ldpi, mdpi, hdpi folders. This way android will just pick up the files from these folders and not resize them.
Its a random kind exception, a real pain to fix.
please follow background image size
for Supported device
LDPI:
Portrait: 200x320px
Landscape: 320x200px
MDPI:
Portrait: 320x480px
Landscape: 480x320px
HDPI:
Portrait: 480x800px
Landscape: 800x480px
XHDPI:
Portrait: 720px1280px
Landscape: 1280x720px
Sorry for my bad English
I had the same problem, if you put any "xml" files into "drawable-24" just move them to "drawable", this was the solution that i did to solve this problem
have a nice day :)
As the others clarified, part of a problem was an issue related to the background image I'd set for my layout. However, getting that solved, I persistently encountered the error:
Unfortunately the application has stopped
With trial and error, I found the problem was caused by the <view> elements which after deleting them, I could eventually run the application.

Categories

Resources