This question already has answers here:
After Google Play Service update to version 13 I got an error
(8 answers)
Closed 8 years ago.
Hello i am traying to follow this tutorial
http://androidresearch.wordpress.com/2013/09/29/google-maps-api-v2-android-tutorial/
and i downloaded the source code but i cant get it run
this my debug logcat when i run the applicatino on the adv
01-07 19:12:44.086: I/dalvikvm(630): threadid=3: reacting to signal 3
01-07 19:12:44.106: I/dalvikvm(630): Wrote stack traces to '/data/anr/traces.txt'
01-07 19:12:51.036: I/Process(630): Sending signal. PID: 630 SIG: 9
01-07 19:15:28.196: I/dalvikvm(678): threadid=3: reacting to signal 3
01-07 19:15:28.296: I/dalvikvm(678): Wrote stack traces to '/data/anr/traces.txt'
01-07 19:15:28.466: D/AndroidRuntime(678): Shutting down VM
01-07 19:15:28.466: W/dalvikvm(678): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
01-07 19:15:28.486: E/AndroidRuntime(678): FATAL EXCEPTION: main
01-07 19:15:28.486: E/AndroidRuntime(678): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapsv2/com.example.mapsv2.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.os.Handler.dispatchMessage(Handler.java:99)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.os.Looper.loop(Looper.java:137)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-07 19:15:28.486: E/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 19:15:28.486: E/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:511)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-07 19:15:28.486: E/AndroidRuntime(678): at dalvik.system.NativeStart.main(Native Method)
01-07 19:15:28.486: E/AndroidRuntime(678): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
01-07 19:15:28.486: E/AndroidRuntime(678): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.Activity.setContentView(Activity.java:1835)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.example.mapsv2.MainActivity.onCreate(MainActivity.java:13)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.Activity.performCreate(Activity.java:4465)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-07 19:15:28.486: E/AndroidRuntime(678): ... 11 more
01-07 19:15:28.486: E/AndroidRuntime(678): 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" />
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.maps.internal.q.v(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.maps.internal.q.u(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.maps.SupportMapFragment$b.cE(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.dynamic.a.a(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:284)
01-07 19:15:28.486: E/AndroidRuntime(678): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
01-07 19:15:28.486: E/AndroidRuntime(678): ... 20 more
01-07 19:15:28.706: I/dalvikvm(678): threadid=3: reacting to signal 3
01-07 19:15:28.726: I/dalvikvm(678): Wrote stack traces to '/data/anr/traces.txt'
01-07 19:15:29.106: I/dalvikvm(678): threadid=3: reacting to signal 3
01-07 19:15:29.126: I/dalvikvm(678): Wrote stack traces to '/data/anr/traces.txt'
01-07 19:15:36.495: I/Process(678): Sending signal. PID: 678 SIG: 9
and the xml code is here
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapsv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<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" />
<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" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCyR3kVxyrriZlavRfsly-lBYo8Pl4VMkM" />
<activity
android:name="com.example.mapsv2.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>
It's good habit to read error message first:
E/AndroidRuntime(678): 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 element:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
so add this to your manifest.
Related
I am trying to run Google maps API v2 on emulator. It says "unfortunately app has stoped" Here is my manifest.xml code. There is a huge number of errors. In the first line it gives error to define android.allowBackup which I have done on application tag.Please help me solve them.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<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"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permissionandroid:name="com.myapp.providers.gsf.permission.
READ_GSERVICES"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data android:name="com.google.android.gms.version" android:value="4030500" />
<!-- <meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" /> -->
<activity
android:name="com.myapp.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="My key"/>
</application>
</manifest>
----------------------------------------------------------------------------------------------
MainActivity.java
package myapp;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
public class MainActivity extends FragmentActivity {
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
map = mapFrag.getMap();
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
}
------------------------------------------------------------------------------------
activity_main.xml
<?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"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
-----------------------------------------------------------------
Logcat
E/Trace(690): error opening trace file: No such file or directory (2)
E/AndroidRuntime(690): FATAL EXCEPTION: main
E/AndroidRuntime(690): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{myapp/myapp.MainActivity}:android.view.InflateException: Binary XML file line #2:
Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:06:56.709: E/AndroidRuntime(690): Caused by: android.view.InflateException: Binary XML
file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.
java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
AndroidRuntime(690): ... 11 more
AndroidRuntime(690): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's
AndroidManifest.xml does not have the right value. Expected 5089000 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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:06:56.709: E/AndroidRuntime(690): ... 23 more
09-01 15:07:53.868: E/Trace(734): error opening trace file: No such file or directory (2)
09-01 15:07:54.479: E/AndroidRuntime(734): FATAL EXCEPTION: main
09-01 15:07:54.479: E/AndroidRuntime(734): java.lang.RuntimeException:
Unable to start activity ComponentInfo{myapp/myapp.MainActivity}
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:07:54.479: E/AndroidRuntime(734): Caused by:
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.
setContentView(ActionBarActivityDelegateICS.java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime(734): ... 11 more
E/AndroidRuntime(734): Caused by: java.lang.IllegalStateException: The meta-data tag in your
app's AndroidManifest.xml does not have the right value. Expected 5089000 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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:07:54.479: E/AndroidRuntime(734): ... 23 more
error opening trace file: No such file or directory (2)
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{myapp/myapp.MainActivity}:
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:12:22.938: E/AndroidRuntime(811): Caused by: android.view.InflateException: Binary XML
file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.setContentView
(ActionBarActivityDelegateICS.java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-01 15:12:22.938: E/AndroidRuntime(811): ... 11 more
09-01 15:12:22.938: E/AndroidRuntime(811): Caused by: java.lang.IllegalStateException: The meta-
data tag in your app's AndroidManifest.xml does not have the right value. Expected 5089000
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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:19:34.508: E/Trace(826): error opening trace file: No such file or directory (2)
09-01 15:19:35.118: E/AndroidRuntime(826): FATAL EXCEPTION: main
09-01 15:19:35.118: E/AndroidRuntime(826): java.lang.RuntimeException:
Unable to start activity ComponentInfo{myapp/myapp.MainActivity}: android.view.InflateException:
Binary XML file line #2: Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:19:35.118: E/AndroidRuntime(826): Caused by: android.view.InflateException: Binary XML
file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.setContentView
(ActionBarActivityDelegateICS.java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-01 15:19:35.118: E/AndroidRuntime(826): ... 11 more
09-01 15:19:35.118: E/AndroidRuntime(826): Caused by: java.lang.IllegalStateException:
The meta- data tag in your app's AndroidManifest.xml does not
have the right value. Expected 5089000 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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailabl
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:27:57.068: E/Trace(865): error opening trace file: No such file or directory (2)
09-01 15:27:57.748: E/AndroidRuntime(865): FATAL EXCEPTION: main
09-01 15:27:57.748: E/AndroidRuntime(865): java.lang.RuntimeException:
Unable to start activity ComponentInfo{myapp/myapp.MainActivity}:
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:27:57.748: E/AndroidRuntime(865): Caused by: android.view.InflateException: Binary XML
file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.setContentView
(ActionBarActivityDelegateICS.java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-01 15:27:57.748: E/AndroidRuntime(865): ... 11 more
09-01 15:27:57.748: E/AndroidRuntime(865): Caused by: java.lang.IllegalStateException:
The meta- data tag in your app's AndroidManifest.xml does not have the right value.
Expected 5089000 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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:27:57.748: E/AndroidRuntime(865): ... 23 more
mmmh... Change
<meta-data android:name="com.google.android.gms.version" android:value="4030500" />
to
<meta-data android:name="com.google.android.gms.version" android:value="5089000" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission
android:name="com.myapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.myapp.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" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.myapp."Your activity name""
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="Your map key" />
</application>
</manifest>
Add the below permission to your Manifest.xml
<permission android:name="com.myapp.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
and replaca the below line:
<uses-permissionandroid:name="com.myapp.providers.gsf.permission.
READ_GSERVICES"/>
via
<uses-permission android:name="com.myapp.providers.gsf.permission.
READ_GSERVICES"/>
I tried to run a google map aplication but when i put a map Fragmet in my xml file the app stops. I think the problem is with the fragment map because when i run the app without it, for example add just a button runs perfectly, i also put the manifest to review
here is my java code:
public class Activity2 extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity2);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity2, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_activity2,
container, false);
return rootView;
}
}
}
Here is my XML code
<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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.tutorialgooglemaps.Activity2$PlaceholderFragment" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
and myLOGCAT
03-14 00:47:38.619: E/AndroidRuntime(3717): FATAL EXCEPTION: main
03-14 00:47:38.619: E/AndroidRuntime(3717): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tutorialgooglemaps/com.example.tutorialgooglemaps.Activity2}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.app.ActivityThread.access$600(ActivityThread.java:128)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.os.Handler.dispatchMessage(Handler.java:99)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.os.Looper.loop(Looper.java:137)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.app.ActivityThread.main(ActivityThread.java:4517)
03-14 00:47:38.619: E/AndroidRuntime(3717): at java.lang.reflect.Method.invokeNative(Native Method)
03-14 00:47:38.619: E/AndroidRuntime(3717): at java.lang.reflect.Method.invoke(Method.java:511)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
03-14 00:47:38.619: E/AndroidRuntime(3717): at dalvik.system.NativeStart.main(Native Method)
03-14 00:47:38.619: E/AndroidRuntime(3717): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.example.tutorialgooglemaps.Activity2$PlaceholderFragment.onCreateView(Activity2.java:59)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1137)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.app.Activity.performStart(Activity.java:4480)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1943)
03-14 00:47:38.619: E/AndroidRuntime(3717): ... 11 more
03-14 00:47:38.619: E/AndroidRuntime(3717): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 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" />
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.maps.internal.q.v(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.maps.internal.q.u(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.maps.SupportMapFragment$b.ex(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.dynamic.a.a(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:290)
03-14 00:47:38.619: E/AndroidRuntime(3717): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
03-14 00:47:38.619: E/AndroidRuntime(3717): ... 24 more
here is the manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tutorialgooglemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<permission
android:name="org.example.ejemplogooglemaps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="org.example.ejemplogooglemaps.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.ACCESS_NETWORK_STATE" />
<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" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.tutorialgooglemaps.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="AIzaSyDrcKDGxUgl0Ps4u2ptOsIUCI6ooXmZ0RU" />
<activity
android:name="com.example.tutorialgooglemaps.Activity2"
android:label="#string/title_activity_activity2" >
</activity>
</application>
</manifest>
Your logcat clearly said
03-14 00:47:38.619: E/AndroidRuntime(3717): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 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" />
Add the Google Play services version to your app's manifest
Edit your application's AndroidManifest.xml file, and add the
following declaration within the element. This embeds the version of
Google Play services that the app was compiled with.
You need to add <meta-data> under <application> tag into your AndroidManifest.xml
....<application>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
This is because latest google play services requires a version name, which is to be mentioned using <meta-data .. /> inside AndroidManifest.xml
Update: build your manifest.xml like:
....<application>
..............
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDrcKDGxUgl0Ps4u2ptOsIUCI6ooXmZ0RU" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
My application keeps crashing and i do not know what went wrong. I merely added a new package into the application
The codes below is my logcat output of errors
01-07 07:28:51.824: E/AndroidRuntime(471): FATAL EXCEPTION: main
01-07 07:28:51.824: E/AndroidRuntime(471): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.coverflow/com.coverflow.CoverFlowExample}: java.lang.ClassNotFoundException: com.coverflow.CoverFlowExample in loader dalvik.system.PathClassLoader[/data/app/com.example.coverflow-2.apk]
01-07 07:28:51.824: E/AndroidRuntime(471): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1739)
01-07 07:28:51.824: E/AndroidRuntime(471): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
01-07 07:28:51.824: E/AndroidRuntime(471): at android.app.ActivityThread.access$500(ActivityThread.java:122)
01-07 07:28:51.824: E/AndroidRuntime(471): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
01-07 07:28:51.824: E/AndroidRuntime(471): at android.os.Handler.dispatchMessage(Handler.java:99)
01-07 07:28:51.824: E/AndroidRuntime(471): at android.os.Looper.loop(Looper.java:132)
01-07 07:28:51.824: E/AndroidRuntime(471): at android.app.ActivityThread.main(ActivityThread.java:4123)
01-07 07:28:51.824: E/AndroidRuntime(471): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 07:28:51.824: E/AndroidRuntime(471): at java.lang.reflect.Method.invoke(Method.java:491)
01-07 07:28:51.824: E/AndroidRuntime(471): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
01-07 07:28:51.824: E/AndroidRuntime(471): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
01-07 07:28:51.824: E/AndroidRuntime(471): at dalvik.system.NativeStart.main(Native Method)
01-07 07:28:51.824: E/AndroidRuntime(471): Caused by: java.lang.ClassNotFoundException: com.coverflow.CoverFlowExample in loader dalvik.system.PathClassLoader[/data/app/com.example.coverflow-2.apk]
01-07 07:28:51.824: E/AndroidRuntime(471): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
01-07 07:28:51.824: E/AndroidRuntime(471): at java.lang.ClassLoader.loadClass(ClassLoader.java:540)
01-07 07:28:51.824: E/AndroidRuntime(471): at java.lang.ClassLoader.loadClass(ClassLoader.java:500)
01-07 07:28:51.824: E/AndroidRuntime(471): at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
01-07 07:28:51.824: E/AndroidRuntime(471): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1730)
01-07 07:28:51.824: E/AndroidRuntime(471): ... 11 more
Below is my android manifest file, i added the activity intent
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.coverflow"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:largeHeap="true">
<activity android:name="com.coverflow.CoverFlowExample"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.userguide"></activity>
</application>
<uses-sdk android:minSdkVersion="13" />
<supports-screens android:anyDensity="true" />
</manifest>
You have provided your package name package="com.example.coverflow" and you are giving you are accessing your activity by this name android:name="com.coverflow.CoverFlowExample" . Here you forget to write example , so your fully qualified name is wrong.
Please change it to this:
android:name="com.example.coverflow.CoverFlowExample"
I am trying to implement search in my android app. I have followed the step as suggested by the tutorials to make search possible. I have implemented search with a button.As soon as I press the button,not always but sometimes my Logcat show this error and application stops.This doesnot happen always but sometimes,I dont know why this happening as if this is an issue than the error should showup always when I click the search button.
01-07 13:32:54.759: E/AndroidRuntime(11826): FATAL EXCEPTION: main
01-07 13:32:54.759: E/AndroidRuntime(11826): java.lang.IllegalStateException: Could not execute method of the activity
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.view.View$1.onClick(View.java:3050)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.view.View.performClick(View.java:3517)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.view.View$PerformClick.run(View.java:14155)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.os.Handler.handleCallback(Handler.java:605)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.os.Handler.dispatchMessage(Handler.java:92)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.os.Looper.loop(Looper.java:137)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.ActivityThread.main(ActivityThread.java:4508)
01-07 13:32:54.759: E/AndroidRuntime(11826): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 13:32:54.759: E/AndroidRuntime(11826): at java.lang.reflect.Method.invoke(Method.java:511)
01-07 13:32:54.759: E/AndroidRuntime(11826): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
01-07 13:32:54.759: E/AndroidRuntime(11826): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
01-07 13:32:54.759: E/AndroidRuntime(11826): at dalvik.system.NativeStart.main(Native Method)
01-07 13:32:54.759: E/AndroidRuntime(11826): Caused by: java.lang.reflect.InvocationTargetException
01-07 13:32:54.759: E/AndroidRuntime(11826): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 13:32:54.759: E/AndroidRuntime(11826): at java.lang.reflect.Method.invoke(Method.java:511)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.view.View$1.onClick(View.java:3045)
01-07 13:32:54.759: E/AndroidRuntime(11826): ... 11 more
01-07 13:32:54.759: E/AndroidRuntime(11826): Caused by: java.lang.OutOfMemoryError
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.Bitmap.nativeCreate(Native Method)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:543)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:518)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:370)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.content.res.Resources.loadDrawable(Resources.java:1935)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.content.res.Resources.getDrawable(Resources.java:664)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.ApplicationPackageManager.getDrawable(ApplicationPackageManager.java:580)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:140)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.ApplicationPackageManager.getApplicationIcon(ApplicationPackageManager.java:637)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.updateSearchAppIcon(SearchDialog.java:438)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.updateUI(SearchDialog.java:391)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.show(SearchDialog.java:278)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.doShow(SearchDialog.java:230)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.show(SearchDialog.java:212)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchManager.startSearch(SearchManager.java:526)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchManager.startSearch(SearchManager.java:503)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.Activity.startSearch(Activity.java:3055)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.Activity.onSearchRequested(Activity.java:3018)
01-07 13:32:54.759: E/AndroidRuntime(11826): at com.vahzay.android.smstrove.ListMessages.onsearchClick(ListMessages.java:150)
01-07 13:32:54.759: E/AndroidRuntime(11826): ... 14 more
Here is the snippet that cause this error
public void onsearchClick(View v) {
if (v.getId() == R.id.searcher) {
Log.i("search has been clicked", "show");
// this method is used to call the search activity from the
// listmessages activity no intent is used as its need a special
// functionality
onSearchRequested(); // line no 150
}
}
This crash happened due to Out of Memory Exception as given in your log. The search icon is not being loaded properly. For using Bitmaps efficiently take a look at this.
I having abit of problem here as when i saw somewhere with calculator codes and use it somehow the app always force close when i started keying in numbers. help?
public void onClickListener8(View v)
{
vibrator.vibrate(30);
if(press=='=')
{
onClickListenerReset(buttonClear);
}
eight=(String)button8.getText();
sum=sum+eight;
editText.setText(sum);
}
04-17 15:38:23.110: E/AndroidRuntime(678): FATAL EXCEPTION: main
04-17 15:38:23.110: E/AndroidRuntime(678): java.lang.IllegalStateException: Could not execute method of the activity
04-17 15:38:23.110: E/AndroidRuntime(678): at android.view.View$1.onClick(View.java:2144)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.view.View.performClick(View.java:2485)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.view.View$PerformClick.run(View.java:9080)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Handler.handleCallback(Handler.java:587)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Handler.dispatchMessage(Handler.java:92)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Looper.loop(Looper.java:123)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-17 15:38:23.110: E/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
04-17 15:38:23.110: E/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:507)
04-17 15:38:23.110: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-17 15:38:23.110: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-17 15:38:23.110: E/AndroidRuntime(678): at dalvik.system.NativeStart.main(Native Method)
04-17 15:38:23.110: E/AndroidRuntime(678): Caused by: java.lang.reflect.InvocationTargetException
04-17 15:38:23.110: E/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
04-17 15:38:23.110: E/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:507)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.view.View$1.onClick(View.java:2139)
04-17 15:38:23.110: E/AndroidRuntime(678): ... 11 more
04-17 15:38:23.110: E/AndroidRuntime(678): Caused by: java.lang.SecurityException: Requires VIBRATE permission
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Parcel.readException(Parcel.java:1322)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Parcel.readException(Parcel.java:1276)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.IVibratorService$Stub$Proxy.vibrate(IVibratorService.java:106)
04-17 15:38:23.110: E/AndroidRuntime(678): at android.os.Vibrator.vibrate(Vibrator.java:52)
04-17 15:38:23.110: E/AndroidRuntime(678): at com.mypackage.Calculator.onClickListener8(Calculator.java:232)
04-17 15:38:23.110: E/AndroidRuntime(678): ... 14 more
Make sure your app has the Vibrate permission. The following line should be there in the manifest:
<uses-permission android:name="android.permission.VIBRATE"/>
I think you must be using an emulator. Just comment out the vibrate; somehow that's the cause of the issue.