Ive been through alot of examples but still cant find a solution.
Im new to android development so im following basic tutorials online.
I followed a google map v2 android tutorial
mainActivity.java
package com.example.midlandtest;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
public class MainActivity extends Activity {
static final LatLng HAMBURG = new LatLng(53.558, 9.927);
static final LatLng KIEL = new LatLng(53.551, 9.993);
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
.title("Hamburg"));
Marker kiel = map.addMarker(new MarkerOptions()
.position(KIEL)
.title("kiel")
.snippet("Kiel is cool")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_launcher)));
// Move the camera instantly to hamburg with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
</RelativeLayout>
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.midlandtest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
<permission
android:name="midlandtest.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="midlandtest.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="midlandtest.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="removed my api key for privacy reasons" />
</application>
</manifest>
This is my logcat log.
Please Help.
02-27 20:11:26.448: D/AndroidRuntime(5858): Shutting down VM
02-27 20:11:26.458: W/dalvikvm(5858): threadid=1: thread exiting with uncaught exception (group=0x40a2a1f8)
02-27 20:11:26.458: E/AndroidRuntime(5858): FATAL EXCEPTION: main
02-27 20:11:26.458: E/AndroidRuntime(5858): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.midlandtest/midlandtest.MainActivity}: java.lang.ClassNotFoundException: midlandtest.MainActivity
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.app.ActivityThread.access$600(ActivityThread.java:123)
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.os.Looper.loop(Looper.java:137)
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.app.ActivityThread.main(ActivityThread.java:4424)
02-27 20:11:26.458: E/AndroidRuntime(5858): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 20:11:26.458: E/AndroidRuntime(5858): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 20:11:26.458: E/AndroidRuntime(5858): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-27 20:11:26.458: E/AndroidRuntime(5858): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-27 20:11:26.458: E/AndroidRuntime(5858): at dalvik.system.NativeStart.main(Native Method)
02-27 20:11:26.458: E/AndroidRuntime(5858): Caused by: java.lang.ClassNotFoundException: midlandtest.MainActivity
02-27 20:11:26.458: E/AndroidRuntime(5858): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
02-27 20:11:26.458: E/AndroidRuntime(5858): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-27 20:11:26.458: E/AndroidRuntime(5858): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
02-27 20:11:26.458: E/AndroidRuntime(5858): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
02-27 20:11:26.458: E/AndroidRuntime(5858): ... 11 more
02-27 20:11:26.778: I/dalvikvm(5858): threadid=3: reacting to signal 3
02-27 20:11:26.778: I/dalvikvm(5858): Wrote stack traces to '/data/anr/traces.txt'
02-27 20:11:26.998: I/dalvikvm(5858): threadid=3: reacting to signal 3
02-27 20:11:26.998: I/dalvikvm(5858): Wrote stack traces to '/data/anr/traces.txt'
Im using a an android tablet running 4.0.4 to test the app.
Ive set the app target to google api 4.0.3 as i was told to use that in a different tutorial.
Please help guys, this is driving me crazy
UPDATED LOGCAT LOG!!
02-27 20:44:28.847: W/dalvikvm(6614): VFY: unable to resolve static field 876 (MapAttrs) in Lcom/google/android/gms/R$styleable;
02-27 20:44:28.847: D/dalvikvm(6614): VFY: replacing opcode 0x62 at 0x000e
02-27 20:44:28.847: D/AndroidRuntime(6614): Shutting down VM
02-27 20:44:28.857: W/dalvikvm(6614): threadid=1: thread exiting with uncaught exception (group=0x40a2a1f8)
02-27 20:44:28.857: E/AndroidRuntime(6614): FATAL EXCEPTION: main
02-27 20:44:28.857: E/AndroidRuntime(6614): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
02-27 20:44:28.857: E/AndroidRuntime(6614): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
02-27 20:44:28.857: E/AndroidRuntime(6614): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.Activity.onCreateView(Activity.java:4269)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-27 20:44:28.857: E/AndroidRuntime(6614): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.Activity.setContentView(Activity.java:1862)
02-27 20:44:28.857: E/AndroidRuntime(6614): at com.example.midlandtest.MainActivity.onCreate(MainActivity.java:23)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.Activity.performCreate(Activity.java:4492)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.ActivityThread.access$600(ActivityThread.java:123)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.os.Looper.loop(Looper.java:137)
02-27 20:44:28.857: E/AndroidRuntime(6614): at android.app.ActivityThread.main(ActivityThread.java:4424)
02-27 20:44:28.857: E/AndroidRuntime(6614): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 20:44:28.857: E/AndroidRuntime(6614): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 20:44:28.857: E/AndroidRuntime(6614): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-27 20:44:28.857: E/AndroidRuntime(6614): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-27 20:44:28.857: E/AndroidRuntime(6614): at dalvik.system.NativeStart.main(Native Method)
02-27 20:44:29.177: I/dalvikvm(6614): threadid=3: reacting to signal 3
02-27 20:44:29.177: I/dalvikvm(6614): Wrote stack traces to '/data/anr/traces.txt'
02-27 20:44:30.477: I/dalvikvm(6614): threadid=3: reacting to signal 3
02-27 20:44:30.487: I/dalvikvm(6614): Wrote stack traces to '/data/anr/traces.txt'
02-27 20:44:30.507: I/Process(6614): Sending signal. PID: 6614 SIG: 9
02-27 20:46:09.467: W/dalvikvm(6657): VFY: unable to resolve static field 876 (MapAttrs) in Lcom/google/android/gms/R$styleable;
02-27 20:46:09.467: D/dalvikvm(6657): VFY: replacing opcode 0x62 at 0x000e
02-27 20:46:09.477: D/AndroidRuntime(6657): Shutting down VM
02-27 20:46:09.477: W/dalvikvm(6657): threadid=1: thread exiting with uncaught exception (group=0x40a2a1f8)
02-27 20:46:09.487: E/AndroidRuntime(6657): FATAL EXCEPTION: main
02-27 20:46:09.487: E/AndroidRuntime(6657): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
02-27 20:46:09.487: E/AndroidRuntime(6657): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
02-27 20:46:09.487: E/AndroidRuntime(6657): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.Activity.onCreateView(Activity.java:4269)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-27 20:46:09.487: E/AndroidRuntime(6657): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.Activity.setContentView(Activity.java:1862)
02-27 20:46:09.487: E/AndroidRuntime(6657): at com.example.midlandtest.MainActivity.onCreate(MainActivity.java:23)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.Activity.performCreate(Activity.java:4492)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.ActivityThread.access$600(ActivityThread.java:123)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.os.Looper.loop(Looper.java:137)
02-27 20:46:09.487: E/AndroidRuntime(6657): at android.app.ActivityThread.main(ActivityThread.java:4424)
02-27 20:46:09.487: E/AndroidRuntime(6657): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 20:46:09.487: E/AndroidRuntime(6657): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 20:46:09.487: E/AndroidRuntime(6657): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-27 20:46:09.487: E/AndroidRuntime(6657): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-27 20:46:09.487: E/AndroidRuntime(6657): at dalvik.system.NativeStart.main(Native Method)
02-27 20:46:09.787: I/dalvikvm(6657): threadid=3: reacting to signal 3
02-27 20:46:09.807: I/dalvikvm(6657): Wrote stack traces to '/data/anr/traces.txt'
02-27 20:46:10.107: I/dalvikvm(6657): threadid=3: reacting to signal 3
02-27 20:46:10.107: I/dalvikvm(6657): Wrote stack traces to '/data/anr/traces.txt'
Change:
<activity
android:name="midlandtest.MainActivity"
android:label="#string/app_name" >
To
<activity
android:name="com.example.midlandtest.MainActivity"
android:label="#string/app_name" >
Your current code tells Android to look for MainActivity in a package called midlandtest. However, your package is called com.example.midlandtest. This results in the ClassNotFoundException exception you're getting.
Related
I want to set the blink animation, in the compound drawable(left) of textview.
i followed the link:
http://chiuki.github.io/advanced-android-textview/#/4
its helped me and also working like a charm.
but, i failed to achieve blink animation, please guide me for the correct approach.
the xml file i used for blink animation is as follows:
blink_anim.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="#android:anim/accelerate_interpolator"
android:duration="600"
android:repeatMode="reverse"
android:repeatCount="infinite"/>
and pointed this xml in textview, like this:
android:drawableLeft="#drawable/blink_anim"
but it throws exception, the logcat view:
02-27 07:24:34.533: E/AndroidRuntime(1128): FATAL EXCEPTION: main
02-27 07:24:34.533: E/AndroidRuntime(1128): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.animation.app/com.animation.app.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.os.Looper.loop(Looper.java:137)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.ActivityThread.main(ActivityThread.java:5103)
02-27 07:24:34.533: E/AndroidRuntime(1128): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 07:24:34.533: E/AndroidRuntime(1128): at java.lang.reflect.Method.invoke(Method.java:525)
02-27 07:24:34.533: E/AndroidRuntime(1128): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
02-27 07:24:34.533: E/AndroidRuntime(1128): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-27 07:24:34.533: E/AndroidRuntime(1128): at dalvik.system.NativeStart.main(Native Method)
02-27 07:24:34.533: E/AndroidRuntime(1128): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
02-27 07:24:34.533: E/AndroidRuntime(1128): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
02-27 07:24:34.533: E/AndroidRuntime(1128): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.Activity.setContentView(Activity.java:1895)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
02-27 07:24:34.533: E/AndroidRuntime(1128): at com.animation.app.MainActivity.onCreate(MainActivity.java:18)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.Activity.performCreate(Activity.java:5133)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
02-27 07:24:34.533: E/AndroidRuntime(1128): ... 11 more
02-27 07:24:34.533: E/AndroidRuntime(1128): Caused by: java.lang.reflect.InvocationTargetException
02-27 07:24:34.533: E/AndroidRuntime(1128): at java.lang.reflect.Constructor.constructNative(Native Method)
02-27 07:24:34.533: E/AndroidRuntime(1128): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
02-27 07:24:34.533: E/AndroidRuntime(1128): ... 27 more
02-27 07:24:34.533: E/AndroidRuntime(1128): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/blink_animation.xml from drawable resource ID #0x7f020059
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.content.res.Resources.loadDrawable(Resources.java:2091)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.widget.TextView.<init>(TextView.java:802)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.widget.TextView.<init>(TextView.java:614)
02-27 07:24:34.533: E/AndroidRuntime(1128): ... 30 more
02-27 07:24:34.533: E/AndroidRuntime(1128): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: invalid drawable tag set
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:897)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:837)
02-27 07:24:34.533: E/AndroidRuntime(1128): at android.content.res.Resources.loadDrawable(Resources.java:2087)
02-27 07:24:34.533: E/AndroidRuntime(1128): ... 33 more
Binary XML file line #2: invalid drawable tag set
Tells you that you can't have <alpha tag in drawable.
The link that you referenced to, have
<animation-list>
<item android:drawable="#drawable/ic_wifi_0"
android:duration="250" />
<item android:drawable="#drawable/ic_wifi_1"
android:duration="250" />
<item android:drawable="#drawable/ic_wifi_2"
android:duration="250" />
<item android:drawable="#drawable/ic_wifi_3"
android:duration="250" />
</animation-list>
Which is different kind of animation, so you need to created those drawables by yourself and list them in animation-list
i have problem. when run and i debug program i have
[2014-11-14 03:57:23 - Traffic] Android Launch!
[2014-11-14 03:57:23 - Traffic] adb is running normally.
[2014-11-14 03:57:23 - Traffic] Performing com.fuad.traffic.MainActivity activity launch
[2014-11-14 03:57:26 - Traffic] Uploading Traffic.apk onto device 'YT910DUTNU'
[2014-11-14 03:57:26 - Traffic] Installing Traffic.apk...
[2014-11-14 03:57:33 - Traffic] Success!
[2014-11-14 03:57:33 - appcompat_v7] Could not find appcompat_v7.apk!
[2014-11-14 03:57:33 - Traffic] Starting activity com.fuad.traffic.MainActivity on device YT910DUTNU
that is my problem, and when i running in phone this i have problem again like this my problem
11-14 19:10:02.090: W/dalvikvm(28725): Unable to resolve superclass of Lcom/fuad/traffic/MainActivity; (83)
11-14 19:10:02.090: W/dalvikvm(28725): Link of class 'Lcom/fuad/traffic/MainActivity;' failed
11-14 19:10:02.090: W/dalvikvm(28725): threadid=1: thread exiting with uncaught exception (group=0x40b019f0)
11-14 19:10:02.100: E/AndroidRuntime(28725): FATAL EXCEPTION: main
11-14 19:10:02.100: E/AndroidRuntime(28725): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.fuad.traffic/com.fuad.traffic.MainActivity}: java.lang.ClassNotFoundException: com.fuad.traffic.MainActivity
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.os.Looper.loop(Looper.java:137)
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.app.ActivityThread.main(ActivityThread.java:4424)
11-14 19:10:02.100: E/AndroidRuntime(28725): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 19:10:02.100: E/AndroidRuntime(28725): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 19:10:02.100: E/AndroidRuntime(28725): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
11-14 19:10:02.100: E/AndroidRuntime(28725): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
11-14 19:10:02.100: E/AndroidRuntime(28725): at dalvik.system.NativeStart.main(Native Method)
11-14 19:10:02.100: E/AndroidRuntime(28725): Caused by: java.lang.ClassNotFoundException: com.fuad.traffic.MainActivity
11-14 19:10:02.100: E/AndroidRuntime(28725): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
11-14 19:10:02.100: E/AndroidRuntime(28725): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
11-14 19:10:02.100: E/AndroidRuntime(28725): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
11-14 19:10:02.100: E/AndroidRuntime(28725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
11-14 19:10:02.100: E/AndroidRuntime(28725): ... 11 more
thanx for master in stackoverflow.com :D
after importing appcompat_v7 check its properties android section and be sure that Is Library is checked! and then add appcompat_v7 project to your project in your project > properties > android and then clean and rebuild your project!
Try:
Right Click on Package Explorer
Import
Android > Existing Android Code into Workspace > Next
Browse > ~/sdk/extras/android/support/v7/appcompat
Select the package. Checkbox "Copy projects into workspace" > Finish
Right Click in YOUR PROJECT > Properties > Android
In the section of Library > Add > appcompat > OK
Finally go to Project (in the menu of eclipse) > Clean ..
Tell us if you tried something and what happened
for #mohammad, i have found the problem, in properties>java build path>project, the problem is there are have folder appcompat. and it's must delete. and when i delete it it's work. but the next problem when i run the program is like this
'11-14 19:24:44.379: W/dalvikvm(29518): VFY: unable to resolve virtual method 292: Landroid/app/Notification$Builder;.setPriority (I)Landroid/app/Notification$Builder;
11-14 19:24:44.379: W/dalvikvm(29518): threadid=1: thread exiting with uncaught exception (group=0x40b019f0)
11-14 19:24:44.389: E/AndroidRuntime(29518): FATAL EXCEPTION: main
11-14 19:24:44.389: E/AndroidRuntime(29518): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fuad.traffic/com.fuad.traffic.MainActivity}: android.view.InflateException: Binary XML file line #15: Error inflating class fragment
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.os.Looper.loop(Looper.java:137)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.ActivityThread.main(ActivityThread.java:4424)
11-14 19:24:44.389: E/AndroidRuntime(29518): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 19:24:44.389: E/AndroidRuntime(29518): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
11-14 19:24:44.389: E/AndroidRuntime(29518): at dalvik.system.NativeStart.main(Native Method)
11-14 19:24:44.389: E/AndroidRuntime(29518): Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class fragment
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:268)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.Activity.setContentView(Activity.java:1837)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.fuad.traffic.MainActivity.onCreate(MainActivity.java:15)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.Activity.performCreate(Activity.java:4470)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-14 19:24:44.389: E/AndroidRuntime(29518): ... 11 more
11-14 19:24:44.389: E/AndroidRuntime(29518): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 6111000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.common.GooglePlayServicesUtil.E(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.maps.internal.u.S(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.maps.internal.u.R(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.maps.SupportMapFragment$b.my(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2158)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:297)
11-14 19:24:44.389: E/AndroidRuntime(29518): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
11-14 19:24:44.389: E/AndroidRuntime(29518): ... 21 more
'
I am trying to login using the phone_no and password but its giving NullPointerException when I'm using this :
Cursor cursor=db.query("CitizenDetails", null, "phone=?", new String[]{phone}, null, null, null);
Where is it going wrong? My head is paining trying to figure this out for hours thanks.
Logcat :
02-27 12:10:58.783: E/AndroidRuntime(6586): FATAL EXCEPTION: main
02-27 12:10:58.783: E/AndroidRuntime(6586): java.lang.NullPointerException
02-27 12:10:58.783: E/AndroidRuntime(6586): at com.example.customdialogregistration.DatabaseHelper.getSinlgeEntry(DatabaseHelper.java:200)
02-27 12:10:58.783: E/AndroidRuntime(6586): at com.example.customdialogregistration.MainActivity$1$1.onClick(MainActivity.java:75)
02-27 12:10:58.783: E/AndroidRuntime(6586): at android.view.View.performClick(View.java:4204)
02-27 12:10:58.783: E/AndroidRuntime(6586): at android.view.View$PerformClick.run(View.java:17355)
02-27 12:10:58.783: E/AndroidRuntime(6586): at android.os.Handler.handleCallback(Handler.java:725)
02-27 12:10:58.783: E/AndroidRuntime(6586): at android.os.Handler.dispatchMessage(Handler.java:92)
02-27 12:10:58.783: E/AndroidRuntime(6586): at android.os.Looper.loop(Looper.java:137)
02-27 12:10:58.783: E/AndroidRuntime(6586): at android.app.ActivityThread.main(ActivityThread.java:5041)
02-27 12:10:58.783: E/AndroidRuntime(6586): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 12:10:58.783: E/AndroidRuntime(6586): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 12:10:58.783: E/AndroidRuntime(6586): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-27 12:10:58.783: E/AndroidRuntime(6586): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-27 12:10:58.783: E/AndroidRuntime(6586): at dalvik.system.NativeStart.main(Native Method)
Have you initialize this line before
SQLiteDatabase db = this.getWritableDatabase();
That row can NPE only if db is null.
This is an Android Development related question.
I make use of the ADT and Eclipse Indigo in a Windows 7 64bits
First we have the xml layout file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
</EditText>
</LinearLayout>
Second, we have the class that makes a reference to the xml file right above
package com.example.test_table;
import android.os.Bundle;
import android.app.Activity;
public class Home extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
}
}
In third place, we got the declaration in the manifest of the class Home
<activity
android:name="com.example.test_table.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>
And then, when I try to run, Eclipse returns a nullpointerexception.
But when I remove the EditText from the xml layout file, the application works.
This problem suddenly appeared in my computer and I'm trying to do something about it.
LogCat:
02-27 22:42:39.051: E/AndroidRuntime(12164): FATAL EXCEPTION: main
02-27 22:42:39.051: E/AndroidRuntime(12164): java.lang.RuntimeException: Unable to start activity ComponentInfo {com.example.test_table/com.example.test_table.Home}: java.lang.NullPointerException
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.ActivityThread.access$600(ActivityThread.java:128)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.os.Looper.loop(Looper.java:137)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.ActivityThread.main(ActivityThread.java:4514)
02-27 22:42:39.051: E/AndroidRuntime(12164): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 22:42:39.051: E/AndroidRuntime(12164): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 22:42:39.051: E/AndroidRuntime(12164): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
02-27 22:42:39.051: E/AndroidRuntime(12164): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
02-27 22:42:39.051: E/AndroidRuntime(12164): at dalvik.system.NativeStart.main(Native Method)
02-27 22:42:39.051: E/AndroidRuntime(12164): Caused by: java.lang.NullPointerException
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.sec.clipboard.ClipboardExManager.updateData(ClipboardExManager.java:241)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.widget.EditText.onFocusChanged(EditText.java:134)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.View.handleFocusGainInternal(View.java:3727)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.View.requestFocus(View.java:5420)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.View.requestFocus(View.java:5370)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.View.requestFocus(View.java:5348)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.LayoutInflater.parseRequestFocus(LayoutInflater.java:753)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-27 22:42:39.051: E/AndroidRuntime(12164): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:273)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.Activity.setContentView(Activity.java:1835)
02-27 22:42:39.051: E/AndroidRuntime(12164): at com.example.test_table.Home.onCreate(Home.java:11)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.Activity.performCreate(Activity.java:4465)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
02-27 22:42:39.051: E/AndroidRuntime(12164): ... 11 more
So, I'd like to know what causes the ADT to stop recognizing an Edittext?
What is strange to me is this log:
02-27 22:42:39.051: E/AndroidRuntime(12164): at android.sec.clipboard.ClipboardExManager.updateData(ClipboardExManager.java:241)
Putting that into a Google search seems to pull results about a bug in Samsung devices and the soft keyboard. I am assuming that is what you are using because it does not look like any non-Samsung results are appearing. I would look into this bug, and possibly try to disable the keyboard from appearing when the application is first launched. This may stop it from crashing in onCreate() until you actually focus the EditText by clicking it. Putting Something like this in onCreate() can help you out with that:
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Like I said in my comment, your code is correct. Try testing it on the emulator or another Android device. I will try to help you further if anything else comes up.
Here are some of the links I skimmed through:
https://code.google.com/p/android/issues/detail?id=35358
http://forum.xda-developers.com/showthread.php?t=1655619
https://code.google.com/p/android/issues/detail?id=36322
try using edit text in your java file and refer it
EditText edt = (EditText) findViewById(path);
Here is my code to display the google map in my android emulator using google AVD....
How to fix this problem?anybody can know this?
Map.java:
public class MapsActivity extends MapActivity
{
private MapView mapView;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapView);
mapView.setBuiltInZoomControls(true);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
Xml File:
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0l4sCTTyRmXTNo7k8DREHvEaLar2UmHGwnhZVHQ"
>
</com.google.android.maps.MapView>
Manifost File:
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-library android:name="com.google.android.maps" />
Output:
In my emulator map activity has stopped unexpexctly..
i got the runtime exception
01-04 10:36:24.540: D/dalvikvm(641): Not late-enabling CheckJNI (already on)
01-04 10:36:25.290: W/dalvikvm(641): Unable to resolve superclass of Lcom/example/MapsActivity; (10)
01-04 10:36:25.290: W/dalvikvm(641): Link of class 'Lcom/example/MapsActivity;' failed
01-04 10:36:25.290: D/AndroidRuntime(641): Shutting down VM
01-04 10:36:25.290: W/dalvikvm(641): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
01-04 10:36:25.430: E/AndroidRuntime(641): FATAL EXCEPTION: main
01-04 10:36:25.430: E/AndroidRuntime(641): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.example.MapsActivity}: java.lang.ClassNotFoundException: com.example.MapsActivity
01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-04 10:36:25.430: E/AndroidRuntime(641): at android.os.Handler.dispatchMessage(Handler.java:99)
01-04 10:36:25.430: E/AndroidRuntime(641): at android.os.Looper.loop(Looper.java:137)
01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-04 10:36:25.430: E/AndroidRuntime(641): at java.lang.reflect.Method.invokeNative(Native Method)
01-04 10:36:25.430: E/AndroidRuntime(641): at java.lang.reflect.Method.invoke(Method.java:511)
01-04 10:36:25.430: E/AndroidRuntime(641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-04 10:36:25.430: E/AndroidRuntime(641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-04 10:36:25.430: E/AndroidRuntime(641): at dalvik.system.NativeStart.main(Native Method)
01-04 10:36:25.430: E/AndroidRuntime(641): Caused by: java.lang.ClassNotFoundException: com.example.MapsActivity
01-04 10:36:25.430: E/AndroidRuntime(641): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-04 10:36:25.430: E/AndroidRuntime(641): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-04 10:36:25.430: E/AndroidRuntime(641): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
01-04 10:36:25.430: E/AndroidRuntime(641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
01-04 10:36:25.430: E/AndroidRuntime(641): ... 11 more
01-04 10:36:31.140: W/dalvikvm(679): Unable to resolve superclass of Lcom/example/MapsActivity; (10)
01-04 10:36:31.160: W/dalvikvm(679): Link of class 'Lcom/example/MapsActivity;' failed
01-04 10:36:31.160: D/AndroidRuntime(679): Shutting down VM
01-04 10:36:31.180: W/dalvikvm(679): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
01-04 10:36:31.240: E/AndroidRuntime(679): FATAL EXCEPTION: main
01-04 10:36:31.240: E/AndroidRuntime(679): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.example.MapsActivity}: java.lang.ClassNotFoundException: com.example.MapsActivity
01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-04 10:36:31.240: E/AndroidRuntime(679): at android.os.Handler.dispatchMessage(Handler.java:99)
01-04 10:36:31.240: E/AndroidRuntime(679): at android.os.Looper.loop(Looper.java:137)
01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-04 10:36:31.240: E/AndroidRuntime(679): at java.lang.reflect.Method.invokeNative(Native Method)
01-04 10:36:31.240: E/AndroidRuntime(679): at java.lang.reflect.Method.invoke(Method.java:511)
01-04 10:36:31.240: E/AndroidRuntime(679): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-04 10:36:31.240: E/AndroidRuntime(679): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-04 10:36:31.240: E/AndroidRuntime(679): at dalvik.system.NativeStart.main(Native Method)
01-04 10:36:31.240: E/AndroidRuntime(679): Caused by: java.lang.ClassNotFoundException: com.example.MapsActivity
01-04 10:36:31.240: E/AndroidRuntime(679): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-04 10:36:31.240: E/AndroidRuntime(679): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-04 10:36:31.240: E/AndroidRuntime(679): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
01-04 10:36:31.240: E/AndroidRuntime(679): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
01-04 10:36:31.240: E/AndroidRuntime(679): ... 11 more
01-04 10:37:23.619: W/dalvikvm(720): Unable to resolve superclass of Lcom/example/MapsActivity; (10)
01-04 10:37:23.659: W/dalvikvm(720): Link of class 'Lcom/example/MapsActivity;' failed
01-04 10:37:23.659: D/AndroidRuntime(720): Shutting down VM
01-04 10:37:23.669: W/dalvikvm(720): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
01-04 10:37:23.699: E/AndroidRuntime(720): FATAL EXCEPTION: main
01-04 10:37:23.699: E/AndroidRuntime(720): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.example.MapsActivity}: java.lang.ClassNotFoundException: com.example.MapsActivity
01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-04 10:37:23.699: E/AndroidRuntime(720): at android.os.Handler.dispatchMessage(Handler.java:99)
01-04 10:37:23.699: E/AndroidRuntime(720): at android.os.Looper.loop(Looper.java:137)
01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-04 10:37:23.699: E/AndroidRuntime(720): at java.lang.reflect.Method.invokeNative(Native Method)
01-04 10:37:23.699: E/AndroidRuntime(720): at java.lang.reflect.Method.invoke(Method.java:511)
01-04 10:37:23.699: E/AndroidRuntime(720): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-04 10:37:23.699: E/AndroidRuntime(720): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-04 10:37:23.699: E/AndroidRuntime(720): at dalvik.system.NativeStart.main(Native Method)
01-04 10:37:23.699: E/AndroidRuntime(720): Caused by: java.lang.ClassNotFoundException: com.example.MapsActivity
01-04 10:37:23.699: E/AndroidRuntime(720): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-04 10:37:23.699: E/AndroidRuntime(720): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-04 10:37:23.699: E/AndroidRuntime(720): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
01-04 10:37:23.699: E/AndroidRuntime(720): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
01-04 10:37:23.699: E/AndroidRuntime(720): ... 11 more
Output screen:
google map view screen shot
I think problem with your API key only. Any how check the link below you will get an idea.
Displaying Google maps in Android Emulator
I found one thing in your manifest, you written
<uses-library android:name="com.google.android.maps" />
after </application> i think it may wrong
In manifest file write as below and try once
<application
<uses-library android:name="com.google.android.maps" />
New Answer
Please check this link, it may help you.
Enable internet for Android Emulator
Your mentioned code is right But i have two doubt is that
1. Google MAP API
Ans .To get Google MAP API Here
2. Check Emulator's Internet.
Ans . Open CMD
D:\SOFTWARE\Android-SDK\android-sdk-2.2>emulator -avd avdname -dns-server 8.8.8.8
add google maps library in your manifest and it should work
Move :
<uses-library android:name="com.google.android.maps" />
within the application tag. You have written outside the application tag in manifest file.
For your second problem:
I am sure you have copied the map key from some where else. This is causing only blank screen on emulator. Try to generate your own Map Key following:
http://code.google.com/android/add-ons/google-apis/mapkey.html
the error class not found exception is when actitvity is not declared in manifest
if you have declared it and then also error comes please please check you may have
included a jar file twice in your project