google play services not found on device - android

I'm an android newbie. I'm using android studio, device 4.0.4, api 14. When I run on device, I get the error message. It looks like google play services are missing on the device. I can see google play store on the device. I also activated using my gmail account. Device is not setup with verizon. Any help on what I'm missing?
09-23 10:16:44.642 19251-19251/com.noatta.www.noatta_14 D/dalvikvm﹕ Late-enabling CheckJNI
09-23 10:16:45.263 19251-19251/com.noatta.www.noatta_14 W/SignInButton﹕ Sign in button not found, using placeholder instead
09-23 10:16:45.533 19251-19251/com.noatta.www.noatta_14 W/GooglePlayServicesUtil﹕ Google Play services is missing.
09-23 10:16:45.543 19251-19251/com.noatta.www.noatta_14 W/GooglePlayServicesUtil﹕ Google Play services is missing.
09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_14 D/AndroidRuntime﹕ Shutting down VM
09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_14 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40ab0228)
09-23 10:16:45.823 19251-19251/com.noatta.www.noatta_14 E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
at com.noatta.www.noatta_14.LoginActivity.updateConnectButtonState(LoginActivity.java:250)
at com.noatta.www.noatta_14.PlusBaseActivity.onConnectionFailed(PlusBaseActivity.java:264)
at com.google.android.gms.internal.id$g.onConnectionFailed(Unknown Source)
at com.google.android.gms.internal.ie.a(Unknown Source)
at com.google.android.gms.internal.id$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4945)
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)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ killProcess, pid=19251
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ dalvik.system.VMStack.getThreadStackTrace(Native Method)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ java.lang.Thread.getStackTrace(Thread.java:599)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ android.os.Process.killProcess(Process.java:788)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:104)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 D/Process﹕ dalvik.system.NativeStart.main(Native Method)
09-23 10:16:47.975 19251-19251/com.noatta.www.noatta_14 I/Process﹕ Sending signal. PID: 19251 SIG: 9
Manifest
<code>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.noatta.www.noatta_14" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateHidden"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
<!-- To access Google+ APIs: -->
<uses-permission android:name="android.permission.INTERNET" />
<!--
To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
option is required to comply with the Google+ Sign-In developer policies
-->
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<!-- To retrieve the account name (email) as part of sign-in: -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />

You are missing this: https://play.google.com/store/apps/details?id=com.google.android.gms
Google Play Services != Google Play Store.

Related

Exception of google maps in my android application

I did all steps to show Google maps in android.
I have downloaded the newest version of Google play services , but still I have the below exceptions :
07-18 05:25:36.319: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.389: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.389: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.489: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.529: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.559: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.629: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.709: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.769: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.949: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:36.989: W/GooglePlayServicesUtil(2054): Google Play services is missing.
07-18 05:25:40.239: I/Choreographer(2054): Skipped 494 frames! The application may be doing too much work on its main thread.
07-18 05:25:44.689: D/gralloc_goldfish(2054): Emulator without GPU emulation detected.
07-18 05:25:55.930: D/AndroidRuntime(2054): Shutting down VM
07-18 05:25:55.930: W/dalvikvm(2054): threadid=1: thread exiting with uncaught exception (group=0xb1f58648)
07-18 05:25:56.010: E/AndroidRuntime(2054): FATAL EXCEPTION: main
07-18 05:25:56.010: E/AndroidRuntime(2054): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.app.Activity.startActivityForResult(Activity.java:3390)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.app.Activity.startActivityForResult(Activity.java:3351)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.app.Activity.startActivity(Activity.java:3587)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.app.Activity.startActivity(Activity.java:3555)
07-18 05:25:56.010: E/AndroidRuntime(2054): at com.google.android.gms.dynamic.a$5.onClick(Unknown Source)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.view.View.performClick(View.java:4240)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.view.View$PerformClick.run(View.java:17721)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.os.Handler.handleCallback(Handler.java:730)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.os.Handler.dispatchMessage(Handler.java:92)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.os.Looper.loop(Looper.java:137)
07-18 05:25:56.010: E/AndroidRuntime(2054): at android.app.ActivityThread.main(ActivityThread.java:5103)
07-18 05:25:56.010: E/AndroidRuntime(2054): at java.lang.reflect.Method.invokeNative(Native Method)
07-18 05:25:56.010: E/AndroidRuntime(2054): at java.lang.reflect.Method.invoke(Method.java:525)
07-18 05:25:56.010: E/AndroidRuntime(2054): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
07-18 05:25:56.010: E/AndroidRuntime(2054): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-18 05:25:56.010: E/AndroidRuntime(2054): at dalvik.system.NativeStart.main(Native Method)
07-18 05:26:02.570: I/Process(2054): Sending signal. PID: 2054 SIG: 9
this is the manifest of my app i have added permisions and the api key:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tunivote"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<permission android:name="com.example.tunivote.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
<uses-permission android:name="com.example.tunivote.MAPS_RECEIVE" />
<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-permission android:name="com.example.tunivote.providres.gsf.permission.READ_GSERVICES"/>
<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.maps.v2.API_KEY"
android:value="my api key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<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>
<activity android:name="authentification"></activity>
</application>
</manifest>
Once check your emulator type, Whether it is Android or Google emulator. Please make sure your running on Google API Emulator.

Android app does not start in emulator or device

I have finally finished my app and everything was working fine. I went back to add in the admob stuff and now it will not start in the emulator. it says it successfully installed the app on the emulator but it does not launch and the icon is not visible to try to manually run. I think the manifest is where my error is but I am unsure.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidsleepmachine.gamble"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.WAKE_LOCK" >
</uses-permission>
<uses-permission android:name="android.permission.Internet" >
</uses-permission>
<uses-permission android:name="android.permission.Write_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"
></activity>
<activity
android:name=".Splash"
android:label="#string/app_name"
android:theme="#android:style/Theme.Dialog" >
<intent-filter>
<action android:name="com.AndroidSleepMachine.gamble.SPLASH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.AndroidSleepMachine.gamble.HOME"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".About"
android:label="#string/app_name"
android:theme="#android:style/Theme.Dialog" >
<intent-filter>
<action android:name="com.AndroidSleepMachine.gamble.ABOUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.androidsleepmachine.gamble.Ship" />
<activity android:name="com.androidsleepmachine.gamble.OceanThunder" />
<activity android:name="com.androidsleepmachine.gamble.Ocean" />
<activity android:name="com.androidsleepmachine.gamble.Forest" />
<activity android:name="com.androidsleepmachine.gamble.Rain" />
<activity android:name="com.androidsleepmachine.gamble.Thunderbirds" />
<activity android:name="com.androidsleepmachine.gamble.Meditation" />
<activity android:name="com.androidsleepmachine.gamble.Focus" />
<activity android:name="com.androidsleepmachine.gamble.Pain" />
</application>
</manifest>
logcat files
09-23 13:17:47.582: E/AndroidRuntime(1563): FATAL EXCEPTION: main
09-23 13:17:47.582: E/AndroidRuntime(1563): java.lang.RuntimeException: Unable to
instantiate activity
ComponentInfo{com.androidsleepmachine.gamble/com.AndroidSleepMachine.gamble.HOME}:
java.lang.ClassNotFoundException: com.AndroidSleepMachine.gamble.HOME
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.access$600(ActivityThread.java:130)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.os.Looper.loop(Looper.java:137)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.main(ActivityThread.java:4745)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
java.lang.reflect.Method.invokeNative(Native Method)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
java.lang.reflect.Method.invoke(Method.java:511)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
dalvik.system.NativeStart.main(Native Method)
09-23 13:17:47.582: E/AndroidRuntime(1563): Caused by:
java.lang.ClassNotFoundException: com.AndroidSleepMachine.gamble.HOME
09-23 13:17:47.582: E/AndroidRuntime(1563): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
It looks like your main activity name is incorrect. Java is case sensitive and your application package name is
package="com.androidsleepmachine.gamble"
while your main activity class name is
com.AndroidSleepMachine.gamble.HOME
The ClassNotFoundException is being thrown because your Activity class name is incorrect in the manifest and isn't being found by the class loader.
It cannot find a class called:
com.AndroidSleepMachine.gamble.HOME
Why is "AndroidSleepMachine" using capital letters?
Why not just use:
android:name=".HOME"
...if your class is indeed called HOME.java? Case-sensitivity may be causing your issue.
com.AndroidSleepMachine.gamble.HOME is not the same as com.androidsleepmachine.gamble.HOME

GCM application works fine on emulator but crashes on android device

I have developed an application and implemented GCM(Google Cloud Messaging), it works perfectly fine on the emulator as well as on bluestacks but when I run it on a device it stops unfortunately and I can't get the reason.
Manifest file
<uses-sdk android:minSdkVersion="8" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.androiddemos.NotificationActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name=".ResultActivity"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".NotificationActivity" />
</activity>
<activity
android:name=".GcmActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.example.androiddemos" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" >
</service>
</application>
<permission
android:name="com.example.androiddemos.permission.C2D_MESSAGE"
android:protectionLevel="signature" >
</permission>
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.example.androiddemos.permission.C2D_MESSAGE" />
LOgcat
01-09 14:55:27.034: E/AndroidRuntime(25344): java.lang.IllegalArgumentException: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{com.example.androiddemos/com.example.androiddemos.MainActivity}
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:236)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:215)
01-09 14:55:27.034: E/AndroidRuntime(25344): at com.example.androiddemos.GcmActivity.sendNotification(GcmActivity.java:70)
01-09 14:55:27.034: E/AndroidRuntime(25344): at com.example.androiddemos.GcmActivity.checkGCM(GcmActivity.java:49)
01-09 14:55:27.034: E/AndroidRuntime(25344): at com.example.androiddemos.GcmActivity$1.onClick(GcmActivity.java:33)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.view.View.performClick(View.java:4084)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.view.View$PerformClick.run(View.java:16966)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.os.Handler.handleCallback(Handler.java:615)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.os.Handler.dispatchMessage(Handler.java:92)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.os.Looper.loop(Looper.java:137)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.app.ActivityThread.main(ActivityThread.java:4745)
01-09 14:55:27.034: E/AndroidRuntime(25344): at java.lang.reflect.Method.invokeNative(Native Method)
01-09 14:55:27.034: E/AndroidRuntime(25344): at java.lang.reflect.Method.invoke(Method.java:511)
01-09 14:55:27.034: E/AndroidRuntime(25344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-09 14:55:27.034: E/AndroidRuntime(25344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-09 14:55:27.034: E/AndroidRuntime(25344): at dalvik.system.NativeStart.main(Native Method)
01-09 14:55:27.034: E/AndroidRuntime(25344): Caused by: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{com.example.androiddemos/com.example.androiddemos.MainActivity}
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:225)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:298)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.support.v4.app.NavUtils.getParentActivityIntent(NavUtils.java:261)
01-09 14:55:27.034: E/AndroidRuntime(25344): at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:229)
01-09 14:55:27.034: E/AndroidRuntime(25344): ... 15 more
I believe the problem is because you do not have MainActivity defined in your manifest based on this logcat line:
14:55:27.034: E/AndroidRuntime(25344): Caused by:
android.content.pm.PackageManager$NameNotFoundException:
ComponentInfo{com.example.androiddemos/com.example.androiddemos.MainActivity} 01-09
You have MainActivity referenced as the parentActivityName but not defined in the manifest at all:
<activity
android:name=".ResultActivity"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".NotificationActivity" />
</activity>
If you are still using MainActivity you will need to add it to the manifest:
<activity
android:name=".MainActivity">
</activity>

Android ClassNotFoundException on published app

I have an application thats been published awhile on Google play, I have been fixing reported bugs as they come in but recently this log below came in and I don't know what to make of it:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mammothtooth.flightinfo/com.mammothtooth.flightinfo.ui.SplashActivity}: java.lang.ClassNotFoundException: com.mammothtooth.flightinfo.ui.SplashActivity in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/mnt/asec/com.mammothtooth.flightinfo-1/pkg.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1743)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
at android.app.ActivityThread.access$1500(ActivityThread.java:132)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4277)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.mammothtooth.flightinfo.ui.SplashActivity in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/mnt/asec/com.mammothtooth.flightinfo-1/pkg.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1735)
Does anyone know anything about this type of error log? My SplashScreenActivity is there and its defined as the entry point of the application in the manifest as follows:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
<uses-library android:name="com.google.android.maps" />
<activity
android:label="#string/app_name"
android:name=".ui.SplashActivity"
android:theme="#android:style/Theme.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|orientation"
android:screenOrientation="portrait">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Would the placing of the uses-library be an issue in the manifest?
I can't reproduce this issue on any of my android devices so any help is greatly appreciated in locating what might be the cause of this issue.

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