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.
Related
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.
I'm new to developing for Android and I'm having trouble launching my project. Whenever I launch it, it crashes and I get an error. I've put breakpoints throughout my code but it crashes before it reaches them. Here is the output from LogCat:
07-18 18:22:17.695: I/System.out(32229): Sending WAIT chunk
07-18 18:22:17.695: W/ActivityThread(32229): Application com.amvara.skatometer is waiting for the debugger on port 8100...
07-18 18:22:17.945: I/dalvikvm(32229): Debugger is active
07-18 18:22:18.095: I/System.out(32229): Debugger has connected
07-18 18:22:18.095: I/System.out(32229): waiting for debugger to settle...
07-18 18:22:18.295: I/System.out(32229): waiting for debugger to settle...
07-18 18:22:18.500: I/System.out(32229): waiting for debugger to settle...
07-18 18:22:18.700: I/System.out(32229): waiting for debugger to settle...
07-18 18:22:18.900: I/System.out(32229): waiting for debugger to settle...
07-18 18:22:19.100: I/System.out(32229): waiting for debugger to settle...
07-18 18:22:19.300: I/System.out(32229): waiting for debugger to settle...
07-18 18:22:19.500: I/System.out(32229): waiting for debugger to settle...
07-18 18:22:19.705: I/System.out(32229): debugger has settled (1434)
07-18 18:22:19.735: W/dalvikvm(32229): Unable to resolve superclass of Lcom/amvara/skatometer/ItemListActivity; (29)
07-18 18:22:19.735: W/dalvikvm(32229): Link of class 'Lcom/amvara/skatometer/ItemListActivity;' failed
07-18 18:22:19.745: D/AndroidRuntime(32229): Shutting down VM
07-18 18:22:19.745: W/dalvikvm(32229): threadid=1: thread exiting with uncaught exception (group=0x410d62a0)
07-18 18:22:19.780: E/AndroidRuntime(32229): FATAL EXCEPTION: main
07-18 18:22:19.780: E/AndroidRuntime(32229): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.amvara.skatometer/com.amvara.skatometer.ItemListActivity}: java.lang.ClassNotFoundException: com.amvara.skatometer.ItemListActivity
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.app.ActivityThread.access$600(ActivityThread.java:140)
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.os.Handler.dispatchMessage(Handler.java:99)
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.os.Looper.loop(Looper.java:137)
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.app.ActivityThread.main(ActivityThread.java:4898)
07-18 18:22:19.780: E/AndroidRuntime(32229): at java.lang.reflect.Method.invokeNative(Native Method)
07-18 18:22:19.780: E/AndroidRuntime(32229): at java.lang.reflect.Method.invoke(Method.java:511)
07-18 18:22:19.780: E/AndroidRuntime(32229): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
07-18 18:22:19.780: E/AndroidRuntime(32229): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
07-18 18:22:19.780: E/AndroidRuntime(32229): at dalvik.system.NativeStart.main(Native Method)
07-18 18:22:19.780: E/AndroidRuntime(32229): Caused by: java.lang.ClassNotFoundException: com.amvara.skatometer.ItemListActivity
07-18 18:22:19.780: E/AndroidRuntime(32229): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-18 18:22:19.780: E/AndroidRuntime(32229): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-18 18:22:19.780: E/AndroidRuntime(32229): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
07-18 18:22:19.780: E/AndroidRuntime(32229): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
07-18 18:22:19.780: E/AndroidRuntime(32229): ... 11 more
I can't figure out why this would happen because it isn't even hitting a breakpoint in my code. It must be a problem in the auto-generated Android code. Here's my AndroidManifest.xml, if you need it:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.amvara.skatometer"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.amvara.skatometer.ItemListActivity"
android:label="#string/app_name"
android:screenOrientation="sensorLandscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.amvara.skatometer.ItemDetailActivity"
android:label="#string/title_item_detail"
android:parentActivityName=".ItemListActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ItemListActivity" />
</activity>
<activity
android:name="com.amvara.skatometer.Bottom_panel"
android:label="#string/title_activity_bottom_panel" >
</activity>
<activity
android:name="com.amvara.skatometer.General"
android:label="#string/title_activity_general" >
</activity>
<activity
android:name="com.amvara.skatometer.SettingsActivity"
android:label="#string/title_activity_settings" >
</activity>
</application>
</manifest>
Thanks.
Try to clean your project, then you can also change :
<activity
android:name="com.amvara.skatometer.ItemListActivity"
android:label="#string/app_name"
android:screenOrientation="sensorLandscape" >
[...]
</activity>
By
<activity
android:name=".ItemListActivity"
android:label="#string/app_name"
android:screenOrientation="sensorLandscape" >
[...]
</activity>
It append to me one time but after all modification, doesn't work so I recreate the project from scratch and imported all my class, layout, etc. At the end, works as well.
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>
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
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.