I have this strack trace from the Developer Console on Google Play so I have no way to reproduce this exception cause I don't know what triggers it. The user also didn't leave any message, so...
java.lang.RuntimeException: Binary XML file line #17: You must supply a layout_height attribute.
at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5319)
at android.view.ViewGroup$LayoutParams.<init>(ViewGroup.java:5271)
at android.widget.AbsListView$LayoutParams.<init>(AbsListView.java:6398)
at android.widget.AbsListView.generateLayoutParams(AbsListView.java:6035)
at android.widget.AbsListView.generateLayoutParams(AbsListView.java:96)
at android.view.LayoutInflater.inflate(LayoutInflater.java:477)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.android.internal.view.menu.ListMenuPresenter$MenuAdapter.getView(ListMenuPresenter.java:253)
at android.widget.AbsListView.obtainView(AbsListView.java:2212)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)
at android.widget.ListView.onMeasure(ListView.java:1155)
at android.view.View.measure(View.java:12863)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2256)
at android.view.View.measure(View.java:12863)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1166)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2552)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
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:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
How do I pinpoint the problem?
This is Android's internal error, nothing in your code. You don't even see your app's code in stack trace, and your app works on many other devices.
I'm getting similar occasional crash reports, and also similar crashes on some Android versions (using ACRA). I've seen "You must supply a layout_height attribute" unexpected crash a few times.
If you use ACRA or similar, sometimes you just get reports for which your app is not responsible at all.
Message says - "You must supply a layout_height attribute."
So, double check that all your components have layout_height attribute.
I also had mention "menu" in this stack. It is generated by system. Double check that your all menus have valid items (at least not zero items) all the time.
Related
I have in my Android app a MapActivity, that shows map using osmdroid (Open Street Map for Android library).
When I'm in this MapActivity and I go to another activity, I get always an exception, and I cannot understand how to avoid it, because I think that it is related to something done inside the library.
As you can see in the following log, it happen after destroying of MapActivity
05-18 17:34:31.117 27073-27073/com.fpricoco.etip I/﹕ Classe 'MapActivity' ---- 'onDestroy()' ---- Stato: Distrutta
05-18 17:34:31.157 27073-27073/com.fpricoco.etip E/ActivityThread﹕ Activity com.fpricoco.etip.Activities.MapActivity has leaked IntentReceiver org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase$MyBroadcastReceiver#43d85f60 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity com.fpricoco.etip.Activities.MapActivity has leaked IntentReceiver org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase$MyBroadcastReceiver#43d85f60 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1151)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1138)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1132)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:365)
at org.osmdroid.tileprovider.util.SimpleRegisterReceiver.registerReceiver(SimpleRegisterReceiver.java:21)
at org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase.<init>(MapTileFileStorageProviderBase.java:34)
at org.osmdroid.tileprovider.modules.MapTileFileArchiveProvider.<init>(MapTileFileArchiveProvider.java:57)
at org.osmdroid.tileprovider.modules.MapTileFileArchiveProvider.<init>(MapTileFileArchiveProvider.java:76)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:63)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:41)
at org.osmdroid.tileprovider.MapTileProviderBasic.<init>(MapTileProviderBasic.java:34)
at org.osmdroid.views.overlay.MinimapOverlay.<init>(MinimapOverlay.java:114)
at com.fpricoco.etip.Activities.MapActivity.onCreate(MapActivity.java:303)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2034)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2095)
at android.app.ActivityThread.access$600(ActivityThread.java:137)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4791)
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:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Searching on Google I found that I have to "unregisterReceiver(yourReceiver)", the point is that I don't have in my case any "yourReceiver" setted in my code, I think it is done inside library.
I also found this solution "https://groups.google.com/forum/#!topic/osmdroid/wDEvFpWfTIU" , but I don't understand how to detach
Finally I also tried in this way, but it didn't work:
// .. get custom tiles off the screen
myMapView.getOverlays().remove(mMinimapOverlay);
// .. release all custom tiles' bitmaps
myMapView.getTileProvider().clearTileCache();
// .. unregister intent receiver
myMapView.getTileProvider().detach();
The library I imported is:
compile 'org.osmdroid:osmdroid-android:5.1#aar'
inside my gradle.build file.
try this:
#Override
public void onDestroy() {
myMapView.onDetach();
myMapView.getTileProvider().clearTileCache();
}
i've just recived this crash log but can't understand what its caused from. Basically my app is a text editor. I have a TextWatcher on the TextView but i'm not sure if its that the problem, since the logcat dosent contain any line of my app.
java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
at java.util.ArrayList.get(ArrayList.java:304)
at android.widget.TextView.sendOnTextChanged(TextView.java:7231)
at android.widget.TextView.handleTextChanged(TextView.java:7290)
at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8880)
at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:672)
at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:435)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:333)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
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)
I'm not sure if this can help someone else, but to fix this bug I've done this:
I have an EditText, with a TextWatcher.
The error is raised by this set:
editText.setText("");
To solve this I had to first remove the listener, set the text to the empty string, and then re-add the listener.
Hope it can help someone else as well.
seems this happens if you edit the attached state of a text watcher in the text watcher itself. e.g., i see this happen if i remove the textwatcher in a watcher method itself.
to verify, move the contents of onTextChanged to afterTextChanged, and see if the new stacktrace is triggered from TextView$ChangeWatcher.afterTextChanged instead.
to work around it, move that work to a handler posted from the method, or similar.
So late, but for anyone can be useful:
Check if your EditText has the textAllCaps="true" attribute and remove it if needed.
I am using crashlytics to track my app's crash. There is one bug which is quite hard to figure out. The stack trace from crashlytics is as below:
java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
at android.view.InputChannel.nativeReadFromParcel(InputChannel.java)
at android.view.InputChannel.readFromParcel(InputChannel.java:148)
at android.view.InputChannel$1.createFromParcel(InputChannel.java:39)
at android.view.InputChannel$1.createFromParcel(InputChannel.java:36)
at com.android.internal.view.InputBindResult.<init>(InputBindResult.java:62)
at com.android.internal.view.InputBindResult$1.createFromParcel(InputBindResult.java:102)
at com.android.internal.view.InputBindResult$1.createFromParcel(InputBindResult.java:99)
at com.android.internal.view.IInputMethodManager$Stub$Proxy.windowGainedFocus(IInputMethodManager.java:851)
at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1292)
at android.view.inputmethod.InputMethodManager.onWindowFocus(InputMethodManager.java:1518)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3550)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5293)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(NativeStart.java)
I know there is one similar question about this here. But there is a bit different. And as statistics from crashlytics, the crash happens mainly in SAMSUNG android phone.
I am new to android and don't know why the crash happened and how to fix this kind of crash.
Any suggestion would be much appreciated.
Think it's a very wide area and there could be a lot of situations which can trigger this system level exception. But maybe this example of how it was fixed in a particular project can help someone.
I experienced a similar exception:
"Could not read input channel file descriptors from parcel" on Samsung phone:
java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
at android.view.InputChannel.nativeReadFromParcel(Native Method)
at android.view.InputChannel.readFromParcel(InputChannel.java:148)
at android.view.IWindowSession$Stub$Proxy.addToDisplay(IWindowSession.java:690)
at android.view.ViewRootImpl.setView(ViewRootImpl.java:525)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:269)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.widget.Toast$TN.handleShow(Toast.java:402)
at android.widget.Toast$TN$1.run(Toast.java:310)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
It happened in a big old project which I got for maintenance and this floating bug occurred only after several hours. I spent quite some time on it and also read some related answers on SO regarding it and had no clue except it's a system level bug of Android, and there should be some extra data or duplicates of objects or big objects in memory etc:
https://code.google.com/p/android/issues/detail?id=32470
The last thing I could think about was SoundPool. It's not used a lot in the project - there are not more than 10 different sounds played from time to time. But it was the root cause! Sometimes there were floating exceptions from SoundPool "unable to load sample (null)". And it helped to realize that SoundPool was used in a wrong way:
public void play(int rscId) {
...
final int soundId = soundPool.load(mContext, rscId, 1);
...
soundPool.play(soundId, volume, volume, 5, 0, 1f);
So new id was generated and sound resource was reloaded each time application called play sound method! And after certain amount of time some non related exceptions started to occur until application crashed with the "Could not read input channel file descriptors from parcel" exception.
It's interesting that one of those non related exceptions was: "ExceptionHandled in unable to open database file (code 14)":
ExceptionHandled in unable to open database file (code 14)
android.database.sqlite.SQLiteCantOpenDatabaseException:
unable to open database file (code 14)
at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow
(Native Method)
at android.database.sqlite.SQLiteConnection.executeForCursorWindow
(SQLiteConnection.java:845)
And of course it has nothing to do neither with database nor with toasts/parcels. The fix for that particular situation was very easy: just preload all sounds as it's suggested in Android documentation:
http://developer.android.com/reference/android/media/SoundPool.html
"The loading logic iterates through the list of sounds calling the appropriate SoundPool.load() function. This should typically be done early in the process to allow time for decompressing the audio to raw PCM format before they are needed for playback.
Once the sounds are loaded and play has started, the application can trigger sounds by calling SoundPool.play()."
So I moved soundPool.load() out from play() method and the exception :
"Could not read input channel file descriptors from parcel" has gone as well as the exception "unable to open database file (code 14)".
public void play(int soundId) {
...
soundPool.play(soundId, volume, volume, 5, 0, 1f);
And soundPool.release(); soundPool = null should be called as well when it's not needed anymore. And maybe it also can have an effect on such exceptions, see details here
Could not read input channel file descriptors from parcel
Most probably it's not the exact situation for the original question but hope it can give some information to dig further. I.e. looking for some additional exceptions, swallowed exceptions, or wrong files/data handling.
I am looking for the answer for a long time such as the others facing at this exception.
As I see it, this crash can also be triggered by the unexceptional TextView or EditText which works with the InputMethodManager:
java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
at android.view.InputChannel.nativeReadFromParcel(Native Method)
at android.view.InputChannel.readFromParcel(InputChannel.java:148)
at android.view.InputChannel$1.createFromParcel(InputChannel.java:39)
at android.view.InputChannel$1.createFromParcel(InputChannel.java:36)
at com.android.internal.view.InputBindResult.<init>(InputBindResult.java:68)
at com.android.internal.view.InputBindResult$1.createFromParcel(InputBindResult.java:112)
at com.android.internal.view.InputBindResult$1.createFromParcel(InputBindResult.java:109)
at com.android.internal.view.IInputMethodManager$Stub$Proxy.startInput(IInputMethodManager.java:697)
at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1407)
at android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.java:1518)
at android.view.inputmethod.InputMethodManager.restartInput(InputMethodManager.java:1286)
at android.widget.TextView.setText(TextView.java:4718)
at android.widget.TextView.setText(TextView.java:4656)
at android.widget.TextView.append(TextView.java:4330)
at android.widget.TextView.append(TextView.java:4320)
...
When TextView appending text, it will make text to Editable, and start InputMethodManager. But at this time, something goes wrong in the InputMethod process, and it leads to fail to create InputBindResult which reading error from the parcel.
In this case, the workaround is very simple: DO NOT call append on textview directly, use StringBuilder or SpannableStringBuilder to build text and call TextView.setText(text) instead!
Previous users have commented that this can be a hard bug to track down. I caused this by building a custom alert dialog (containing multiple TextView objects) inside of a while loop vice an if statement. The application crashed before displaying the dialog box(es).
I have meet this problem recently.
java.lang.RuntimeException: Could not read input channel file descr
iptors from parcel.
I search the log find following info:
01-01 09:07:52.164 5162 6777 W zygote64: ashmem_create_region failed
for 'indirect ref table': Too many open files
The problem is that I create HandlerThread repeatedly, but don't do it's quit() method, at last result in fd leaked.
ViewRootImpl$ViewRootHandler means you have view.post or view.postDelay.
and in the post method maybe requestFocus or Keyboard
We register a broadcast receiver to receive package installment or uninstallment event.
But some users report crash reports like this:
java.lang.RuntimeException: Unable to create application com.kc.security.MoSecurityApplication: java.lang.RuntimeException: getResources is null: dir - /data/app/com.cm.mg-1.apk, srcVal-1, srcVal-2
at android.app.LoadedApk.makeApplication(LoadedApk.java:495)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2249)
at android.app.ActivityThread.access$1600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: getResources is null: dir - /data/app/com.cm.mg-1.apk, srcVal-1, srcVal-2
at com.kc.security.b.ab.b(UpdateManager.java:69)
at com.kc.security.b.ab.a(UpdateManager.java:112)
at com.kc.security.MoSecurityApplication.onCreate(MoSecurityApplication.java:66)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
at android.app.LoadedApk.makeApplication(LoadedApk.java:492)
... 11 more
It is not easy to reappear this crash. We think a lot about this problem. We receive a
uninstall event ,then the Application context Class called it's onCreate method, we do
some initial works there , when we call getResouce(), it returns null . When look deep
inside the framework codes, we find that getReource locate resources file by sourceDir
String in ApplicationInfo, and the String is "/data/app/com.cm.mg-1.apk" > it's the original apk , and it is not exists anymore.
It maybe happens when user update our application. In some way "/data/app/com.cm.mg-1.apk" is allready deleted and replace by "/data/app/com.cm.mg-2.apk" any way, but the "sourceDir" String in ApplicationInfo is not update.
I want to know what android does when doing a updating.
Encountered a similar problem, check this out.
RuntimeException: Unable to instantiate application
I think this should answer this question, maybe because the Resources has been destroyed during this uninstall event.
Here is the stack traces from android crash report. I have 6 crash reports with this stack trace provided by google. Individuals comment on what happened but they do not tell any details on the screen what they were doing etc. can any one decipher this and possibly give me a general course of action to eliminate this issue. My app is a calculator using trig functions.
java.lang.NumberFormatException: unable to parse '2.625' as integer
at java.lang.Integer.parse(Integer.java:383)
at java.lang.Integer.parseInt(Integer.java:372)
at java.lang.Integer.parseInt(Integer.java:332)
at com.pipe.fittings.kevin.All_angle_pipe_all_angle$10.onClick(All_angle_pipe_all_angle.java:236)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9089)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)`enter code here`
In your code you are trying to parse double value using Integer.parseInt which is wrong. You need to use double temp = Double.parseDouble(s); if you want double.
If you want int, int temp2 = Double.intValue(temp);
use double i=Double.parseDouble(str); instead of Integer.parseInt.