E/TextView﹕ get resource from application failed

249 views
Skip to first unread message

ales

unread,
May 28, 2015, 10:40:47 AM5/28/15
to mac...@googlegroups.com
Hi,
I have encountered weird error. My applications works fine on Android 4.0.1, but the same application on Android 4.4.2 throws following error:

05-28 16:30:22.478    7667-7667/com.example.myapp E/TextView get resource from application failed.
05-28 16:30:22.478    7667-7667/com.example.myapp W/System.err android.content.pm.PackageManager$NameNotFoundException:
05-28 16:30:22.480    7667-7667/com.example.myapp W/System.err at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:227)
05-28 16:30:22.481    7667-7667/com.example.myapp W/System.err at android.app.ApplicationPackageManager.getResourcesForApplication(ApplicationPackageManager.java:786)
05-28 16:30:22.482    7667-7667/com.example.myapp W/System.err at android.widget.TextView.<init>(TextView.java:1309)
05-28 16:30:22.483    7667-7667/com.example.myapp W/System.err at android.widget.TextView.<init>(TextView.java:646)
05-28 16:30:22.483    7667-7667/com.example.myapp W/System.err at android.widget.TextView.<init>(TextView.java:642)
05-28 16:30:22.484    7667-7667/com.example.myapp W/System.err at com.example.myapp.MainActivity$$anonfun$1.apply(MainActivity.scala:16)

there is this code on line 16:

w[TextView] <~ text("hi")

exactly the isolated code looks like:

package com.example.myapp

import android.app.Activity
import macroid.Contexts
import android.os.Bundle

import macroid.FullDsl._
import android.widget.TextView
import macroid.contrib.Layouts.VerticalLinearLayout

class MainActivity extends Activity with Contexts[Activity]{

   
override def onCreate(savedInstanceState: Bundle) = {
     
super.onCreate(savedInstanceState)
      val lay
= l[VerticalLinearLayout](
         w
[TextView] <~ text("hi")
     
)
      setContentView
(getUi(lay))
   
}
}

The application displays the TextView properly. In real application similar code is used in DataSetAdapter and ListView. The list is displayed properly but listing is not smooth and after some time whole app hangs. On 4.0.1 no exceptions are raised and the listing is smooth, on 4.4.2 the errors are raised.

Do you have any idea, what could be the problem?

Thank you for any hints.
Ales


ales

unread,
May 30, 2015, 12:03:36 AM5/30/15
to mac...@googlegroups.com
Another hint: I have tried the same application to run on emulator 4.4.2 with no errors. Is seems that this problem could be dependent on the phone. Very strange. Does anybody any idea, please?
Ales

Nick Stanchenko

unread,
Jun 1, 2015, 6:46:41 AM6/1/15
to mac...@googlegroups.com, kahane...@gmail.com
Hey,

I’m afraid I haven’t seen this issue before. Could you try to debug this by trying out these things?
  • w[TextView] <~ text("hi": String)
  • w[TextView] <~ Tweak[TextView](_.setText("hi"))
Nick

ales

unread,
Jun 1, 2015, 8:30:18 AM6/1/15
to mac...@googlegroups.com, kahane...@gmail.com
It seems, that it is not macroid issue anymore.  I have created the most simplest app ever: only one TextView and only in Java and the error has been raised again (only on one phone). After some investigating I realized that it is caused by the fact, that the TextView component calls ApplicationPackageManager.getResourcesForApplication("") - yes there is an empty string in the parameter! I do not have the original sources for the TextView component. In the plain Android there is no executable command on the line 1309 (see above), so I think the manufacturer of this phone (THL 4400) somewhat could modify TextView.java... :-(

Nick Stanchenko

unread,
Jun 1, 2015, 8:33:54 AM6/1/15
to mac...@googlegroups.com
Alas! Some manufacturers really like to do this sort of thing...
> --
> You received this message because you are subscribed to the Google
> Groups "macroid" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to macroid+u...@googlegroups.com
> <mailto:macroid+u...@googlegroups.com>.
> To post to this group, send email to mac...@googlegroups.com
> <mailto:mac...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/macroid.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/macroid/ae1727da-b781-4622-9c09-a9d96ca0a825%40googlegroups.com
> <https://groups.google.com/d/msgid/macroid/ae1727da-b781-4622-9c09-a9d96ca0a825%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages