GPStracker code crash concept - android

Good evening and good week. We run this script from tutorial but my crash concept does not make an error in the code. nor to the errors refer to a particular line code. Please for your help.
Tutorial: http://gabesechansoftware.com/location-tracking/
01-26 15:36:06.751: I/Process(10528): Sending signal. PID: 10528 SIG: 9
01-26 15:36:18.251: D/AndroidRuntime(10613): Shutting down VM
01-26 15:36:18.251: W/dalvikvm(10613): threadid=1: thread exiting with uncaught exception (group=0x2b542210)
01-26 15:36:18.251: E/AndroidRuntime(10613): FATAL EXCEPTION: main
01-26 15:36:18.251: E/AndroidRuntime(10613): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{pack/pack.MainActivity}: java.lang.ClassNotFoundException: pack.MainActivity
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1891)
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.os.Handler.dispatchMessage(Handler.java:99)
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.os.Looper.loop(Looper.java:137)
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.app.ActivityThread.main(ActivityThread.java:4441)
01-26 15:36:18.251: E/AndroidRuntime(10613): at java.lang.reflect.Method.invokeNative(Native Method)
01-26 15:36:18.251: E/AndroidRuntime(10613): at java.lang.reflect.Method.invoke(Method.java:511)
01-26 15:36:18.251: E/AndroidRuntime(10613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-26 15:36:18.251: E/AndroidRuntime(10613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-26 15:36:18.251: E/AndroidRuntime(10613): at dalvik.system.NativeStart.main(Native Method)
01-26 15:36:18.251: E/AndroidRuntime(10613): Caused by: java.lang.ClassNotFoundException: pack.MainActivity
01-26 15:36:18.251: E/AndroidRuntime(10613): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-26 15:36:18.251: E/AndroidRuntime(10613): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-26 15:36:18.251: E/AndroidRuntime(10613): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
01-26 15:36:18.251: E/AndroidRuntime(10613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882)
01-26 15:36:18.251: E/AndroidRuntime(10613): ... 11 more
01-26 15:41:18.281: I/Process(10613): Sending signal. PID: 10613 SIG: 9
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.pack"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="24" />
<permission
android:name="my.pack.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="my.pack.permission.MAPS_RECEIVE"/>
<uses-permission android:name="permission_name"/>
<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" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My api key"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

You full activity name (package + class) is not the same in manifest and code. There's pack.MainActivity declared in manifest but it is not found in code.

Related

Google Map api v2 application stop working

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"/>

Weird Android error

I'm trying to run my start my app, but i get a weird error. I've changed my OS but I've imported my projects in my Workspace. What can be wrong? Every thing is added to the maniferst file like is should, and this app was running nice before I change my OS.
12-13 18:48:10.578: W/dalvikvm(19830): Unable to resolve superclass of Lcom/darkovski/quran/Main; (56)
12-13 18:48:10.578: W/dalvikvm(19830): Link of class 'Lcom/darkovski/quran/Main;' failed
12-13 18:48:10.578: D/AndroidRuntime(19830): Shutting down VM
12-13 18:48:10.578: W/dalvikvm(19830): threadid=1: thread exiting with uncaught exception (group=0x2b542210)
12-13 18:48:10.598: E/AndroidRuntime(19830): FATAL EXCEPTION: main
12-13 18:48:10.598: E/AndroidRuntime(19830): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.darkovski.quran/com.darkovski.quran.Main}: java.lang.ClassNotFoundException: com.darkovski.quran.Main
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1891)
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.app.ActivityThread.access$600(ActivityThread.java:127)
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.os.Looper.loop(Looper.java:137)
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.app.ActivityThread.main(ActivityThread.java:4441)
12-13 18:48:10.598: E/AndroidRuntime(19830): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 18:48:10.598: E/AndroidRuntime(19830): at java.lang.reflect.Method.invoke(Method.java:511)
12-13 18:48:10.598: E/AndroidRuntime(19830): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
12-13 18:48:10.598: E/AndroidRuntime(19830): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
12-13 18:48:10.598: E/AndroidRuntime(19830): at dalvik.system.NativeStart.main(Native Method)
12-13 18:48:10.598: E/AndroidRuntime(19830): Caused by: java.lang.ClassNotFoundException: com.darkovski.quran.Main
12-13 18:48:10.598: E/AndroidRuntime(19830): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-13 18:48:10.598: E/AndroidRuntime(19830): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-13 18:48:10.598: E/AndroidRuntime(19830): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
12-13 18:48:10.598: E/AndroidRuntime(19830): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882)
12-13 18:48:10.598: E/AndroidRuntime(19830): ... 11 more
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.darkovski.quran"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="9"
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.darkovski.quran.Main"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.darkovski.quran.Playlist"
android:screenOrientation="portrait" />
<activity
android:name="com.darkovski.quran.AlbumDetails"
android:screenOrientation="portrait" />
<service
android:name=".MediaPlayerService"
android:enabled="true" />
<activity
android:name="com.darkovski.quran.Favorites"
android:screenOrientation="portrait" />
<activity
android:name="com.darkovski.quran.DownloadManager"
android:screenOrientation="portrait" />
</application>
</manifest>
This has nothing to do with Manifest. It is because somehow the super class of your class com/darkovski/quran/Main is not getting loaded in the apk which leads to a class not found.
Try cleaning and rebuilding the project or restarting eclipse. Just check if all the libraries are present in the new workspace and are build properly.

Android - exception launching project on start after copying a lot of code over from another project

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

Phonegap app Crashes at Runtime

When i Try to run my app from both simulator and phys device it crashes, heres the log
I have phonegap 1.3.0 :)
01-12 14:13:51.742: W/dalvikvm(344): threadid=1: thread exiting with uncaught exception (group=0x40015560)
01-12 14:13:51.791: E/AndroidRuntime(344): FATAL EXCEPTION: main
01-12 14:13:51.791: E/AndroidRuntime(344): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.philipslighting.roadlight/com.philipslighting.roadlight.PhilipsRoadlightFinalActivity}: java.lang.ClassNotFoundException: com.philipslighting.roadlight.PhilipsRoadlightFinalActivity in loader dalvik.system.PathClassLoader[/data/app/com.philipslighting.roadlight-1.apk]
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.os.Handler.dispatchMessage(Handler.java:99)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.os.Looper.loop(Looper.java:123)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.reflect.Method.invokeNative(Native Method)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.reflect.Method.invoke(Method.java:507)
01-12 14:13:51.791: E/AndroidRuntime(344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-12 14:13:51.791: E/AndroidRuntime(344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-12 14:13:51.791: E/AndroidRuntime(344): at dalvik.system.NativeStart.main(Native Method)
01-12 14:13:51.791: E/AndroidRuntime(344): Caused by: java.lang.ClassNotFoundException: com.philipslighting.roadlight.PhilipsRoadlightFinalActivity in loader dalvik.system.PathClassLoader[/data/app/com.philipslighting.roadlight-1.apk]
01-12 14:13:51.791: E/AndroidRuntime(344): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-12 14:13:51.791: E/AndroidRuntime(344): ... 11 more
01-12 14:13:51.821: W/ActivityManager(61): Force finishing activity com.philipslighting.roadlight/.PhilipsRoadlightFinalActivity
01-12 14:13:52.341: W/ActivityManager(61): Activity pause timeout for HistoryRecord{4053ec18 com.philipslighting.roadlight/.PhilipsRoadlightFinalActivity}
01-12 14:13:53.151: I/Process(328): Sending signal. PID: 328 SIG: 9
01-12 14:13:53.181: I/ActivityManager(61): Process com.roadlight.philips (pid 328) has died.
01-12 14:13:54.331: I/Process(344): Sending signal. PID: 344 SIG: 9
01-12 14:13:54.371: W/InputManagerService(61): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#405c2d80
01-12 14:13:54.621: I/ActivityManager(61): Process com.philipslighting.roadlight (pid 344) has died.
here is my android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.philipslighting.roadlight"
android:versionCode="4"
android:versionName="1.2" >
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity
android:label="#string/app_name"
android:name=".activities.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Were in the activity tag would you you import the phone gap activity?
Thanks in advance !
It you have used this tutorial http://phonegap.com/start#android
then to fix java.lang.ClassNotFoundException as above you need to check the box next to cordova-XXX.jar in the "Order and Export" tab then you add a dependency for cordova-XXX.jar in Libraries tab at "Configure Build Path".
And of course mainclass's name must be correct at android:name="<main class name>".
I was following the phonegap droid getting started guide
In my case, I had created a folder called lib instead of libs. A symptom of this was that I had to manually add the jar to the build path. I removed the jar from the build path, renamed the lib folder to libs and things started working immediately.
In activity you import the file for PhoneGap please check it.
and see the index.html file in your folder.
I think just follow this path :
http://phonegap.com/start#android
See, video you will find solution for this.
<activity
android:label="#string/app_name"
android:name=".activities.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
you should mention with package name along with main class name in 'activity' tag,look at below example:
android:name="com.philipslighting.roadlight.MainActivity"
<activity
android:label="#string/app_name"
android:name="yourPACKAGEname.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Unable to load webpage using WebView in Android

I have recently taken up Android Development and I was looking to using the WebView display webpages. I picked up from the sample that was given on Google site and for some reason the emulator kept saying page was not available. I searched in StackOverflow and found links relating to WebViewClient. I tried that also but no luck there, I have checked multiple times about the manifest entry for internet permission and its there. As a test I ran the browser available within the emulator and sure enough my firewall popped up a question on whether to allow it access or not. The pop up never came to me when I was running it from program. The code that I have is what is there Google pages
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
mWebView.setWebViewClient(new HelloWebViewClient());
private class HelloWebViewClient extends WebViewClient {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
I tried loading simple html directly using loadData and it worked fine. I am at loss as to what is happening and how this can be resolved. I would appreciate any help on this.
Adding the Android Manifest here
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellowebview"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloWebView"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-permission android:name="android.permission.INTERNET" />
</application>
</manifest>
To check if its just a WebView thingy, I tried accessing the internet using httpGet and httpResonse classes and got the same problem, the code was not able to connect to the given site. It failed stating the below
05-10 00:37:53.191: WARN/System.err(294): java.net.UnknownHostException: feeds.feedburner.com
05-10 00:37:53.230: WARN/System.err(294): at java.net.InetAddress.lookupHostByName(InetAddress.java:513)
05-10 00:37:53.230: WARN/System.err(294): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:278)
05-10 00:37:53.230: WARN/System.err(294): at java.net.InetAddress.getAllByName(InetAddress.java:242)
05-10 00:37:53.250: WARN/System.err(294): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
05-10 00:37:53.250: WARN/System.err(294): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
05-10 00:37:53.250: WARN/System.err(294): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
05-10 00:37:53.271: WARN/System.err(294): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
05-10 00:37:53.271: WARN/System.err(294): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
05-10 00:37:53.280: WARN/System.err(294): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
05-10 00:37:53.291: WARN/System.err(294): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
05-10 00:37:53.301: WARN/System.err(294): at com.example.hellowebview.HelloWebView.onCreate(HelloWebView.java:43)
05-10 00:37:53.301: WARN/System.err(294): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-10 00:37:53.309: WARN/System.err(294): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-10 00:37:53.322: WARN/System.err(294): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-10 00:37:53.330: WARN/System.err(294): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-10 00:37:53.340: WARN/System.err(294): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-10 00:37:53.350: WARN/System.err(294): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 00:37:53.350: WARN/System.err(294): at android.os.Looper.loop(Looper.java:123)
05-10 00:37:53.361: WARN/System.err(294): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-10 00:37:53.361: WARN/System.err(294): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 00:37:53.372: WARN/System.err(294): at java.lang.reflect.Method.invoke(Method.java:521)
05-10 00:37:53.380: WARN/System.err(294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-10 00:37:53.380: WARN/System.err(294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-10 00:37:53.401: WARN/System.err(294): at dalvik.system.NativeStart.main(Native Method)
05-10 00:37:56.773: WARN/ActivityManager(58): Launch timeout has expired, giving up wake lock!
05-10 00:37:58.083: WARN/ActivityManager(58): Activity idle timeout for HistoryRecord{44fc9108 com.example.hellowebview/.HelloWebView}
05-10 00:38:06.300: DEBUG/KeyguardViewMediator(58): pokeWakelock(5000)
05-10 00:38:06.651: INFO/ARMAssembler(58): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x3724c8:0x3725d4] in 7266287 ns
05-10 00:38:06.720: INFO/ARMAssembler(58): generated scanline__00000177:03515104_00001001_00000000 [ 91 ipp] (114 ins) at [0x371380:0x371548] in 1486222 ns
05-10 00:38:30.430: DEBUG/AndroidRuntime(294): Shutting down VM
05-10 00:38:30.430: WARN/dalvikvm(294): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): FATAL EXCEPTION: main
05-10 00:38:30.752: ERROR/AndroidRuntime(294): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hellowebview/com.example.hellowebview.HelloWebView}: java.lang.NullPointerException
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.os.Looper.loop(Looper.java:123)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at java.lang.reflect.Method.invoke(Method.java:521)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at dalvik.system.NativeStart.main(Native Method)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): Caused by: java.lang.NullPointerException
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at com.example.hellowebview.HelloWebView.onCreate(HelloWebView.java:51)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): ... 11 more
Got it. For some reason the order in which the permission is set matters a lot. I changed the order of my permission setting in manifest file and it worked. Here's the modified manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellowebview"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloWebView"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I am not sure what is the significance of this but would appreciate if anyone could elaborate.
Got it. For some reason the order in which the permission is set matters a lot. I changed the order of my permission setting in manifest file and it worked. Here's the modified manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellowebview"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloWebView"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
mWebView = (WebView) findViewById(R.id.webview);
WebSettings setting =mWebView.getSettings();
mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
mWebView.loadUrl("http://www.google.com");
Use this code .shouldOverrideUrlLoading() not use compulsary.use this code and please reply me this code work or not
Your code looks fine. I would make sure internet is working correctly on the emulator by browsing a few pages on the Android Browser. I have had problems before where the emulator would lose network access.

Categories

Resources