Android : Window couldn't find content container view after adding file in raw folder - android

Am getting an Window couldn't find content container view. This error asking when the app is going to checking the permission
I noticed that for the wear app , am copying the wear apk into the raw folder.
Its having around 2.5 Mb. After adding this am getting this crash
java.lang.RuntimeException: Window couldn't find content container view
at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:4614)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:4683)
at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2263)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4276)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3361)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Comscore library was causing this issue in my case. Try removing it.

Related

Sometimes get android.content.res.Resources$NotFoundException

We're debugging a crash in a Cordova app that seems to happen on launch / foregrounding, after the app was backgrounded for a moderate amount of time and has been to some extent killed by the OS.
At the time of the crash the app is attempting to show a native dialog fragment for Fingerprint Authentication. For some reason in this case the resources for this fragment cannot be found.
It's been reported for Android 6 and 7, on older and newer devices.
java.lang.RuntimeException: Unable to start activity ComponentInfo{ca.koho/ca.koho.Koho}: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2421)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
at android.app.ActivityThread.access$900(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:174)
at android.app.ActivityThread.main(ActivityThread.java:5440)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1437)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2887)
at android.content.res.Resources.getLayout(Resources.java:1251)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.onCreateView(FingerprintAuthenticationDialogFragment.java:85)
at android.app.Fragment.performCreateView(Fragment.java:2220)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:973)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1130)
at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1953)
at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:152)
at android.app.Activity.performCreateCommon(Activity.java:6279)
at android.app.Activity.performCreate(Activity.java:6287)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2374)
... 9 more
Here's the problematic bit of code, from the DialogFragment's onCreateView:
int fingerprint_dialog_container_id = getResources()
.getIdentifier("fingerprint_dialog_container", "layout",
FingerprintAuth.packageName);
View v = inflater.inflate(fingerprint_dialog_container_id, container, false);
When the crash happens, getIdentifier(...) is for some reason returning 0. Most of the time the actual identifier is returned.
I have not found a way to reproduce the crash, and advice to enable developer options like 'Don't keep activities' and 'Background process limit' had did not help.
Thanks for any help.

Facebook ProfilePictureView causing FAILED BINDER TRANSACTION

Been pulling my hair out trying to figure out why my app keeps crashing, I've nailed it down to having this in my main activities layout XML.
<com.facebook.login.widget.ProfilePictureView
android:id="#+id/pp"
android:layout_gravity="center"
android:layout_height="match_parent"
android:layout_width="match_parent">
</com.facebook.login.widget.ProfilePictureView>
Whenever I have this in my main activity layout, and I try to create any new intents (new activities, facebook sign in or requesting permissions) My app crashed with a FAILED BINDER TRANSACTION and TransactionTooLargeException.
This continues to happen when I remove the profile picture code in the activity class. It seems to be the view appearing that's casing this but I cannot think why.
This occurs not on my main testign device, but on all emulators and other devices Ive tried.
stacktrace
03-13 15:29:21.347 28962-28962/uk.co.claytapp.taggerbath E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 1443592)
03-13 15:29:21.348 28962-28962/uk.co.claytapp.taggerbath D/AndroidRuntime: Shutting down VM
03-13 15:29:21.348 28962-28962/uk.co.claytapp.taggerbath E/AndroidRuntime: FATAL EXCEPTION: main
Process: uk.co.claytapp.taggerbath, PID: 28962
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1443592 bytes
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3752)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.os.TransactionTooLargeException: data parcel size 1443592 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:615)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3606)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3744)
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
This most likely happens in the onSaveInstanceState(Bundle outState) method of the activity you are navigating away from.
To fix it, add android:saveEnabled="false" to your ProfilePictureView like so:
<com.facebook.login.widget.ProfilePictureView
android:id="#+id/profilePicture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:saveEnabled="false"
facebook:com_facebook_preset_size="normal" />
This will prevent Android to call ProfilePictureView's own onSaveInstanceState method (the view hierarchy is stored by the Activity anyway so it won't hurt).

illegal state exception from startactivity

Hi guys I am getting the following exception
ERR-5e1e9c7f83ba94b45017220ad632c|StackTrace:java.lang.IllegalStateException: Fragment Gallery{d6a81c0} not attached to Activity
--------- Stack trace ---------
android.support.v4.app.Fragment.startActivity(Fragment.java:914)
mypackage.Gallery$openReceiptImage.onPostExecute(Gallery.java:1604)
mypackage.Gallery$openReceiptImage.onPostExecute(Gallery.java:1424)
android.os.AsyncTask.finish(AsyncTask.java:651)
android.os.AsyncTask.access$500(AsyncTask.java:180)
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:148) android.app.ActivityThread.main(ActivityThread.java:7325) java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
------------------------------- --------- Cause --------- -------------------------------
My code is as follows
Intent fullimage=new Intent(mContext, Preview.class);
startActivity(fullimage);
Here mContext is Context and I am calling this from Fragment. Preview is Activity. I beleieve these informations are enough. And also I am not getting this issue always.
Can anyone tell me what could be the reason for this issue.
Thanks in Advance.
Issue is fixed
if(isAdded){ }
Is used to check whether that fragment is attached to Activity or not

Can't find ColorStateList from drawable resource ID only on Android Nougat

I have found this error in my Crashlytics, and it seems like it's only crashing for users with preview version of Android Nougat.
App crashes on startup (Main Activity).
Stacktrace
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.domain/com.my.domain.activities.MainActivity}: android.content.res.Resources$NotFoundException: Can't find ColorStateList from drawable resource ID #0x7f020057
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by android.content.res.Resources$NotFoundException: Can't find ColorStateList from drawable resource ID #0x7f020057
at android.content.res.ResourcesImpl.loadColorStateList(ResourcesImpl.java:840)
at android.content.res.Resources.loadColorStateList(Resources.java:998)
at android.content.res.TypedArray.getColor(TypedArray.java:447)
at android.app.Activity.onApplyThemeResource(Activity.java:4039)
at android.view.ContextThemeWrapper.initializeTheme(ContextThemeWrapper.java:198)
at android.view.ContextThemeWrapper.setTheme(ContextThemeWrapper.java:140)
at android.app.Activity.setTheme(Activity.java:4009)
at android.support.v7.app.AppCompatActivity.setTheme(AppCompatActivity.java:90)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2592)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
It looks like Android Nougat no longer supports some kind of system colors that I'm using in my app? But I don't know exactly how to fix it.
Edit
So I found the resource with ID 0x7f020057 in my R file and this is it:
public static final int background_splash_gradient=0x7f020057;
I checked where I am using it and here it is:
<style name="StartingWindowTheme" parent="AppTheme">
<item name="android:windowBackground">#drawable/background_splash_gradient</item>
<item name="android:colorBackground">#drawable/background_splash_gradient</item>
</style>
And this is the background_splash_gradiend xml file:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="135"
android:endColor="#00d49e"
android:startColor="#00bcd4"/>
</shape>
I still don't know why this is causing issues on Nougat. I tried removing the "StartingWindowTheme" style and app now works, it no longer crashes. But I need a better fix than that.
Edit 2
So I tried to remove this line:
<item name="android:colorBackground">#drawable/background_splash_gradient</item>
And it works. Seems like android:colorBackground is the issue.
TEMPORARY FIX
Since the problem is in the line mentioned above, only on Nougat, I have created a values-v24 folder and removed the line there. App works on Nougat now, but I would appreciate a better solution.
I found where the problem was and how to fix it. Here's the solution, I'll keep it simple.
This line was causing the problem:
<item name="android:colorBackground">#drawable/background_splash_gradient</item>
Turns out you can't set drawable as a colorBackground in XML, so it works after removing this line.
The reason this only crashed on Nougat is because this was possible in earlier versions.
It turns out that according with the Android issue tracker, this is Working As Intended.
android:colorBackground expects a color not a drawable.

How to debug internal crash of GLSurfaceView?

I'm developing a VR video viewer using Android Cardboard SDK and RajawaliVR (https://github.com/Rajawali/RajawaliVR)
On some devices I have this crash when returning from sleep (others just show black screen):
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.opengl.GLSurfaceView$GLThread.surfaceCreated()' on a null object reference
at android.opengl.GLSurfaceView.surfaceCreated(GLSurfaceView.java:523)
at android.view.SurfaceView.updateWindow(SurfaceView.java:580)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:176)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1970)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5891)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
As you can see the crash is in the android code, how do I start debugging it?
You have access to the source code, so start with that.
Assuming you're using Lollipop, it's failing on this line:
mGLThread.surfaceCreated();
The error message indicates that mGLThread is null. Doing a simple search for the assignment ("mGLThread =") with the web browser reveals two instances, the most interesting of which is this one:
public void setRenderer(Renderer renderer) {
...
mGLThread = new GLThread(mThisWeakRef);
Setting some of the complexities aside, mGLThread should be non-null so long as setRenderer() is called. So the first thing to do is check to see if your application is calling setRenderer() (typically in onCreate()).
If you're following along the Android Developer OpenGL tutorial, it's possible that Android Studio corrected this definition in your Activity class constructor:
mGLView = new MyGLSurfaceView(this);
and changed it to
mGLView = new GLSurfaceView(this);
because the class MyGLSurfaceView had not been coded yet...skipping the MyGLSurfaveView constructor which is where setRenderer(...) is called. Mr. fadden's answer above is excellent, explains how to diagnose the problem.

Categories

Resources