i have included the meta-tag in my manifest file n referenced my playservices to the workspace..what could be the problem?
07-24 02:41:40.787: E/AndroidRuntime(1427): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. 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" />
07-24 02:41:40.787: E/AndroidRuntime(1427): at com.google.android.gms.common.GooglePlayServicesUtil.x(Unknown Source)
07-24 02:41:40.787: E/AndroidRuntime(1427): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
07-24 02:41:40.787: E/AndroidRuntime(1427): at com.example.gcm.MainActivity.checkPlayServices(MainActivity.java:49)
07-24 02:41:40.787: E/AndroidRuntime(1427): at com.example.gcm.MainActivity.onCreate(MainActivity.java:24)
07-24 02:41:40.787: E/AndroidRuntime(1427): at android.app.Activity.performCreate(Activity.java:5231)
07-24 02:41:40.787: E/AndroidRuntime(1427): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
declare your meta tag in under application tag:-
<application
android:allowBackup="true"
.................>
<meta-data
android:name="com.google.android.gms.version"
android:value="4452000" />
put the required integer number or reference it from the integers file
You have to add one meta-data tag inside application tag as shown in the logcat you provided
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
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'm trying to develop an android app where it shows my current location on google map , but I'm having difficulties on showing the map on emulator. I've been working with this since yesterday and I tried looking for solution by browsing similar thread but I can't figure out what's wrong with my code.
here is my logcat:
07-24 03:35:27.041: I/dalvikvm(1268): Could not find method
android.app.AlertDialog$Builder.<init>, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.a
07-24 03:35:27.041: W/dalvikvm(1268): VFY: unable to resolve direct method 145: Landroid/app/AlertDialog$Builder;.<init> (Landroid/content/Context;I)V
07-24 03:35:27.041: D/dalvikvm(1268): VFY: replacing opcode 0x70 at 0x002c
07-24 03:35:27.051: I/dalvikvm(1268): Could not find method android.app.Activity.getFragmentManager, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.b
07-24 03:35:27.051: W/dalvikvm(1268): VFY: unable to resolve virtual method 94: Landroid/app/Activity;.getFragmentManager ()Landroid/app/FragmentManager;
07-24 03:35:27.051: D/dalvikvm(1268): VFY: replacing opcode 0x6e at 0x0023
07-24 03:35:27.051: D/dalvikvm(1268): VFY: dead code 0x0026-0030 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (ILandroid/app/Activity;Landroid/support/v4/app/Fragment;ILandroid/content/DialogInterface$OnCancelListener;)Z
07-24 03:35:27.061: D/dalvikvm(1268): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp
07-24 03:35:27.061: W/dalvikvm(1268): VFY: unable to resolve instance field 60
07-24 03:35:27.061: D/dalvikvm(1268): VFY: replacing opcode 0x52 at 0x0012
07-24 03:35:27.061: D/dalvikvm(1268): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z
07-24 03:35:27.081: D/AndroidRuntime(1268): Shutting down VM
07-24 03:35:27.081: W/dalvikvm(1268): threadid=1: thread exiting with uncaught exception (group=0xb5f054f0)
07-24 03:35:27.091: E/AndroidRuntime(1268): FATAL EXCEPTION: main
07-24 03:35:27.091: E/AndroidRuntime(1268): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemapdemo/com.example.googlemapdemo.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.os.Looper.loop(Looper.java:130)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-24 03:35:27.091: E/AndroidRuntime(1268): at java.lang.reflect.Method.invokeNative(Native Method)
07-24 03:35:27.091: E/AndroidRuntime(1268): at java.lang.reflect.Method.invoke(Method.java:507)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-24 03:35:27.091: E/AndroidRuntime(1268): at dalvik.system.NativeStart.main(Native Method)
07-24 03:35:27.091: E/AndroidRuntime(1268): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:128)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.example.googlemapdemo.MainActivity.onCreate(MainActivity.java:17)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
07-24 03:35:27.091: E/AndroidRuntime(1268): ... 11 more
07-24 03:35:27.091: E/AndroidRuntime(1268): 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" />
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.common.GooglePlayServicesUtil.x(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.internal.u.F(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.internal.u.E(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.SupportMapFragment$b.ju(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.dynamic.a.a(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
07-24 03:35:27.091: E/AndroidRuntime(1268): ... 19 more
here is my
activity_main.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
GoogleMapDemo.manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemapdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="20" />
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
<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" />
<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=".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="AIzaSyAMQ0-kK-KaFM_SeGjn7Nv22WvETNRmRZc"
/>
</application>
</manifest>
Use google api 19 version emulator while creating the AVD in your Eclipse IDE.
Maps is available in google api emulator only. If the problem persist again, update the SDK of your emulator to latest build and try again.
Yes., you can get map in emulator too. To achieve this follow this step by step process which I answered in another post
In your manifest :
meta-data
must be outside application block
and you have to add :
<meta-data android:name="com.google.android.gms.version> android:value="#integer/google_play_services_version"/>
I submitted an similar question earlier on a more advanced project, so I thought I would simplify things by using the maps API tutorial provided by google to try and replicate the error I was getting, and I get the same error! Good and bad, at least I know it's not my project causing the error.
Now I just need to figure out why I am getting this error! I am new to programming but I followed this tutorial here verbatum:
https://developers.google.com/maps/documentation/android/start
Here is the error I am getting:
03-24 20:47:03.244: E/AndroidRuntime(6250): FATAL EXCEPTION: main
03-24 20:47:03.244: E/AndroidRuntime(6250): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test/com.example.test.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.os.Handler.dispatchMessage(Handler.java:99)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.os.Looper.loop(Looper.java:137)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.ActivityThread.main(ActivityThread.java:5103)
03-24 20:47:03.244: E/AndroidRuntime(6250): at java.lang.reflect.Method.invokeNative(Native Method)
03-24 20:47:03.244: E/AndroidRuntime(6250): at java.lang.reflect.Method.invoke(Method.java:525)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-24 20:47:03.244: E/AndroidRuntime(6250): at dalvik.system.NativeStart.main(Native Method)
03-24 20:47:03.244: E/AndroidRuntime(6250): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.Activity.setContentView(Activity.java:1895)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.example.test.MainActivity.onCreate(MainActivity.java:11)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.Activity.performCreate(Activity.java:5133)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
03-24 20:47:03.244: E/AndroidRuntime(6250): ... 11 more
03-24 20:47:03.244: E/AndroidRuntime(6250): 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-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.maps.internal.q.v(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.maps.internal.q.u(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.maps.MapFragment$b.ex(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.dynamic.a.a(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.app.Activity.onCreateView(Activity.java:4745)
03-24 20:47:03.244: E/AndroidRuntime(6250): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
03-24 20:47:03.244: E/AndroidRuntime(6250): ... 20 more
Here is my simple MainActivity.java
package com.example.test;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
here is my simple 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"
class="com.google.android.gms.maps.SupportMapFragment"
android:name="com.example.test.MainActivity"/>
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >
<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"/>
<!-- 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-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.test.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="HIDDEN"/>
</application>
</manifest>
The only thing I can think of is that my manifest file is improperly set up. But I followed the instructions and Eclipse didn't give me an error on it. I am up in arms here trying to figure this out. Any help would be appreciated.
Your logcat clearly said
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-24 20:47:03.244: E/AndroidRuntime(6250): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
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
....<application>
..............
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Key" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
Also Extends your Activity to FragmentActivity
MainActivity extends FragmentActivity
You need to add the below as a child of application tag as mentioned in the other answer.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Also you have
<uses-sdk
android:minSdkVersion="8"
So change this
public class MainActivity extends Activity {
to
public class MainActivity extends FragmentActivity {
Since you use SupportMapFragment you need to use FragmentActivity which is the base class for support based fragments.
Also change this
class="com.google.android.gms.maps.SupportMapFragment"
android:name="com.example.test.MainActivity"/> // remove this
to
class="com.google.android.gms.maps.SupportMapFragment"/>
Put both meta tag with your API key....in between applicationTag.
Also add permission tag with your package name which you use in Google console in your AndroidManifest.xml.
<permission
android:name="com.xyz.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.xyz.permission.MAPS_RECEIVE"/>
<application
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="Put Your API Key here"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
Extend your class activity to fragment activity use below
public class MainActivity extends FragmentActivity
Insted of this
public class MainActivity extends Activity
You are missing following lines in your Manifest file,
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Please write these lines before your MAP-API Key tag, inside the tag.
Once you will complete these changes you will get Fragment error as you are using latest version of Map but you are using Activity inside your code, So you need to change following as well,
Extends your Activity to FragmentActivity
MainActivity extends FragmentActivity
EDIT: STILL NEED HELP >:( Logcat added, as well as the manifest fix I can use for emulators only but not physical devices. If I transfer file to APK and load onto my device the manifest.xml file for that project just reverts to the second copy of the manifest.xml file.
I had this code working literally 5 minutes ago where the whole app would run a welcome screen, 6 different "flash cards", and an exit screen with button transitions. Now all of a sudden if I push any button the app crashes. Just says app has stopped working unexpectedly. I would put the logcat, but the error message is always dealing with the activity missing in the manifest. I am getting frustrated and just want to sleep.
logcat I get for the bottom manifest file that it always goes to. If it manually add the others then I do not get it. DOES NOT WORK WHEN TURNING PROJECT INTO APK FORMAT
11-04 05:29:01.912: D/gralloc_goldfish(819): Emulator without GPU emulation detected.
11-04 05:29:04.302: D/AndroidRuntime(819): Shutting down VM
11-04 05:29:04.302: W/dalvikvm(819): threadid=1: thread exiting with uncaught exception (group=0x41465700)
11-04 05:29:04.382: E/AndroidRuntime(819): FATAL EXCEPTION: main
11-04 05:29:04.382: E/AndroidRuntime(819): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.androidassignment2/com.example.androidassignment2.MainActivity}; have you declared this activity in your AndroidManifest.xml?
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.Activity.startActivityForResult(Activity.java:3390)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.Activity.startActivityForResult(Activity.java:3351)
11-04 05:29:04.382: E/AndroidRuntime(819): at com.example.androidassignment2.Startup$1.onClick(Startup.java:22)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.view.View.performClick(View.java:4240)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.view.View$PerformClick.run(View.java:17721)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.os.Handler.handleCallback(Handler.java:730)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.os.Handler.dispatchMessage(Handler.java:92)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.os.Looper.loop(Looper.java:137)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.ActivityThread.main(ActivityThread.java:5103)
11-04 05:29:04.382: E/AndroidRuntime(819): at java.lang.reflect.Method.invokeNative(Native Method)
11-04 05:29:04.382: E/AndroidRuntime(819): at java.lang.reflect.Method.invoke(Method.java:525)
11-04 05:29:04.382: E/AndroidRuntime(819): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-04 05:29:04.382: E/AndroidRuntime(819): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-04 05:29:04.382: E/AndroidRuntime(819): at dalvik.system.NativeStart.main(Native Method)
working manifest file fix
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidassignment2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.androidassignment2.Startup"
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.androidassignment2.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.AndroidAssignment2.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.AndroidAssignment2.MainActivity" />
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_1" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_2" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_3" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_4" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_5" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2" >
</activity>
<activity
android:name="com.example.androidassignment2.MainActivity" >
</activity>
</application>
</manifest>
all of the activities just go away once put into apk
this happens to the manifest file after putting the project into apk
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidassignment2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.androidassignment2.Startup"
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.androidassignment2.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.AndroidAssignment2.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.AndroidAssignment2.MainActivity" />
</activity>
</application>
</manifest>
EDIT: Before and after manifests.
LOGCAT JUST SAYS ACTIVITY NOT FOUND DECLARE IN MANIFEST
am getting this exception:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{business.premium/business.premium.Problemio}:
java.lang.ClassNotFoundException: business.premium.Problemio
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: business.premium.Problemio
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
... 11 more
java.lang.ClassNotFoundException: business.premium.Problemio
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
it says that class is not there, but it IS there. I tried to configure things in my project's build path, but not too sure what to tweak there.
And here is how I start my Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="business.premium"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/CustomTheme"
android:name="MyApplication"
android:debuggable="true">
<activity
android:name=".Problemio"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Any thoughts on how to solve this, or what to look into? Thanks!
Its because you specified the "android:name" attribute in the application node in the manifest file.
Do not use the android:name attribute!
It, misleadingly, does not have anything to do with the name of your app and is actually the name of an extra class to load before loading your application. That's why you are getting the ClassNotFoundException.
Remove it and it should work:
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:description="#string/help_text" >
This answer is taken from: java.lang.ClassNotFoundException on working app