I am new to Android technology, and I am creating a practice app. I have created a mail sending class that is used in two Activities. In one Activity it is working fine, but in the other it is not working -- there is an error in the logcat and I am unable to find what is causing it. Here is the error log:
03-19 12:11:23.773: E/WindowManager(891): Activity com.example.mytest.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40d0de70 V.E..... R.....ID 0,0-97,92} that was originally added here
03-19 12:11:23.773: E/WindowManager(891): android.view.WindowLeaked: Activity com.example.mytest.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40d0de70 V.E..... R.....ID 0,0-97,92} that was originally added here
03-19 12:11:23.773: E/WindowManager(891): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
03-19 12:11:23.773: E/WindowManager(891): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
03-19 12:11:23.773: E/WindowManager(891): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
03-19 12:11:23.773: E/WindowManager(891): at android.app.Dialog.show(Dialog.java:281)
03-19 12:11:23.773: E/WindowManager(891): at com.example.mytest.MainActivity$CountDownTask.onPreExecute(MainActivity.java:289)
03-19 12:11:23.773: E/WindowManager(891): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
03-19 12:11:23.773: E/WindowManager(891): at android.os.AsyncTask.execute(AsyncTask.java:534)
03-19 12:11:23.773: E/WindowManager(891): at com.example.mytest.MainActivity.CallLogsBackup(MainActivity.java:91)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invoke(Method.java:511)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View$1.onClick(View.java:3592)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View.performClick(View.java:4202)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View$PerformClick.run(View.java:17340)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Handler.handleCallback(Handler.java:725)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Handler.dispatchMessage(Handler.java:92)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Looper.loop(Looper.java:137)
03-19 12:11:23.773: E/WindowManager(891): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invoke(Method.java:511)
03-19 12:11:23.773: E/WindowManager(891): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-19 12:11:23.773: E/WindowManager(891): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-19 12:11:23.773: E/WindowManager(891): at dalvik.system.NativeStart.main(Native Method)
Related
10-21 13:54:55.337: E/WindowManager(5921): Activity org.acra.CrashReportDialog has leaked window
com.android.internal.policy.impl.PhoneWindow$DecorView{42467520 V.E..... R.....I. 0,0-0,0} that was originally added here
10-21 13:54:55.337:
E/WindowManager(5921): android.view.WindowLeaked: Activity org.acra.CrashReportDialog has leaked window
com.android.internal.policy.impl.PhoneWindow$DecorView{42467520 V.E..... R.....I. 0,0-0,0} that was originally added here
10-21 13:54:55.337:
E/WindowManager(5921): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
10-21 13:54:55.337: E/WindowManager(5921): at
android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
10-21 13:54:55.337: E/WindowManager(5921): at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.Dialog.show(Dialog.java:281)
10-21 13:54:55.337: E/WindowManager(5921): at
org.acra.CrashReportDialog.onCreate(CrashReportDialog.java:76)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.Activity.performCreate(Activity.java:5104)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
10-21 13:54:55.337: E/WindowManager(5921): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
10-21 13:54:55.337: E/WindowManager(5921): at
android.os.Handler.dispatchMessage(Handler.java:99)
10-21 13:54:55.337: E/WindowManager(5921): at android.os.Looper.loop(Looper.java:137) 10-21
13:54:55.337: E/WindowManager(5921): at android.app.ActivityThread.main(ActivityThread.java:5041)
10-21 13:54:55.337: E/WindowManager(5921):
at java.lang.reflect.Method.invokeNative(Native Method)
10-21 13:54:55.337: E/WindowManager(5921): at
java.lang.reflect.Method.invoke(Method.java:511)
10-21 13:54:55.337: E/WindowManager(5921): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-21 13:54:55.337: E/WindowManager(5921): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-21 13:54:55.337: E/WindowManager(5921): at
dalvik.system.NativeStart.main(Native Method)
Use below in the initialization of dialog -
Dialog mDialog= new Dialog(YourActivityName.this);
You're leaking your Window. This happens when your Activity creates the Dialog and you try recreating the Dialog instead of re-using your old dialog/dismiss that previous dialog.
i have this problem:
when i try start my emulator in eclipse i wait 15 minutes and it is not started.
I try reinstall eclipse but emulator still dont working.
03-19 15:26:38.960: E/Installer(438): connection failed
03-19 15:26:39.530: E/System(438): ******************************************
03-19 15:26:39.530: E/System(438): ************ Failure starting bootstrap service
03-19 15:26:39.530: E/System(438): java.lang.NullPointerException
03-19 15:26:39.530: E/System(438): at com.android.server.firewall.IntentFirewall.readRulesDir(IntentFirewall.java:271)
03-19 15:26:39.530: E/System(438): at com.android.server.firewall.IntentFirewall.<init>(IntentFirewall.java:114)
03-19 15:26:39.530: E/System(438): at com.android.server.am.ActivityManagerService.main(ActivityManagerService.java:1804)
03-19 15:26:39.530: E/System(438): at com.android.server.ServerThread.initAndLoop(SystemServer.java:196)
03-19 15:26:39.530: E/System(438): at com.android.server.SystemServer.main(SystemServer.java:1179)
03-19 15:26:39.530: E/System(438): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 15:26:39.530: E/System(438): at java.lang.reflect.Method.invoke(Method.java:515)
03-19 15:26:39.530: E/System(438): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-19 15:26:39.530: E/System(438): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-19 15:26:39.530: E/System(438): at dalvik.system.NativeStart.main(Native Method)
03-19 15:26:39.630: E/AndroidRuntime(438): *** FATAL EXCEPTION IN SYSTEM PROCESS: WindowManager
03-19 15:26:39.630: E/AndroidRuntime(438): java.lang.NullPointerException
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.LocalDisplayAdapter$LocalDisplayDevice.getDisplayDeviceInfoLocked(LocalDisplayAdapter.java:147)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayManagerService.handleDisplayDeviceAddedLocked(DisplayManagerService.java:852)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayManagerService.handleDisplayDeviceAdded(DisplayManagerService.java:841)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayManagerService.access$1100(DisplayManagerService.java:96)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayManagerService$DisplayAdapterListener.onDisplayDeviceEvent(DisplayManagerService.java:1281)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayAdapter$1.run(DisplayAdapter.java:108)
03-19 15:26:39.630: E/AndroidRuntime(438): at android.os.Handler.handleCallback(Handler.java:733)
03-19 15:26:39.630: E/AndroidRuntime(438): at android.os.Handler.dispatchMessage(Handler.java:95)
03-19 15:26:39.630: E/AndroidRuntime(438): at android.os.Looper.loop(Looper.java:136)
03-19 15:26:39.630: E/AndroidRuntime(438): at android.os.HandlerThread.run(HandlerThread.java:61)
03-19 15:26:39.640: E/AndroidRuntime(438): Error reporting crash
03-19 15:26:39.640: E/AndroidRuntime(438): java.lang.NullPointerException
03-19 15:26:39.640: E/AndroidRuntime(438): at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:84)
03-19 15:26:39.640: E/AndroidRuntime(438): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
03-19 15:26:39.640: E/AndroidRuntime(438): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
03-19 15:27:46.600: E/Installer(796): connection failed
03-19 15:27:47.120: E/System(796): ******************************************
03-19 15:27:47.120: E/System(796): ************ Failure starting bootstrap service
03-19 15:27:47.120: E/System(796): java.lang.NullPointerException
03-19 15:27:47.120: E/System(796): at com.android.server.firewall.IntentFirewall.readRulesDir(IntentFirewall.java:271)
03-19 15:27:47.120: E/System(796): at com.android.server.firewall.IntentFirewall.<init>(IntentFirewall.java:114)
03-19 15:27:47.120: E/System(796): at com.android.server.am.ActivityManagerService.main(ActivityManagerService.java:1804)
03-19 15:27:47.120: E/System(796): at com.android.server.ServerThread.initAndLoop(SystemServer.java:196)
03-19 15:27:47.120: E/System(796): at com.android.server.SystemServer.main(SystemServer.java:1179)
03-19 15:27:47.120: E/System(796): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 15:27:47.120: E/System(796): at java.lang.reflect.Method.invoke(Method.java:515)
03-19 15:27:47.120: E/System(796): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-19 15:27:47.120: E/System(796): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-19 15:27:47.120: E/System(796): at dalvik.system.NativeStart.main(Native Method)
I install eclipse with adt with sdk for android and i can not start emulator.
Thank you for help.
Try opening emulator with less device screen size like 3.2'and wait for emulator to launch,on first occasion it might take some time.
Emulator with high config and screen size takes ages to open and sometimes does not even launch no matter what.
I had the same problem and i opened emulator using small screen resolution and boom it worked. :) Try it.
Hello i will be needing help with my Android app to insert google maps into the app, but every time i do that the app chrashes, and i'm going to insert my code below if there is somebody that can help my to find the problem with the code.
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maret.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
<permission
android:name="com.maret.toilet.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="com.maret.toilet.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.maret.toilet.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="***MY_API_KEY****"/>
</application>
</manifest>
Here is my activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="My Location"
android:onClick="getLocation"
android:layout_weight="0"
/>
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>
Here is my MainActivity.java
package com.maret.maps;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
MY ERROR LOG
03-19 08:41:45.552: E/Trace(641): error opening trace file:
No such file or directory (2)
03-19 08:41:45.861: D/AndroidRuntime(641):
Shutting down VM
03-19 08:41:45.872: W/dalvikvm(641):
threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-19 08:41:45.891: E/AndroidRuntime(641): FATAL EXCEPTION: main
03-19 08:41:45.891: E/AndroidRuntime(641):
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.toilet/com.maret.toilet.MainActivity}: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.os.Handler.dispatchMessage(Handler.java:99)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.os.Looper.loop(Looper.java:137)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.main(ActivityThread.java:4745)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.reflect.Method.invokeNative(Native Method)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.reflect.Method.invoke(Method.java:511)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-19 08:41:45.891: E/AndroidRuntime(641):
at dalvik.system.NativeStart.main(Native Method)
03-19 08:41:45.891: E/AndroidRuntime(641):
Caused by: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.setContentView(Activity.java:1867)
03-19 08:41:45.891: E/AndroidRuntime(641):
at com.maret.toilet.MainActivity.onCreate(MainActivity.java:12)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.performCreate(Activity.java:5008)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 11 more
03-19 08:41:45.891: E/AndroidRuntime(641):
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-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:584)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:552)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Activity.onCreateView(Activity.java:4656)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 21 more
03-19 08:41:45.891: E/AndroidRuntime(641):
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
03-19 08:41:45.891: E/AndroidRuntime(641):
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-19 08:41:45.891: E/AndroidRuntime(641):
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-19 08:41:45.891: E/AndroidRuntime(641):
at android.app.Fragment.instantiate(Fragment.java:574)
03-19 08:41:45.891: E/AndroidRuntime(641): ... 24 more
HERE IS THE NEW LAYOUT AND ACTIVITY
THIS IS main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
* HERE IS MY main.java **
package com.maret.maps;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Main extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
HERE IS THE NEW LOGCAT WHEN THE APP CHRASHES**
03-21 12:23:03.633: E/Trace(958): error opening trace file: No such file or directory (2)
03-21 12:23:04.422: D/AndroidRuntime(958): Shutting down VM
03-21 12:23:04.432: W/dalvikvm(958): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-21 12:23:04.452: E/AndroidRuntime(958): FATAL EXCEPTION: main
03-21 12:23:04.452: E/AndroidRuntime(958): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.maps/com.maret.maps.Main}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.os.Looper.loop(Looper.java:137)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-21 12:23:04.452: E/AndroidRuntime(958): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 12:23:04.452: E/AndroidRuntime(958): at java.lang.reflect.Method.invoke(Method.java:511)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-21 12:23:04.452: E/AndroidRuntime(958): at dalvik.system.NativeStart.main(Native Method)
03-21 12:23:04.452: E/AndroidRuntime(958): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.setContentView(Activity.java:1867)
03-21 12:23:04.452: E/AndroidRuntime(958): at com.maret.maps.Main.onCreate(Main.java:12)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.performCreate(Activity.java:5008)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-21 12:23:04.452: E/AndroidRuntime(958): ... 11 more
03-21 12:23:04.452: E/AndroidRuntime(958): Caused by: java.lang.ClassCastException: com.google.android.gms.maps.SupportMapFragment cannot be cast to android.app.Fragment
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Fragment.instantiate(Fragment.java:577)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Fragment.instantiate(Fragment.java:552)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.app.Activity.onCreateView(Activity.java:4656)
03-21 12:23:04.452: E/AndroidRuntime(958): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-21 12:23:04.452: E/AndroidRuntime(958): ... 21 more
03-21 12:23:07.973: I/Process(958): Sending signal. PID: 958 SIG: 9
Here is blog post I wrote on how to create a Map fragment in your application:
Google Maps API V2
From your code it look like your permission are not defined properly, you need to add this:
<permission android:name="com.maret.maps.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.maret.maps.permission.MAPS_RECEIVE"/>
And please add your logcat stack trace at crash moment so we could understand more clearly what the problem is.
UPDATE:
From the error you are receiving:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maret.toilet/com.maret.toilet.MainActivity}: android.view.InflateException:
Binary XML file line #15: Error inflating class fragment
it's seems that you are not referencing the google-play-services library as needed, and this is the reason the fragment can't be inflated. the MapFragment class can't be find.
please check the guide that I posted at the beginning of the answer to see how to make the referencing correctly.
Your application tag in your manifest is missing this line
<uses-library android:name="com.google.android.maps" />
Add that and it should fix the crash
EDIT : This will only work for maps api version 1
I am an Android developer and I am trying to send a Serializable object to another Activity using a Bundle. However, I get the following - Parcelable encountered ClassNotFoundException reading a Serializable object as an error.
What is the cause of this and how can I fix it?
Below is the code snippet:
Bundle previousData = new Bundle();
previousData.putSerializable("GetVehicleInfo_AllTrims", trimsObj);// trimObj is a serialized object
Intent detailsIntent = new Intent(androidScrolbleTabbar.TABBAR_PUSHVIEW);
detailsIntent.putExtras(previousData);
detailsIntent.putExtra("ActivityIdentifier", ManualScreenNav2.viewIdentifier);
detailsIntent.putExtra("className", ManualScreenNav2.class.getName());
sendBroadcast(detailsIntent);
Below is the full stack trace:
03-19 15:39:02.549: E/AndroidRuntime(27084): FATAL EXCEPTION: main
03-19 15:39:02.549: E/AndroidRuntime(27084): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.mobyfactory.pushview (has extras) } in com.adplotmanagement.androidScrolbleTabbar$PUSHViewBroadcastReceiver#461bc340
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:942)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Handler.handleCallback(Handler.java:587)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Handler.dispatchMessage(Handler.java:92)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Looper.loop(Looper.java:143)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.app.ActivityThread.main(ActivityThread.java:4701)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.reflect.Method.invoke(Method.java:521)
03-19 15:39:02.549: E/AndroidRuntime(27084): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-19 15:39:02.549: E/AndroidRuntime(27084): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-19 15:39:02.549: E/AndroidRuntime(27084): at dalvik.system.NativeStart.main(Native Method)
03-19 15:39:02.549: E/AndroidRuntime(27084): Caused by: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Parcel.readSerializable(Parcel.java:1951)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Parcel.readValue(Parcel.java:1822)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Parcel.readMapInternal(Parcel.java:2008)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Bundle.unparcel(Bundle.java:208)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Bundle.getString(Bundle.java:1034)
03-19 15:39:02.549: E/AndroidRuntime(27084): at com.adplotmanagement.androidScrolbleTabbar$PUSHViewBroadcastReceiver.onReceive(androidScrolbleTabbar.java:560)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:910)
03-19 15:39:02.549: E/AndroidRuntime(27084): ... 9 more
03-19 15:39:02.549: E/AndroidRuntime(27084): Caused by: java.lang.ClassNotFoundException: com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.Class.classForName(Native Method)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.Class.forName(Class.java:235)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:2590)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1846)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:826)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2066)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Parcel.readSerializable(Parcel.java:1945)
03-19 15:39:02.549: E/AndroidRuntime(27084): ... 15 more
03-19 15:39:02.549: E/AndroidRuntime(27084): Caused by: java.lang.NoClassDefFoundError: com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims
03-19 15:39:02.549: E/AndroidRuntime(27084): ... 25 more
03-19 15:39:02.549: E/AndroidRuntime(27084): Caused by: java.lang.ClassNotFoundException: com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.adplotmanagement-1.apk]
03-19 15:39:02.549: E/AndroidRuntime(27084): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-19 15:39:02.549: E/AndroidRuntime(27084): ... 25 more
Missed adding one more point, I have two applications with same functionality and each app having the same class GetVehicleInfo_AllTrims and it is a pojo class. When i run one app in foreground the other app that lives in background is crashing with the above error.
Hi find the root cause of the issue and resolved it .
In two apps we are using same BroadCastReceivers and its intent filters. Due to this issue the runtime not able to find the appropriate receiver for the app.
I modified the intent filters for two apps differently and it is working fine now.
java.lang.ClassNotFoundException: com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims
What is the cause of this
The cause of this is exception that the class com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims was not found.
how can I fix it?
Make that class available on the application's CLASSPATH.
I keep getting an exception when I want to display an alertdialog at the beginning of an activity.
I can't figure out why? I really would appreciate an explanation.
The code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
if (!isInternetConnectionAvailable()) {
AlertDialog alert = new AlertDialog.Builder(getApplicationContext()).create();
alert.setMessage("TEST DIALOG!!!");
alert.show();
}
...
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): FATAL EXCEPTION: main
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.droidgroup.THMInfo/de.droidgroup.THMInfo.Activities.StartActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.os.Handler.dispatchMessage(Handler.java:99)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.os.Looper.loop(Looper.java:123)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at java.lang.reflect.Method.invoke(Method.java:521)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at dalvik.system.NativeStart.main(Native Method)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.view.ViewRoot.setView(ViewRoot.java:509)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.Dialog.show(Dialog.java:241)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at de.droidgroup.THMInfo.Activities.StartActivity.onCreate(StartActivity.java:82)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): ... 11 more
Use this instead of getApplicationContext(). More info here.