i am using eclipse for android application development.
i want to connect my android application to mysql database.
i search code from http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/
and Log says
11-13 01:08:49.439: E/AndroidRuntime(1037): FATAL EXCEPTION: main
11-13 01:08:49.439: E/AndroidRuntime(1037): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.bhaapapp3/com.bhaapapp3.AllProductsActivity}; have you declared this activity in your AndroidManifest.xml?
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.app.Activity.startActivityForResult(Activity.java:3390)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.app.Activity.startActivityForResult(Activity.java:3351)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.app.Activity.startActivity(Activity.java:3587)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.app.Activity.startActivity(Activity.java:3555)
11-13 01:08:49.439: E/AndroidRuntime(1037): at com.bhaapapp3.MainActivity$1.onClick(MainActivity.java:34)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.view.View.performClick(View.java:4240)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.view.View$PerformClick.run(View.java:17721)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.os.Handler.handleCallback(Handler.java:730)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.os.Handler.dispatchMessage(Handler.java:92)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.os.Looper.loop(Looper.java:137)
11-13 01:08:49.439: E/AndroidRuntime(1037): at android.app.ActivityThread.main(ActivityThread.java:5103)
11-13 01:08:49.439: E/AndroidRuntime(1037): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 01:08:49.439: E/AndroidRuntime(1037): at java.lang.reflect.Method.invoke(Method.java:525)
11-13 01:08:49.439: E/AndroidRuntime(1037): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-13 01:08:49.439: E/AndroidRuntime(1037): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-13 01:08:49.439: E/AndroidRuntime(1037): at dalvik.system.NativeStart.main(Native Method)
11-13 01:08:52.879: I/Process(1037): Sending signal. PID: 1037 SIG: 9
plz help me
and menifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bhaapapp3"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.bhaapapp3.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- All Product Activity -->
<activity
android:name=".AllProductsActivity"
android:label="All Products" >
</activity>
<!-- Add Product Activity -->
<activity
android:name=".NewProductActivity"
android:label="Add New Product" >
</activity>
<!-- Edit Product Activity -->
<activity
android:name=".EditProductActivity"
android:label="Edit Product" >
</activity>
</activity>
</application>
</manifest>
Assuming, you do not have permissions set from your LogCat error description, here is my contents for my AndroidMainfest.xml file that has access to the internet:
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
Other than that, you should be fine to download a file from the internet.
And if still this will not work for you, then i suggest you to view given Videos there by Ravi Tamada at AndroidHive.info
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>
I found similar topics in stackoverflow but it didn't help for me. I want to show map, but when i run it, it return force close. Here are the codes :
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
this is my layout :
<fragment
android:id="#+id/map"
android:layout_width="fill_parent"
android:layout_height="300dp"
android:layout_margin="20dp"
class="com.google.android.gms.maps.MapFragment" />
this is my manifest :
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MY_API_KEY" />
</application>
this my logcat :
11-13 16:03:10.652: E/AndroidRuntime(32202): FATAL EXCEPTION: main
11-13 16:03:10.652: E/AndroidRuntime(32202): java.lang.RuntimeException: Unable to start activity ComponentInfo{id.go.kpp.aplikasipupi/id.go.kpp.aplikasipupi.kartu}: android.view.InflateException: Binary XML file line #739: Error inflating class fragment
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.access$600(ActivityThread.java:140)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.os.Looper.loop(Looper.java:137)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.main(ActivityThread.java:4895)
11-13 16:03:10.652: E/AndroidRuntime(32202): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 16:03:10.652: E/AndroidRuntime(32202): at java.lang.reflect.Method.invoke(Method.java:511)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
11-13 16:03:10.652: E/AndroidRuntime(32202): at dalvik.system.NativeStart.main(Native Method)
11-13 16:03:10.652: E/AndroidRuntime(32202): Caused by: android.view.InflateException: Binary XML file line #739: Error inflating class fragment
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.setContentView(Activity.java:1912)
11-13 16:03:10.652: E/AndroidRuntime(32202): at id.go.kpp.aplikasipupi.kartu.onCreate(kartu.java:100)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.performCreate(Activity.java:5163)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
11-13 16:03:10.652: E/AndroidRuntime(32202): ... 11 more
11-13 16:03:10.652: E/AndroidRuntime(32202): 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" />
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment$b.cE(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.onCreateView(Activity.java:4813)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
11-13 16:03:10.652: E/AndroidRuntime(32202): ... 24 more
i don't know why it still error, i hope somebody can help me to solve my problem.
The logcat is clear
You need to add the below to manifest file
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
https://developers.google.com/maps/documentation/android/start#add_the_google_play_services_version_to_your_apps_manifest
Edit your application's AndroidManifest.xml file, and add the following declaration within the <application> element. This embeds the version of Google Play services that the app was compiled with.
I got the same exception as well, but I figured out for Google API v2 to work, you must include these permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
I hope this will help you guys.
P.S I used these permissions for adding a simple map in my app. There are certain other permissions which this link suggests as well.
I am trying to retrieve specific data like custom ads, username, date etc from database. so followed the code from this Need a simple tutorial for android/webservice work?. I'm going wrong some where can any one help as i am new to android.Getting following errors
11-13 21:57:14.720: E/AndroidRuntime(399): FATAL EXCEPTION: main
11-13 21:57:14.720: E/AndroidRuntime(399): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.response/com.response.FetchList}: java.lang.ClassCastException: com.response.FetchList
11-13 21:57:14.720: E/AndroidRuntime(399): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
11-13 21:57:14.720: E/AndroidRuntime(399): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-13 21:57:14.720: E/AndroidRuntime(399): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-13 21:57:14.720: E/AndroidRuntime(399): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-13 21:57:14.720: E/AndroidRuntime(399): at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 21:57:14.720: E/AndroidRuntime(399): at android.os.Looper.loop(Looper.java:123)
11-13 21:57:14.720: E/AndroidRuntime(399): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-13 21:57:14.720: E/AndroidRuntime(399): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 21:57:14.720: E/AndroidRuntime(399): at java.lang.reflect.Method.invoke(Method.java:521)
11-13 21:57:14.720: E/AndroidRuntime(399): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-13 21:57:14.720: E/AndroidRuntime(399): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-13 21:57:14.720: E/AndroidRuntime(399): at dalvik.system.NativeStart.main(Native Method)
11-13 21:57:14.720: E/AndroidRuntime(399): Caused by: java.lang.ClassCastException: com.response.FetchList
11-13 21:57:14.720: E/AndroidRuntime(399): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-13 21:57:14.720: E/AndroidRuntime(399): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
Edit-
Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.response"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Response"
android:label="#string/title_activity_response" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="android.support.v4.app.FragmentActivity" />
</activity>
<activity
android:name=".XMLParser"
android:label="#string/title_activity_response" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".FetchList"
android:label="#string/title_activity_response" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
If you've taken the code from that link exactly as-is, then you could be running into that error at the line,
public class FetchList extends asyncTask<Void,Void,Byte>{
doinbackground{
Which would actually be
public class FetchList extends asyncTask<Void, Void, Byte> {
#Override
protected Byte doInBackground (Void... voids){
...
}
}
EDIT: From the code in your comment,
public class FetchList extends AsyncTask<Void,Void,Byte>{
#Override
protected Byte doInBackground1(Void... arg0){
// this was explained in first step
Response res = new Response("url");
String response = res.getResponse();
XMLParser xml = new XMLParser(response);
ArrayList<XMLParser> itemList = xml.getItemList();
return xml.parse();
}
}
In this case let me know what the Logcat output is.
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