清理项目后,logcat发生以下错误。项目运行正常,之前没有发现类似的错误。我需要帮助来解决此问题。以下是logcat错误。该代码使用Kotlin语言编写,并且似乎在onBindViewHolder中存在错误。
08-02 12:52:41.370 16984-16984/? E/libprocessgroup: failed to make and chown /acct/uid_10058: Read-only file system
08-02 12:53:10.883 16984-16984/com.malik_tayyab.testapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.malik_tayyab.testapp, PID: 16984
java.lang.IllegalArgumentException: Path must not be empty.
at com.squareup.picasso.Picasso.load(Picasso.java:297)
at com.maliktayyab.testapp.Newsfeedholder.bind(Newsfeedholder.kt:15)
at com.maliktayyab.testapp.FragmentNewsfeed.onBindViewHolder(FragmentNewsfeed.kt:48)
at com.maliktayyab.testapp.FragmentNewsfeed.onBindViewHolder(FragmentNewsfeed.kt:21)
at com.mobymagic.easyfirebaselist.database.FirebaseDbAdapter.onBindViewHolder(FirebaseDbAdapter.kt:22)
at com.firebase.ui.database.FirebaseRecyclerAdapter.onBindViewHolder(FirebaseRecyclerAdapter.java:118)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6482)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6515)
at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5458)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5724)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5563)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5559)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2229)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1556)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1516)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:608)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3693)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3410)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3962)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1767)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:443)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
at an
我的Newsfeed Holder类在logcat中。
class Newsfeedholder(view:View):RecyclerView.ViewHolder(view) {
fun bind(model : News)}
itemView.NewsTitleTextView.text = model.title
Picasso.with(itemView.context).load(model.thumbnail).into(itemView.NewsThumbnailImageView)
}
}
我的FragmentNewsfeed firebasefragment类。
class FragmentNewsfeed : FirebaseDbListFragment<News,Newsfeedholder>() {
override fun getDataClass(): Class<News> {
return News::class.java
}
override fun getEmptyStyle(): EmptyStyle {
return EmptyStyle(R.mipmap.ic_launcher, "No News in database yet")
}
override fun getErrorStyle(error: DatabaseError): ErrorStyle {
return ErrorStyle(R.mipmap.ic_launcher, "An Error occurred while fetching news")
}
override fun getProgressStyle(): ProgressStyle {
return ProgressStyle(progressMessage = "Loading....")
}
override fun getQuery(): Query {
return FirebaseDatabase.getInstance().reference.child("newsfeed").limitToLast(100)
}
override fun onBindViewHolder(viewHolder: Newsfeedholder, key: String, model: News) {
viewHolder.bind(model = model)
}
override fun onCreateViewHolder(inflater: LayoutInflater, viewGroup: ViewGroup): Newsfeedholder {
val new = inflater.inflate(R.layout.newsfeed_fragment, viewGroup, false)
return Newsfeedholder(new)
}
override fun onItemClicked(viewHolder: Newsfeedholder, key: String, model: News) {
FinestWebView.Builder(activity).show(model.link)
}
override fun setupRecyclerView(recyclerView: RecyclerView) {
recyclerView.addItemDecoration(DividerItemDecoration(activity,DividerItemDecoration.VERTICAL))
recyclerView.layoutManager = LinearLayoutManager(activity)
}
}
答案 0 :(得分:1)
您的model.thumbnail
似乎返回了空白。选中此link,可能会对您有所帮助。
答案 1 :(得分:1)
java.lang.IllegalArgumentException:路径不能为空。
您可以看到此错误。您的路径为空,您需要非空路径:model.thumbnail
是一个空字符串。毕加索加载非空路径。
Picasso.with(itemView.context).load(model.thumbnail).into(itemView.NewsThumbnailImageView)