Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: android.content.res.Resources$NotFoundException in 3rd party SDK


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 8 - Last Post: Oct 24, 2017 2:51 AM Last Post By: Markus Humm
Markus Humm

Posts: 24
Registered: 12/17/09
android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 20, 2017 8:03 AM
Hello,

I'm still trying to get that Teamviewer SDK working:

https://integrate.teamviewer.com/de/develop/screen-sharing-sdk/android-tutorial/
https://integrate.teamviewer.com/en/develop/screen-sharing-sdk/android-sdk-reference/

At some point wone needs to build a session which is being done via some class method call.
(TJTVSessionFactory.JavaClass.createTVSession)

This call gets the activity passed (TAndroidHelper.Activity), some key as JString and an
implementation of the JTVSessionCreationCallback interface.

Now when making that call I get the following exception:

Exception of class EJNIException with message 'android.content.res.Resources$NotFoundException:
Resource ID #0x7f05000c type #0x3 is not valid' occured.

The call stack of the java exception caught in logcat is this one:

android.content.res.Resources$NotFoundException: Resource ID #0x7f05000c type #0x3 is not valid
at android.content.res.Resources.getDimensionPixelOffset(Resources.java:640)
at com.teamviewer.sdk.screensharing.internal.gui.widget.d.<init>(SourceFile:48)
at com.teamviewer.sdk.screensharing.internal.c.a(SourceFile:365)
at com.teamviewer.sdk.screensharing.internal.c.a(SourceFile:147)
at com.teamviewer.sdk.screensharing.api.TVSessionFactory.createTVSession(SourceFile:56)

I omited the timestamp and some prefix indicating that it's an error entry.

That resource ID does exist in the generated r.java file, and when I look at values.xml in the res\values
subfolder of that SDK I see it declared as <dimen name="tv_session_overlay_hitbox_offset_x">14dp</dimen>

In the R.java file it's declared as:

public static final class dimen {
[..]
public static final int tv_session_overlay_hitbox_offset_x=0x7f05000c
[..]
}

Now one final thing: to even get at that point we had to change the package name in AndroidManifest.xml
of that SDK from com.teanviewer to com.teanviewer.sdk.screensharing, as otherwise the generated output
of the r.java file would have been placed at the wrong place and would not have been found at runtime.
This is a bit sucpicious to me, wouldn't that mean that a java developer would have to do the same?

But otherwise how to find out more about that ressource issue? It really blocks.

Greetings

Markus
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 20, 2017 12:50 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

Now when making that call I get the following exception:

Exception of class EJNIException with message 'android.content.res.Resources$NotFoundException:
Resource ID #0x7f05000c type #0x3 is not valid' occured.

The call stack of the java exception caught in logcat is this one:

android.content.res.Resources$NotFoundException: Resource ID #0x7f05000c type #0x3 is not valid
at android.content.res.Resources.getDimensionPixelOffset(Resources.java:640)
at com.teamviewer.sdk.screensharing.internal.gui.widget.d.<init>(SourceFile:48)
at com.teamviewer.sdk.screensharing.internal.c.a(SourceFile:365)
at com.teamviewer.sdk.screensharing.internal.c.a(SourceFile:147)
at com.teamviewer.sdk.screensharing.api.TVSessionFactory.createTVSession(SourceFile:56)

I omited the timestamp and some prefix indicating that it's an error entry.

That resource ID does exist in the generated r.java file, and when I look at values.xml in the res\values
subfolder of that SDK I see it declared as <dimen name="tv_session_overlay_hitbox_offset_x">14dp</dimen>

You may need to extract the resources and deploy them with your application, similar to steps 4 and 7 here:

http://delphiworlds.com/2017/05/add-firebase-cloud-messaging-mobile-apps-part-1/

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 21, 2017 12:47 AM   in response to: Dave Nottage in response to: Dave Nottage
Am 20.10.2017 um 21:50 schrieb Dave Nottage (TeamB):
Markus Humm wrote:

Now when making that call I get the following exception:

Exception of class EJNIException with message 'android.content.res.Resources$NotFoundException:
Resource ID #0x7f05000c type #0x3 is not valid' occured.

The call stack of the java exception caught in logcat is this one:

android.content.res.Resources$NotFoundException: Resource ID #0x7f05000c type #0x3 is not valid
at android.content.res.Resources.getDimensionPixelOffset(Resources.java:640)
at com.teamviewer.sdk.screensharing.internal.gui.widget.d.<init>(SourceFile:48)
at com.teamviewer.sdk.screensharing.internal.c.a(SourceFile:365)
at com.teamviewer.sdk.screensharing.internal.c.a(SourceFile:147)
at com.teamviewer.sdk.screensharing.api.TVSessionFactory.createTVSession(SourceFile:56)

I omited the timestamp and some prefix indicating that it's an error entry.

That resource ID does exist in the generated r.java file, and when I look at values.xml in the res\values
subfolder of that SDK I see it declared as <dimen name="tv_session_overlay_hitbox_offset_x">14dp</dimen>

You may need to extract the resources and deploy them with your application, similar to steps 4 and 7 here:

http://delphiworlds.com/2017/05/add-firebase-cloud-messaging-mobile-apps-part-1/

Hello,

I'll look at it, but I already followed such a tutorial (the griijy one
about Facebook API integration) and did add all those ressources.

The exception isn't talking about a missing ressource but a wrong type.
So I wonder what got mixed up and how to fix that.

Greetings

Markus
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 21, 2017 8:19 AM   in response to: Dave Nottage in response to: Dave Nottage
One additional thing: the values.xml which contains that
<dimen name="tv_session_overlay_hitbox_offset_x">14dp</dimen>
declaration is not included in the generated apk file, wven if it is
listed in Delphi's deployment manager and in the output tab in the IDE
there is text about copying that file.

Not sure if that's important or not. Other ressources are in the apk.

Greetings

Markus

Am 20.10.2017 um 21:50 schrieb Dave Nottage (TeamB):
Markus Humm wrote:

Now when making that call I get the following exception:

Exception of class EJNIException with message 'android.content.res.Resources$NotFoundException:
Resource ID #0x7f05000c type #0x3 is not valid' occured.

The call stack of the java exception caught in logcat is this one:

android.content.res.Resources$NotFoundException: Resource ID #0x7f05000c type #0x3 is not valid
at android.content.res.Resources.getDimensionPixelOffset(Resources.java:640)
at com.teamviewer.sdk.screensharing.internal.gui.widget.d.<init>(SourceFile:48)
at com.teamviewer.sdk.screensharing.internal.c.a(SourceFile:365)
at com.teamviewer.sdk.screensharing.internal.c.a(SourceFile:147)
at com.teamviewer.sdk.screensharing.api.TVSessionFactory.createTVSession(SourceFile:56)

I omited the timestamp and some prefix indicating that it's an error entry.

That resource ID does exist in the generated r.java file, and when I look at values.xml in the res\values
subfolder of that SDK I see it declared as <dimen name="tv_session_overlay_hitbox_offset_x">14dp</dimen>

You may need to extract the resources and deploy them with your application, similar to steps 4 and 7 here:

http://delphiworlds.com/2017/05/add-firebase-cloud-messaging-mobile-apps-part-1/
Markus Humm

Posts: 24
Registered: 12/17/09
Re: android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 23, 2017 1:37 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:

You may need to extract the resources and deploy them with your application, similar to steps 4 and 7 here:

http://delphiworlds.com/2017/05/add-firebase-cloud-messaging-mobile-apps-part-1/

Hello,

I’ve one new finding. I used command line to create text file lists containing a list of all the resource files.
I created 3 files, one for the resources in the TeamViewerSDK\res subfolder, one for the resources in Delphi’s
Android\debug output folder and one for those contained in the unzipped APK.

Guess what I found?
The debug folder generated by Delphi contains a few more subdirectories and files in comparison with
the SDK one, but that’s e.g. Delphi adding some splash screen etc.

All the files from res\values from the debug output folder are missing in the unzipped apk!
This includes values\values.xml as well as all the language and the resolution category dependent subfolders
e.g. values-de\values-de.xml and values-hdpi\values-hdpi.xml

Now the question is: is this to be expected or why does it happen otherwise and if it’s abnormal how to fix it.
These files are properly listed in deployment manager. So am I up to something?

Greetings

Markus
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 23, 2017 12:40 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

These files are properly listed in deployment manager.

Define "properly" :-)

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 23, 2017 1:01 PM   in response to: Dave Nottage in response to: Dave Nottage
Am 23.10.2017 um 21:40 schrieb Dave Nottage (TeamB):
Markus Humm wrote:

These files are properly listed in deployment manager.

Define "properly" :-)

They point to the right local file and the reote path looks good either.
ANd when I look at the output panel after compiling/building I get soem
entry for this file as well claiming it has been copied. But obviously
that is only the copy from the TeamViewer SDK subfolder in my project to
the Android/debug ... subfilder which is then used to generate nthe apk
file.

Any clues? (more details on what deployment manager shows tomorrow when
I'm back at work)

Greetings

Markus
Markus Humm

Posts: 24
Registered: 12/17/09
Re: android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 24, 2017 12:05 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
Markus Humm wrote:

These files are properly listed in deployment manager.

Define "properly" :-)

Ok, here's what is listed in deploymant manager for that values.xml file:

Local path: TeamViewerSDK\res\values
Local name: values.xml
Type: file
Configuration: debug
Platforms: [Android]
Remote-path: res\values
Remote-name: values.xml

Another thing: while searching the internet for similiar issues I had seen some other SDK
which had been used in some Delphi app and that one has had multiple <activity> entries
in AndroidManifest.template.xml listed. Since it looks like that TeamViewer SDK wants
to create some UI, could it be that such a thing will be required? If yes, what do I need
to know to be able to add this to the manifest?

Greetings

Markus
Markus Humm

Posts: 24
Registered: 12/17/09
Re: android.content.res.Resources$NotFoundException in 3rd party SDK  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 24, 2017 2:51 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
Markus Humm wrote:

These files are properly listed in deployment manager.

Define "properly" :-)

Another research result:
when dumping the ressources of the apk via aapt one can find out, that the magic number
listed in the exception and associated with that strange type 03 is something entirely else in
that dum. In r.java a that 0x7f05000c points to something which in the dump is refered to with
a number of 0x7f06000c, so these numbers mismatch.

But why do they mismatch and how to get them to match each other? Because the 0x7f06000c
in the resources dump has a more sensible datatype.

Greetings

Markus
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02