In my Android application's main Activity is a tabActivity and one of the tab contains another Tab activity. I load the 2nd activity with different views.
There is an error on loading the Application on the emulator.
03-11 16:28:46.463: E/AndroidRuntime(23736): FATAL EXCEPTION: main
03-11 16:28:46.463: E/AndroidRuntime(23736): java.lang.StackOverflowError
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.Styled.measureText(Styled.java:430)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.Layout.measureText(Layout.java:1655)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.Layout.getLineMax(Layout.java:689)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.Layout.draw(Layout.java:340)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.text.BoringLayout.draw(BoringLayout.java:365)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.TextView.onDraw(TextView.java:4150)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6880)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.AbsListView.dispatchDraw(AbsListView.java:1480)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.ListView.dispatchDraw(ListView.java:3138)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.ExpandableListView.dispatchDraw(ExpandableListView.java:229)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6986)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.AbsListView.draw(AbsListView.java:2584)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewRoot.draw(ViewRoot.java:1522)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
03-11 16:28:46.463: E/AndroidRuntime(23736): at android.view.ViewRoot.handleMessage(ViewR
Thrown when the depth of the stack of the running program exceeds some platform or VM specific limit. Typically, this will occur only when a program becomes infinitely recursive, but it can also occur in correctly written (but deeply recursive) programs.
More Details
Most likely in your child activity you are trying to load the first activity again, which loads the second activity, which again loads the first activity and so on, leading to recursion and your app dies because it reaches the memory limit, applied by the OS.
Related
I am trying to use vitamio to play stream hls. it contained error when i play stream
03-11 16:12:25.836: E/Vitamio[Player](344): isNativeLibsInited
03-11 16:12:25.836: E/Vitamio[Player](344): java.io.FileNotFoundException: /data/data/com.example.esporttv/libs/.lock (No such file or directory)
03-11 16:12:25.836: E/Vitamio[Player](344): at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
03-11 16:12:25.836: E/Vitamio[Player](344): at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
03-11 16:12:25.836: E/Vitamio[Player](344): at java.io.FileInputStream.<init>(FileInputStream.java:80)
03-11 16:12:25.836: E/Vitamio[Player](344): at java.io.FileReader.<init>(FileReader.java:42)
03-11 16:12:25.836: E/Vitamio[Player](344): at io.vov.vitamio.Vitamio.isInitialized(Vitamio.java:128)
03-11 16:12:25.836: E/Vitamio[Player](344): at io.vov.vitamio.LibsChecker.checkVitamioLibs(LibsChecker.java:40)
03-11 16:12:25.836: E/Vitamio[Player](344): at com.example.esporttv.Player$2.onClick(Player.java:97)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.view.View.performClick(View.java:2485)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.view.View$PerformClick.run(View.java:9080)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.os.Handler.handleCallback(Handler.java:587)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.os.Handler.dispatchMessage(Handler.java:92)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.os.Looper.loop(Looper.java:123)
03-11 16:12:25.836: E/Vitamio[Player](344): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-11 16:12:25.836: E/Vitamio[Player](344): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 16:12:25.836: E/Vitamio[Player](344): at java.lang.reflect.Method.invoke(Method.java:507)
03-11 16:12:25.836: E/Vitamio[Player](344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-11 16:12:25.836: E/Vitamio[Player](344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-11 16:12:25.836: E/Vitamio[Player](344): at dalvik.system.NativeStart.main(Native Method)
03-11 16:12:26.166: E/Vitamio[Player](344): isNativeLibsInited
03-11 16:12:26.166: E/Vitamio[Player](344): java.io.FileNotFoundException: /data/data/com.example.esporttv/libs/.lock (No such file or directory)
03-11 16:12:26.166: E/Vitamio[Player](344): at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
03-11 16:12:26.166: E/Vitamio[Player](344): at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.io.FileInputStream.<init>(FileInputStream.java:80)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.io.FileReader.<init>(FileReader.java:42)
03-11 16:12:26.166: E/Vitamio[Player](344): at io.vov.vitamio.Vitamio.isInitialized(Vitamio.java:128)
03-11 16:12:26.166: E/Vitamio[Player](344): at io.vov.vitamio.Vitamio.initialize(Vitamio.java:102)
03-11 16:12:26.166: E/Vitamio[Player](344): at io.vov.vitamio.activity.InitActivity$1.doInBackground(InitActivity.java:55)
03-11 16:12:26.166: E/Vitamio[Player](344): at io.vov.vitamio.activity.InitActivity$1.doInBackground(InitActivity.java:1)
03-11 16:12:26.166: E/Vitamio[Player](344): at android.os.AsyncTask$2.call(AsyncTask.java:185)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
03-11 16:12:26.166: E/Vitamio[Player](344): at java.lang.Thread.run(Thread.java:1019)
please help me. thanks
You are giving the file
/data/data/com.example.esporttv/libs/.lock
as a streaming source. You should always check if the file exists using file.exists() function.
Can you also post the lines where you initializee the player?
If you are using Android Studio, here is the solution, original article here:
Create a folder called “lib” (must be exactly this name)
Create subfolders in lib with desired architecture name such as
“armeabi-v7a”, “armeabi” etc.
Put all your *.so file in the just created folder. Now your folder structure should be like this:
lib\armeabi-v7a
...
lib\armeabi
Zip the lib folder into a file, e.g. abc.zip;
Rename this abc.zip –> abc.jar
Copy this abc.jar to your project subfolder, anywhere should do, but
I would typically put it in the app\libs\abc.jar
In the build.gradle, add below line.
That is it!
dependencies {
compile files(‘libs/abc.jar’)
…
}
I am currently using 2 libraries in my Android project:
SlidingMenu: https://github.com/jfeinstein10/SlidingMenu
Android-PullToRefresh: https://github.com/chrisbanes/Android-PullToRefresh
With Android 4.x everything works right, but in Android 2.x I get a StackOverflow Exception.
I am not sure if it is an Android version issue or a hardware issue.
This is the log of the exception:
05-22 13:34:30.339: E/AndroidRuntime(15179): java.lang.StackOverflowError
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.Styled.measureText(Styled.java:430)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.Layout.measureText(Layout.java:1655)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.Layout.getLineMax(Layout.java:689)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.Layout.draw(Layout.java:340)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.text.BoringLayout.draw(BoringLayout.java:365)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.TextView.onDraw(TextView.java:4259)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6880)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.AbsListView.dispatchDraw(AbsListView.java:1492)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.ListView.dispatchDraw(ListView.java:3138)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6986)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.AbsListView.draw(AbsListView.java:2600)
05-22 13:34:30.339: E/AndroidRuntime(15179): at com.handmark.pulltorefresh.library.PullToRefreshListView$InternalListView.draw(PullToRefreshListView.java:281)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.buildDrawingCache(View.java:6642)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.onAnimationStart(ViewGroup.java:1259)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1505)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.support.v4.view.ViewPager.draw(ViewPager.java:1574)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at com.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:830)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179): at android.widget.FrameLayout.draw(FrameLayout.java:357)
Can somebody help me to solve the issue?
Thank you!
You generally see this error when you have too many nested views - a problem which is exacerbated on older versions of Android.
However, I have also noticed that the slidingmenu lib can cause this on older versions of android (3.X or earlier). I used to see this error all the time and it was originating from the slidingmenu code - my own views were only nested 10-15 deep (not great, but not disastrous). I switched to the menu-drawer library https://github.com/SimonVT/android-menudrawer and the error disappeared.
Things to try...
Fire up the android device monitor or hierarchy viewer (http://developer.android.com/tools/debugging/debugging-ui.html) and have a look at your layouts. If there are any views deeper than say, 15-20 you might want to have a look at optimizing your layouts.
Try swapping out your sliding-menu lib for either google's own (in the support lib) or the one I mentioned above (which may be easier to swap as it follows a similar design to slidingmenu - it took me about an hour).
Good luck!
The goal of this project of mine is to update a spinner dynamically with user input. Unfortunately I'm losing this battle. Logcat keeps throwing the resource ID error at me, HOWEVER, I don't understand why it's only thrown on button press, wouldn't it be thrown after onCreate, if that's where the problem is?
Eclipse (via ctrl + space) tells me the to specify the Resource ID of the layout CONTAINING the TextView. Which I also don't even understand why I would need a textview, if I'm just handling an array and a spinner. AndroidDevelopment site also says the same. I'm just confused.So, my question is, what does this error mean, and what am I doing wrong?
I BELIEVE this is the line in question:
list = new ArrayAdapter<String>(this,R.layout.settings,items);
This is the .java
package com.example.thepicker;
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
public class Settings extends Activity implements OnClickListener{
EditText getit;
ImageButton giveit;
Spinner thelist;
ArrayList<String> items;
ArrayAdapter<String> list;
String transit;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
items = new ArrayList<String>();
list = new ArrayAdapter<String>(this,R.layout.settings,items);
getit = (EditText) findViewById(R.id.getit);
giveit = (ImageButton) findViewById(R.id.giveit);
thelist = (Spinner) findViewById(R.id.thelist);
thelist.setAdapter(list);
giveit.setOnClickListener(this);
}
#Override
public void onClick(View v) {
String transit = getit.getText().toString();
items.add(transit);
list.insert(transit, 0);
list.notifyDataSetChanged();
}
}
This is the logcat
03-11 01:39:25.682: E/Trace(1722): error opening trace file: No such file or directory (2)
03-11 01:39:26.452: D/libEGL(1722): loaded /system/lib/egl/libEGL_emulation.so
03-11 01:39:26.532: D/(1722): HostConnection::get() New Host Connection established 0x556a6180, tid 1722
03-11 01:39:26.602: D/libEGL(1722): loaded /system/lib/egl/libGLESv1_CM_emulation.so
03-11 01:39:26.623: D/libEGL(1722): loaded /system/lib/egl/libGLESv2_emulation.so
03-11 01:39:26.761: W/EGL_emulation(1722): eglSurfaceAttrib not implemented
03-11 01:39:26.772: D/OpenGLRenderer(1722): Enabling debug mode 0
03-11 01:39:30.483: W/EGL_emulation(1722): eglSurfaceAttrib not implemented
03-11 01:39:36.412: E/ArrayAdapter(1722): You must supply a resource ID for a TextView
03-11 01:39:36.412: D/AndroidRuntime(1722): Shutting down VM
03-11 01:39:36.423: W/dalvikvm(1722): threadid=1: thread exiting with uncaught exception (group=0x2bd39930)
03-11 01:39:36.562: E/AndroidRuntime(1722): FATAL EXCEPTION: main
03-11 01:39:36.562: E/AndroidRuntime(1722): java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:386)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:193)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.Spinner.onMeasure(Spinner.java:439)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:645)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:425)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-11 01:39:36.562: E/AndroidRuntime(1722): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.View.measure(View.java:15513)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.Choreographer.doFrame(Choreographer.java:532)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.os.Handler.handleCallback(Handler.java:725)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.os.Handler.dispatchMessage(Handler.java:92)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.os.Looper.loop(Looper.java:137)
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-11 01:39:36.562: E/AndroidRuntime(1722): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 01:39:36.562: E/AndroidRuntime(1722): at java.lang.reflect.Method.invoke(Method.java:511)
03-11 01:39:36.562: E/AndroidRuntime(1722): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-11 01:39:36.562: E/AndroidRuntime(1722): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-11 01:39:36.562: E/AndroidRuntime(1722): at dalvik.system.NativeStart.main(Native Method)
03-11 01:39:36.562: E/AndroidRuntime(1722): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView
03-11 01:39:36.562: E/AndroidRuntime(1722): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:379)
03-11 01:39:36.562: E/AndroidRuntime(1722): ... 35 more
03-11 01:39:36.682: D/dalvikvm(1722): GC_CONCURRENT freed 188K, 4% free 6367K/6596K, paused 90ms+4ms, total 255ms
03-11 01:39:40.702: I/Process(1722): Sending signal. PID: 1722 SIG: 9
03-11 01:39:41.192: E/Trace(1747): error opening trace file: No such file or directory (2)
03-11 01:39:41.992: D/libEGL(1747): loaded /system/lib/egl/libEGL_emulation.so
03-11 01:39:42.092: D/(1747): HostConnection::get() New Host Connection established 0x556a6180, tid 1747
03-11 01:39:42.376: D/libEGL(1747): loaded /system/lib/egl/libGLESv1_CM_emulation.so
03-11 01:39:42.394: D/libEGL(1747): loaded /system/lib/egl/libGLESv2_emulation.so
03-11 01:39:42.674: W/EGL_emulation(1747): eglSurfaceAttrib not implemented
03-11 01:39:43.465: D/OpenGLRenderer(1747): Enabling debug mode 0
I suspect the problem to be in the line:
list = new ArrayAdapter<String>(this,R.layout.settings,items);
please try to replace R.layout.settings with android.R.layout.simple_spinner_item
second parameter is a resource identifier, that should point to the TextView with id="#android/text1"(that is what Android expects)
android.R.layout.simple_spinner_item corresponds to predefined TextView layout, that is located in the SDK folder(try to look into the folder, where SDK is installed: <SDK_FOLDER>/platforms/<select_any_platform_by_api_level>/data/res/layout/simple_spinner_item.xml, there are some pretty nice predefined layouts, that should help you understand the logic)
Since ArrayAdapter requires a TextView, as the exception says, you have two options:
Change R.layout.settings to android.R.layout.simple_spinner_item.
Create your own Adapter subclass which inflates your custom layout.
I integrated ActionBarSherlock into my Android application. It is mostly working well, with one serious exception...
When running specifically on API Level 10 (which corresponds to Android 2.3.3), and only on that version, a StackOverflowError (shown below) is happening at a certain point when the user navigates between two particular activities. The call stack reveals that this error happens entirely within the Android framework, independent of my custom code.
The only reason I know it is related to ActionBarSherlock is that the error doesn't happen if I revert my changes to the activity classes so that they again inherit from the standard Activity base class instead of SherlockActivity, and revert to a non-Sherlock theme.
FATAL EXCEPTION: main
java.lang.StackOverflowError
at com.android.internal.util.ArrayUtils.emptyArray(ArrayUtils.java:107)
at android.text.SpannableStringInternal.getSpans(SpannableStringInternal.java:269)
at android.text.SpannedString.getSpans(SpannedString.java:25)
at android.text.Styled.drawUniformRun(Styled.java:67)
at android.text.Styled.drawDirectionalRun(Styled.java:322)
at android.text.Styled.drawText(Styled.java:381)
at android.text.Layout.drawText(Layout.java:1703)
at android.text.Layout.draw(Layout.java:505)
at android.text.BoringLayout.draw(BoringLayout.java:365)
at android.widget.TextView.onDraw(TextView.java:4431)
at android.view.View.draw(View.java:6880)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.widget.ScrollView.draw(ScrollView.java:1703)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.buildDrawingCache(View.java:6640)
at android.view.View.getDrawingCache(View.java:6428)
at android.view.ViewGroup.drawChild(ViewGroup.java:1571)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1921)
at android.view.ViewRoot.draw(ViewRoot.java:1526)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1262)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1863)
I just encountered a similar error when invalidateOptionsMenu() was being called twice in very quick succession (in onResume, and then in onPrepareOptionsMenu).
Once I removed the invalidateOptionsMenu() calls from onPrepareOptionsMenu, the issue went away. Maybe this isn't what's happening in your situation, but just thought I'd offer it as a possible solution.
The UI thread stack size on Android 2.x is smaller than Android 4.x. This means older versions are more prone to StackOverflowErrors. This explains why you only experience this on an older version.
The problem with ABS is that it automatically adds a few nested views to your layout (the main layout which holds the action bar). You can see these extra views by using Hierarchy Viewer.
If you already had a deep layout with many nested views, adding ABS probably added the extra views that filled up your stack.
What I suggest is that you simplify your layout and remove some of your extra views. There are a few tips on how to optimize layouts in the Android Developer Blog (by Romain Guy). If you save about 2-3 views, it should compensate on what ABS added and you should be fine.
I m getting this error while trying to establish a https connection...
03-11 11:59:39.151: WARN/System.err(4057): javax.net.ssl.SSLException: Not trusted server certificate
03-11 11:59:39.222: WARN/System.err(4057): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:371)
03-11 11:59:39.232: WARN/System.err(4057): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:92)
03-11 11:59:39.232: WARN/System.err(4057): at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381)
03-11 11:59:39.241: WARN/System.err(4057): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:164)
03-11 11:59:39.261: WARN/System.err(4057): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
03-11 11:59:39.261: WARN/System.err(4057): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
03-11 11:59:39.270: WARN/System.err(4057): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
03-11 11:59:39.270: WARN/System.err(4057): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
03-11 11:59:39.282: WARN/System.err(4057): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
03-11 11:59:39.282: WARN/System.err(4057): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
03-11 11:59:39.282: WARN/System.err(4057): at com.infy.pdf.MyAccount$3.onDownloadStart(MyAccount.java:82)
03-11 11:59:39.282: WARN/System.err(4057): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:387)
03-11 11:59:39.282: WARN/System.err(4057): at android.os.Handler.dispatchMessage(Handler.java:99)
03-11 11:59:39.282: WARN/System.err(4057): at android.os.Looper.loop(Looper.java:123)
03-11 11:59:39.282: WARN/System.err(4057): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-11 11:59:39.282: WARN/System.err(4057): at java.lang.reflect.Method.invokeNative(Native Method)
03-11 11:59:39.462: DEBUG/NativeCrypto(4057): Freeing OpenSSL session
03-11 11:59:39.472: DEBUG/dalvikvm(4057): GC_FOR_MALLOC freed 12447 objects / 621928 bytes in 184ms
03-11 11:59:39.491: WARN/System.err(4057): at java.lang.reflect.Method.invoke(Method.java:521)
03-11 11:59:39.491: WARN/System.err(4057): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-11 11:59:39.501: WARN/System.err(4057): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-11 11:59:39.501: WARN/System.err(4057): at dalvik.system.NativeStart.main(Native Method)
03-11 11:59:39.520: WARN/System.err(4057): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
03-11 11:59:39.520: WARN/System.err(4057): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:168)
03-11 11:59:39.532: WARN/System.err(4057): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:366)
03-11 11:59:39.540: WARN/System.err(4057): ... 19 more
03-11 11:59:39.540: WARN/System.err(4057): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
03-11 11:59:39.631: WARN/System.err(4057): at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:149)
03-11 11:59:39.631: WARN/System.err(4057): at java.security.cert.CertPathValidator.validate(CertPathValidator.java:202)
03-11 11:59:39.631: WARN/System.err(4057): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:164)
Does anybody have any idea how to tackle this error..
Probably self signed key problem.
Https Connection Android
Self-signed SSL acceptance on Android