Unfortunately app has stopped error eclipse? [closed] - android

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've created an application in eclipse and it was working fine and then suddenly it keeps giving me the error message 'unfortunately app has stopped' could anyone explain where my problem lies from my log cat report as i am new to this and dont really understand what the log cat means?
03-12 12:31:03.465: D/AndroidRuntime(4997): Shutting down VM
03-12 12:31:03.465: W/dalvikvm(4997): threadid=1: thread exiting with uncaught exception (group=0x416a8930)
03-12 12:31:03.465: E/AndroidRuntime(4997): FATAL EXCEPTION: main
03-12 12:31:03.465: E/AndroidRuntime(4997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.softwaresearchapp/com.example.softwaresearchapp.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.os.Handler.dispatchMessage(Handler.java:99)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.os.Looper.loop(Looper.java:137)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-12 12:31:03.465: E/AndroidRuntime(4997): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 12:31:03.465: E/AndroidRuntime(4997): at java.lang.reflect.Method.invoke(Method.java:511)
03-12 12:31:03.465: E/AndroidRuntime(4997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-12 12:31:03.465: E/AndroidRuntime(4997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-12 12:31:03.465: E/AndroidRuntime(4997): at dalvik.system.NativeStart.main(Native Method)
03-12 12:31:03.465: E/AndroidRuntime(4997): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.ActivityThread.resolveActivityInfo(ActivityThread.java:1993)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:285)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:749)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.widget.TabHost.setCurrentTab(TabHost.java:413)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.widget.TabHost.addTab(TabHost.java:240)
03-12 12:31:03.465: E/AndroidRuntime(4997): at com.example.softwaresearchapp.MainActivity.onCreate(MainActivity.java:27)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.Activity.performCreate(Activity.java:5104)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-12 12:31:03.465: E/AndroidRuntime(4997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-12 12:31:03.465: E/AndroidRuntime(4997): ... 11 more
03-12 12:31:22.666: I/Process(4997): Sending signal. PID: 4997 SIG: 9`

your logcat clearly said
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?
Add SoftwareSearchActivity into manifest.xml like
<activity
android:name="com.example.softwaresearchapp.SoftwareSearchActivity"
android:configChanges="keyboardHidden|orientation"
android:label="SoftwareSearch"
/>

Look at this line:
3-12 12:31:03.465: E/AndroidRuntime(4997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.softwaresearchapp/com.example.softwaresearchapp.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?
Specifically: Unable to find explicit activity class {com.example.softwaresearchapp/com.example.softwaresearchapp.SoftwareSearchActivity}; have you declared this activity in your AndroidManifest.xml?
Well, have you?
Each activity in your app must be declared in the manifest file. I imagine the minimum information you would want to provide would be the name and label e.g.
<activity
android:name=".SoftwareSearchActivity"
android:label="#string/title_activity_software_search"
/>

You are getting ActivityNotFoundException. Please check for Activity entry for com.example.softwaresearchapp.SoftwareSearchActivity in manifest file.

Related

ContentProvider classnotfound after using Proguard

I've got this provider defined in Manifest.
<provider
android:name="com.jon.aqclient.sync.StubProvider"
android:authorities="com.jon.aqclient.provider"
android:exported="false"
android:syncable="true" />
The app package is com.jon.aqclient, and the class is inside sync package, so the class is in com.jon.aqclient.sync.StubProvider. I had the application running perfectly, but after trying Proguard for the first time and mavenizing the project it crashes with a classnotfoundexception.
I've de-mavenized the project, I tried with -keep public class com.jon.aqclient.sync, and now commenting the Proguard line in the project.properties file as follows.
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
# proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
I've cleaned the project and nothing. And a strange thing is that if I change the provider definition in Manifest to StubProviderNew, without any other change, the error is the same, classnotfoundexception com.jon.aqclient.sync.StubProvider, and not StubProviderNew.
Where is the project reading that class name? How can I clear totally these?
Please help!
EDIT:
Stack trace:
03-12 15:04:56.259: E/AndroidRuntime(7506): FATAL EXCEPTION: main
03-12 15:04:56.259: E/AndroidRuntime(7506): java.lang.RuntimeException: Unable to get provider com.jon.aqclient.sync.StubProvider: java.lang.ClassNotFoundException: com.jon.aqclient.sync.StubProvider in loader dalvik.system.PathClassLoader[/system/framework/android.test.runner.jar:/data/app/com.jon.aqclient-2.apk]
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.app.ActivityThread.installProvider(ActivityThread.java:3709)
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.app.ActivityThread.installContentProviders(ActivityThread.java:3461)
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3417)
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:977)
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.os.Handler.dispatchMessage(Handler.java:99)
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.os.Looper.loop(Looper.java:130)
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.app.ActivityThread.main(ActivityThread.java:3835)
03-12 15:04:56.259: E/AndroidRuntime(7506): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 15:04:56.259: E/AndroidRuntime(7506): at java.lang.reflect.Method.invoke(Method.java:507)
03-12 15:04:56.259: E/AndroidRuntime(7506): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
03-12 15:04:56.259: E/AndroidRuntime(7506): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
03-12 15:04:56.259: E/AndroidRuntime(7506): at dalvik.system.NativeStart.main(Native Method)
03-12 15:04:56.259: E/AndroidRuntime(7506): Caused by: java.lang.ClassNotFoundException: com.jon.aqclient.sync.StubProvider in loader dalvik.system.PathClassLoader[/system/framework/android.test.runner.jar:/data/app/com.jon.aqclient-2.apk]
03-12 15:04:56.259: E/AndroidRuntime(7506): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-12 15:04:56.259: E/AndroidRuntime(7506): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-12 15:04:56.259: E/AndroidRuntime(7506): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-12 15:04:56.259: E/AndroidRuntime(7506): at android.app.ActivityThread.installProvider(ActivityThread.java:3694)
03-12 15:04:56.259: E/AndroidRuntime(7506): ... 12 more
Pff, I've solved it. It was a Maven thing. I didn't know if was Maven or Proguard, but it where the main changes I did before the error appeared.
Maven changed the default output folder to target/... and not bo bin/classes... so the device couldn't find the classes.
To solve it I had to go to Project->Properties->Source and at the bottom put as Default output folder {project}/bin/classes.

populate expandable listview from sqlite database

This is my first time here in this site. I already did searched the web on how to populate sqlite database into expandable listview but i failed.
I follow
these steps on how to create an expandable listview and modify some codes to make it dynamic.
Here is my modified code. This is only to set parent text on expandable listview:
public void setGroupParents() {
String selectQuery = "select * from " + DbHelper.TABLE_NAME + " ORDER BY "+DbHelperTablon.KEY_FNAME+" ASC ";
SQLiteDatabase db = mHelper.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
parentItems.add(cursor.getString(1));
} while (cursor.moveToNext());
}
cursor.close();
db.close();
return;
}
When i tried to run the emulator, the program crashed.
I am a newbie in android development and i need any help from you experts.. Thanks in advance.
Oh.. im sorry. This is the results of my LogCat... This is only the error portion..
03-12 07:25:10.059: ERROR/AndroidRuntime(367): FATAL EXCEPTION: main
03-12 07:25:10.059: ERROR/AndroidRuntime(367): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Sample/com.Sample.MainListview}: java.lang.NullPointerException
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.os.Handler.dispatchMessage(Handler.java:99)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.os.Looper.loop(Looper.java:123)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.app.ActivityThread.main(ActivityThread.java:3647)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at java.lang.reflect.Method.invoke(Method.java:507)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at dalvik.system.NativeStart.main(Native Method)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): Caused by: java.lang.NullPointerException
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at com.Sample.MainListview.setGroupParents(MainListview.java:56)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at com.Sample.MainListview.onCreate(MainListview.java:39)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
03-12 07:25:10.059: ERROR/AndroidRuntime(367): ... 11 more
03-12 07:25:12.428: ERROR/InputDispatcher(59): channel '40703be0 com.Sample/com.Sample.Drawer (server)' ~ Consumer closed input channel or an error occurred. events=0x8
03-12 07:25:12.428: ERROR/InputDispatcher(59): channel '40703be0 com.Sample/com.Sample.Drawer (server)' ~ Channel is unrecoverably broken and will be disposed!
well i guess if you initiate the database object outside your class your problem might be solved...

Spinner on an ActionBar issue on a Dialog Activity

Hi I have an activity that shows a dialog form an standard layout.
android:theme="#android:style/Theme.Holo.Light.Dialog"/>
I was trying to add a simple spinner to the actionbar but I am having issues and error in the line getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST).
When I change my theme to a common activity it works perfect.
This are the errors showed by the logcat:
3114-3114/org.PeteProto E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.PeteProto/org.PeteProto.Detail}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at org.PeteProto.Detail.onCreate(Detail.java:30)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
... 11 more

javacv for android

I'm trying to use OpenCV on android
I created my android project, added javacv.jar and iavacpp.jar to the build path, created the lib folder and copied the *.so files from javacv-arm.jar to libs/armeabi.
All jar & *.so files are version 2.4.2.
When I run the app, I created a test button. When it is clicked I'm calling this line:
IplImage image = cvLoadImage("file:///android_asset//"+"pic1.jpg");
and get the following crash
03-12 19:22:12.189: E/AndroidRuntime(4524): FATAL EXCEPTION: main
03-12 19:22:12.189: E/AndroidRuntime(4524): java.lang.ExceptionInInitializerError
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.myapp.MainActivity.runTest(MainActivity.java:260)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.myapp.MainActivity$3.onClick(MainActivity.java:174)
03-12 19:22:12.189: E/AndroidRuntime(4524): at android.view.View.performClick(View.java:4084)
03-12 19:22:12.189: E/AndroidRuntime(4524): at android.view.View$PerformClick.run(View.java:16966)
03-12 19:22:12.189: E/AndroidRuntime(4524): at android.os.Handler.handleCallback(Handler.java:615)
03-12 19:22:12.189: E/AndroidRuntime(4524): at android.os.Handler.dispatchMessage(Handler.java:92)
03-12 19:22:12.189: E/AndroidRuntime(4524): at android.os.Looper.loop(Looper.java:137)
03-12 19:22:12.189: E/AndroidRuntime(4524): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-12 19:22:12.189: E/AndroidRuntime(4524): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 19:22:12.189: E/AndroidRuntime(4524): at java.lang.reflect.Method.invoke(Method.java:511)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-12 19:22:12.189: E/AndroidRuntime(4524): at dalvik.system.NativeStart.main(Native Method)
03-12 19:22:12.189: E/AndroidRuntime(4524): Caused by: java.lang.ExceptionInInitializerError
03-12 19:22:12.189: E/AndroidRuntime(4524): at java.lang.Class.classForName(Native Method)
03-12 19:22:12.189: E/AndroidRuntime(4524): at java.lang.Class.forName(Class.java:217)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.googlecode.javacpp.Loader.load(Loader.java:334)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:85)
03-12 19:22:12.189: E/AndroidRuntime(4524): ... 13 more
03-12 19:22:12.189: E/AndroidRuntime(4524): Caused by: java.lang.ExceptionInInitializerError
03-12 19:22:12.189: E/AndroidRuntime(4524): at java.lang.Class.classForName(Native Method)
03-12 19:22:12.189: E/AndroidRuntime(4524): at java.lang.Class.forName(Class.java:217)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.googlecode.javacpp.Loader.load(Loader.java:334)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)
03-12 19:22:12.189: E/AndroidRuntime(4524): ... 17 more
03-12 19:22:12.189: E/AndroidRuntime(4524): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 124 could not load needed library 'libopencv_core.so' for 'libjniopencv_core.so' (load_library[1093]: Library 'libopencv_core.so' not found)
03-12 19:22:12.189: E/AndroidRuntime(4524): at java.lang.Runtime.loadLibrary(Runtime.java:370)
03-12 19:22:12.189: E/AndroidRuntime(4524): at java.lang.System.loadLibrary(System.java:535)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:444)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.googlecode.javacpp.Loader.load(Loader.java:368)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.googlecode.javacpp.Loader.load(Loader.java:315)
03-12 19:22:12.189: E/AndroidRuntime(4524): at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)
03-12 19:22:12.189: E/AndroidRuntime(4524): ... 21 more
03-12 19:22:12.243: D/dalvikvm(4524): GC_CONCURRENT freed 2368K, 16% free 16864K/20039K, paused 12ms+3ms, total 50ms
Am I missing libopencv_core.so? If so, where can I find it built for version 2.4.2?
Thanks!
I'm sure by now you've figured it out. download javacv-0.5-cppjars.zip, inside it extract the contents of opencv-2.4.5-android-arm.jar. you'll find libopencv_core.so in there and several other .so files

Android Maps V2 App Crashing

I have made an app that uses Google Android Maps API V2 and I have followed every step in the guide provided by Google but it doesn't work unfortunely and it crashes every time I try to start it up. So I'm wondering what is the problem?
MainActivity.java
package com.android.maptest;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
Maptest Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.maptest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />
<permission
android:name="com.android.maptest.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="com.android.maptest.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"
android:debuggable="true" >
<activity
android:name="com.android.maptest.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="api_key" />
</application>
</manifest>
Logcat
03-12 09:46:13.150: D/AndroidRuntime(1547): Shutting down VM
03-12 09:46:13.150: W/dalvikvm(1547): threadid=1: thread exiting with uncaught exception (group=0x410e22a0)
03-12 09:46:13.155: E/AndroidRuntime(1547): FATAL EXCEPTION: main
03-12 09:46:13.155: E/AndroidRuntime(1547): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.maptest/com.android.maptest.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
03-12 09:46:13.155: E/AndroidRuntime(1547): at
android.app.ActivityThread.access$600(ActivityThread.java:140)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.os.Handler.dispatchMessage(Handler.java:99)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.os.Looper.loop(Looper.java:137)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.ActivityThread.main(ActivityThread.java:4898)
03-12 09:46:13.155: E/AndroidRuntime(1547): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 09:46:13.155: E/AndroidRuntime(1547): at java.lang.reflect.Method.invoke(Method.java:511)
03-12 09:46:13.155: E/AndroidRuntime(1547): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
03-12 09:46:13.155: E/AndroidRuntime(1547): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
03-12 09:46:13.155: E/AndroidRuntime(1547): at dalvik.system.NativeStart.main(Native Method)
03-12 09:46:13.155: E/AndroidRuntime(1547): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-12 09:46:13.155: E/AndroidRuntime(1547): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:308)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.Activity.setContentView(Activity.java:1924)
03-12 09:46:13.155: E/AndroidRuntime(1547): at com.android.maptest.MainActivity.onCreate(MainActivity.java:11)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.Activity.performCreate(Activity.java:5206)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
03-12 09:46:13.155: E/AndroidRuntime(1547): ... 11 more
03-12 09:46:13.155: E/AndroidRuntime(1547): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.Fragment.instantiate(Fragment.java:584)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.Fragment.instantiate(Fragment.java:552)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.Activity.onCreateView(Activity.java:4849)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-12 09:46:13.155: E/AndroidRuntime(1547): ... 20 more
03-12 09:46:13.155: E/AndroidRuntime(1547): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
03-12 09:46:13.155: E/AndroidRuntime(1547): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-12 09:46:13.155: E/AndroidRuntime(1547): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-12 09:46:13.155: E/AndroidRuntime(1547): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-12 09:46:13.155: E/AndroidRuntime(1547): at android.app.Fragment.instantiate(Fragment.java:574)
03-12 09:46:13.155: E/AndroidRuntime(1547): ... 23 more
03-12 09:51:21.560: I/Process(1547): Sending signal. PID: 1547 SIG: 9
Here a blog post I wrote on how to integrate Google Maps into you application:
Creating Google Map Application
From your error it look like you did not perform correctly steps 2-3 of the blog guide,
for adding Google Play services library into your application.
If you follow carefully the steps written in the guide you will end up with the end result you can see at the end of the post.
I assumed that you have already get Google Maps Android API v2 key and have Google Play services. If you not have already installed it then please follow below steps to solve this problem_
Step 1. you can found it in Android SDK Manager under Extras tick check box of -Google Play services install it and after complete installation, restart your Eclipse.
Step 2. Add library named_ google-play-services_lib found under the extras folder of your Android SDK setup folder to your Android project_
Path of google service lib_
{Your_Android_SDK_direct}\extras\google\google_play_services\libproject\google-play-services_lib
Ex. Location of this lib on My system_
C:\Program Files\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib
I hope this will solve your ploblem.
For me adding:
import com.google.android.gms.maps.SupportMapFragment;
And changing the xml to
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/header" />
resolved the problem. I hope you resolve it too!
Looks like you didn't add the Google Play Services library to your project.
It's located at {Android SDK}\extras\google\google_play_services
Add it as Android Library Project to Eclipse and then add it to your project.

Categories

Resources