- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个 Android 应用程序,并在其中生成一些 PDF
文件。一旦生成,我就启动一个应用程序的Intent
来显示PDF
(如Acrobat)。
一旦我按返回键返回到我的应用程序,它就会在采用三星修改的正常 Android 5
的 Samsung Galaxy S5
上崩溃并出现以下错误:
11-05 17:04:29.876: E/AndroidRuntime(1515): FATAL EXCEPTION: main
11-05 17:04:29.876: E/AndroidRuntime(1515): Process: (my package), PID: 1515
11-05 17:04:29.876: E/AndroidRuntime(1515): android.content.res.Resources$NotFoundException: File res/layout-v21/adapter_historie.xml from xml type layout resource ID #0x7f04001e
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.content.res.Resources.loadXmlResourceParser(Resources.java:3953)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.content.res.Resources.loadXmlResourceParser(Resources.java:3900)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.content.res.Resources.getLayout(Resources.java:2149)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.LayoutInflater.inflate(LayoutInflater.java:413)
11-05 17:04:29.876: E/AndroidRuntime(1515): at (my package).adapter.HistorienAdapter.onCreateViewHolder(HistorienAdapter.java:52)
11-05 17:04:29.876: E/AndroidRuntime(1515): at (my package).adapter.HistorienAdapter.onCreateViewHolder(HistorienAdapter.java:1)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5223)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4449)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4359)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:2102)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1956)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.onLayout(LinearLayout.java:1865)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:2102)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1956)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.onLayout(LinearLayout.java:1865)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:2102)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1956)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.LinearLayout.onLayout(LinearLayout.java:1865)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.View.layout(View.java:16550)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewGroup.layout(ViewGroup.java:5303)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2312)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2025)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1180)
11-05 17:04:29.876: E/AndroidRuntime(1515): at android.view.ViewRo
或者在带有 Cyanogenmod 12.1
的 Google Nexus 5
上使用此堆栈跟踪:
11-06 19:47:45.871: E/AndroidRuntime(22636): FATAL EXCEPTION: main
11-06 19:47:45.871: E/AndroidRuntime(22636): Process: (my package).vaz, PID: 22636
11-06 19:47:45.871: E/AndroidRuntime(22636): android.content.res.Resources$NotFoundException: File res/layout-v21/adapter_historie.xml from xml type layout resource ID #0x7f04001e
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2843)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2798)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.content.res.Resources.getLayout(Resources.java:1143)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.LayoutInflater.inflate(LayoutInflater.java:412)
11-06 19:47:45.871: E/AndroidRuntime(22636): at (my package).vaz.adapter.HistorienAdapter.onCreateViewHolder(HistorienAdapter.java:51)
11-06 19:47:45.871: E/AndroidRuntime(22636): at (my package).vaz.adapter.HistorienAdapter.onCreateViewHolder(HistorienAdapter.java:1)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5223)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4449)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4359)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.View.layout(View.java:15686)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
11-06 19:47:45.871: E/AndroidRuntime(22636): at android.view.ViewR
(可以找到完整的跟踪 here )
在我的代码的这一部分
public HistorienAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View layout = LayoutInflater.from(parent.getContext())
.inflate(R.layout.adapter_historie, parent, false);
return new ViewHolder(layout);
}
我在 android.app.Fragment
中启动 Intent
,如下所示:
Uri path = Uri.fromFile(file);
Intent viewintent = new Intent(Intent.ACTION_VIEW);
viewintent.setDataAndType(path, "application/pdf");
getActivity().startActivity(viewintent);
最佳答案
我与 Pinguin895 一起开发了该应用程序,并在 Snild Dolkow 的精彩回答后找到了我们问题的解决方案,我们应该 try catch 异常。
我已 try catch “android.content.res.Resources.NotFoundException”并获得此堆栈跟踪,其中包含以下内容:
11-07 09:54:08.912: I/AppCompatDelegate(689): The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's
11-07 09:54:11.581: W/System.err(689): java.lang.RuntimeException: Assetmanager has been closed
11-07 09:54:11.582: W/System.err(689): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:501)
11-07 09:54:11.582: W/System.err(689): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2825)
11-07 09:54:11.582: W/System.err(689): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2798)
11-07 09:54:11.582: W/System.err(689): at android.content.res.Resources.getLayout(Resources.java:1143)
11-07 09:54:11.582: W/System.err(689): at android.view.LayoutInflater.inflate(LayoutInflater.java:412)
11-07 09:54:11.582: W/System.err(689): at (my package).vaz.adapter.HistorienAdapter.onCreateViewHolder(HistorienAdapter.java:53)
11-07 09:54:11.582: W/System.err(689): at (my package).vaz.adapter.HistorienAdapter.onCreateViewHolder(HistorienAdapter.java:1)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5223)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4449)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4359)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
11-07 09:54:11.582: W/System.err(689): at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
11-07 09:54:11.582: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.582: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.582: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.582: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.582: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.582: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.582: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.582: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.582: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.582: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.583: W/System.err(689): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
11-07 09:54:11.583: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.583: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.583: W/System.err(689): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-07 09:54:11.583: W/System.err(689): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-07 09:54:11.583: W/System.err(689): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-07 09:54:11.583: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.583: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.583: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.583: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.583: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.583: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.583: W/System.err(689): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-07 09:54:11.583: W/System.err(689): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-07 09:54:11.583: W/System.err(689): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-07 09:54:11.583: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.583: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.583: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.583: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.583: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.583: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.583: W/System.err(689): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-07 09:54:11.583: W/System.err(689): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-07 09:54:11.584: W/System.err(689): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-07 09:54:11.584: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.584: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.584: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.584: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.584: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.584: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.584: W/System.err(689): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)
11-07 09:54:11.584: W/System.err(689): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)
11-07 09:54:11.584: W/System.err(689): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
11-07 09:54:11.584: W/System.err(689): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5891)
11-07 09:54:11.584: W/System.err(689): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
11-07 09:54:11.584: W/System.err(689): at android.view.Choreographer.doCallbacks(Choreographer.java:580)
11-07 09:54:11.584: W/System.err(689): at android.view.Choreographer.doFrame(Choreographer.java:550)
11-07 09:54:11.584: W/System.err(689): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
11-07 09:54:11.584: W/System.err(689): at android.os.Handler.handleCallback(Handler.java:739)
11-07 09:54:11.584: W/System.err(689): at android.os.Handler.dispatchMessage(Handler.java:95)
11-07 09:54:11.584: W/System.err(689): at android.os.Looper.loop(Looper.java:135)
11-07 09:54:11.584: W/System.err(689): at android.app.ActivityThread.main(ActivityThread.java:5294)
11-07 09:54:11.584: W/System.err(689): at java.lang.reflect.Method.invoke(Native Method)
11-07 09:54:11.584: W/System.err(689): at java.lang.reflect.Method.invoke(Method.java:372)
11-07 09:54:11.584: W/System.err(689): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
11-07 09:54:11.584: W/System.err(689): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
11-07 09:54:11.584: W/System.err(689): android.content.res.Resources$NotFoundException: File res/layout-v21/adapter_historie.xml from xml type layout resource ID #0x7f04001e
11-07 09:54:11.585: W/System.err(689): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2843)
11-07 09:54:11.585: W/System.err(689): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2798)
11-07 09:54:11.585: W/System.err(689): at android.content.res.Resources.getLayout(Resources.java:1143)
11-07 09:54:11.585: W/System.err(689): at android.view.LayoutInflater.inflate(LayoutInflater.java:412)
11-07 09:54:11.585: W/System.err(689): at (my package).vaz.adapter.HistorienAdapter.onCreateViewHolder(HistorienAdapter.java:53)
11-07 09:54:11.585: W/System.err(689): at (my package).vaz.adapter.HistorienAdapter.onCreateViewHolder(HistorienAdapter.java:1)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5223)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4449)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4359)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
11-07 09:54:11.585: W/System.err(689): at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
11-07 09:54:11.585: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.585: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.585: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.585: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.585: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.585: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.585: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.586: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.586: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.586: W/System.err(689): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
11-07 09:54:11.586: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-07 09:54:11.586: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.586: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.586: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.586: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-07 09:54:11.586: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.586: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.586: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.586: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
11-07 09:54:11.586: W/System.err(689): at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
11-07 09:54:11.586: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.586: W/System.err(689): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
11-07 09:54:11.586: W/System.err(689): at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
11-07 09:54:11.586: W/System.err(689): at android.view.View.layout(View.java:15686)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewGroup.layout(ViewGroup.java:5039)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)
11-07 09:54:11.586: W/System.err(689): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)
11-07 09:54:11.587: W/System.err(689): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
11-07 09:54:11.587: W/System.err(689): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5891)
11-07 09:54:11.587: W/System.err(689): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
11-07 09:54:11.587: W/System.err(689): at android.view.Choreographer.doCallbacks(Choreographer.java:580)
11-07 09:54:11.587: W/System.err(689): at android.view.Choreographer.doFrame(Choreographer.java:550)
11-07 09:54:11.587: W/System.err(689): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
11-07 09:54:11.587: W/System.err(689): at android.os.Handler.handleCallback(Handler.java:739)
11-07 09:54:11.587: W/System.err(689): at android.os.Handler.dispatchMessage(Handler.java:95)
11-07 09:54:11.587: W/System.err(689): at android.os.Looper.loop(Looper.java:135)
11-07 09:54:11.587: W/System.err(689): at android.app.ActivityThread.main(ActivityThread.java:5294)
11-07 09:54:11.587: W/System.err(689): at java.lang.reflect.Method.invoke(Native Method)
11-07 09:54:11.587: W/System.err(689): at java.lang.reflect.Method.invoke(Method.java:372)
11-07 09:54:11.587: W/System.err(689): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
11-07 09:54:11.587: W/System.err(689): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
11-07 09:54:11.587: W/System.err(689): Caused by: java.lang.RuntimeException: Assetmanager has been closed
11-07 09:54:11.587: W/System.err(689): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:501)
11-07 09:54:11.587: W/System.err(689): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2825)
11-07 09:54:11.587: W/System.err(689): ... 70 more
经过一些研究,Assetmanager 已被关闭。我发现 assetmanager 不应该关闭,因为 android 应用程序需要它来访问 .apk 中包含的文件(如布局 xml 文件)
在我们的应用程序中,我们使用 assetmanager 选择一个 pdf 文件,该文件位于 apk 内的 asset 文件夹中。输入一些文本后,更改后的 pdf 会保存在 SD 卡上。
try (AssetManager am = context.getAssets();
InputStream is = am.open(vaz.getDatei() + ".pdf");
OutputStream targetOutputStream = new FileOutputStream(file)) {
/*
*[SOME CODE FOR GENERATION AND SAVING]
*/
Uri path = Uri.fromFile(file);
Intent viewintent = new Intent(Intent.ACTION_VIEW);
viewintent.setDataAndType(path, "application/pdf");
getActivity().startActivity(viewintent);
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
我们对 java.lang.AutoCloseable 使用了 try-with-resources从 PDF-Viewer-App 返回后,assetmanger 已关闭,因为 java.lang.AutoCloseable
修复方法是将 assetmanger 置于 try-with-resources 之外:
AssetManager am = context.getAssets();
try (InputStream is = am.open(vaz.getDatei() + ".pdf");
OutputStream targetOutputStream = new FileOutputStream(file)) {
...
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
感谢您的努力 Snild Dolkow!
关于java - 将 Intent 返回到另一个应用程序后出现 ResourceNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33549840/
我正在使用 Spring Boot 并尝试创建一个测试。 实际上我的测试类: @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment=W
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我有以下类(class): public class EmailService { static { Velocity.setProperty("resource.loader
我会自定义抽屉导航。我在另一个线程中使用了在 stackoverflow 上找到的示例。代码是复制粘贴,但是在logcat中运行应用程序时出现异常:“ResourceNotFoundException
我在 Market 上收到了一些关于此异常的报告。没有提到它在我的应用程序中发生的位置,大多数用户没有这个问题。我该如何调试这样的东西?这不是我从所有设备上得到的异常(exception)。只有一个特
我想知道是否有人可以帮助我。我在我的 android 应用程序中收到 ResourceNotFoundException。运行以下代码时发生(异常发生在getString()调用) c
当我尝试在我的 Samsung Note II 上运行我的应用程序时,我收到此行的 ResourceNotFoundException setContentView(R.layout.activity
我有一个Recyclerview。在它的适配器中,这就是我所拥有的: @Override public void onBindViewHolder(@NonNull ViewHolder holde
概要 我通过aws lambda使AWS SAM函数。 此功能需要数据库,因此我选择DynamoDB。 现在,我为AWS SAM和DynamoDB设置本地环境。 看来我成功设置了本地DynamoDB,
我正在尝试基于 scalatra-sbt.g8 的以下内容: class FooWeb extends ScalatraServlet with ScalateSupport { beforeAl
我为 ListView 项创建了一个构造函数DataPembeli,然后创建了自定义 ListView 适配器DataPembeliListAdapter并使用这样的构造函数: txtid.setTe
我这样创建自己的样式属性: 我在我的主题中赋予它这样的值(value): @color/blue 如果我在我的布局中访问它(已设置为 contentView) 它就像一个魅力。但是如果我
当我的 android 应用程序以纵向屏幕启动时,操作栏中有选项菜单;但是当切换到 landspace 时,我发现资源未找到异常。 inflater.inflate(R.menu.main, menu
我已经拥有的: 这是我的 ImageView: 我使用的是 Android 插件版本 2.0: classpath 'com.android.tools.build:gradle:2.0.0' 我在
我最近检查了我的 GP 崩溃日志,我经常收到这个调用堆栈。请你帮助我好吗。 一些事情: 添加资源路径失败有时显示/data/app/com.xxx.xxx.xxx-x/base.apk,有时显示/mn
07-25 10:15:37.960: E/AndroidRuntime(8661): android.content.res.Resources$NotFoundException: String
在基本的 Skobbler 应用程序中,当调用 InitializeSKMaps 时,会抛出 ResourceNotFoundException 并引用“字符串资源 ID #0x0”。为什么会这样?
我有一个自定义 View ,我们将其称为CustomView。在初始化时,我调用了以下方法 textPaint.setTypeface(ResourcesCompat.getFont(getConte
我正在尝试将原始文件夹中的音乐文件设置为在打开 NewActivity 的 ListView 中播放。我已经配置了 Model 类、MainActivity 和 ListviewAdapter,但仍然
我正在开发一个 Android 应用程序,并在其中生成一些 PDF 文件。一旦生成,我就启动一个应用程序的Intent来显示PDF(如Acrobat)。 一旦我按返回键返回到我的应用程序,它就会在采用
我是一名优秀的程序员,十分优秀!