android.content.res.Resources$NotFoundException

Hi there,

I’m currently converting an Android Library to a Unity plugin.
I got a long way already, but now I’m stuck on the point where the resources of the Library cannot be accessed from Unity.

Here’s the error log I’m getting:

12-12 13:37:36.495: W/ResourceType(32155): getEntry failing because entryIndex 1 is beyond type entryCount 1
12-12 13:37:36.495: W/ResourceType(32155): Failure getting entry for 0x7f030001 (t=2 e=1) in package 0 (error -2147483647)
12-12 13:37:36.500: D/AndroidRuntime(32155): Shutting down VM
12-12 13:37:36.500: W/dalvikvm(32155): threadid=1: thread exiting with uncaught exception (group=0x4109a2a0)
12-12 13:37:36.505: E/AndroidRuntime(32155): FATAL EXCEPTION: main
12-12 13:37:36.505: E/AndroidRuntime(32155): android.content.res.Resources$NotFoundException: Resource ID #0x7f030001
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.content.res.Resources.getValue(Resources.java:1026)
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2131)
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.content.res.Resources.getLayout(Resources.java:865)
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-12 13:37:36.505: E/AndroidRuntime(32155): at com.mycompany.mylibrary.components.AndroidWebViewDialog.(AndroidWebViewDialog.java:140)
12-12 13:37:36.505: E/AndroidRuntime(32155): at com.mycompany.mylibrary.FunctionAndroidLibrary.ShowDialog(FunctionAndroidLibrary.java:163)
12-12 13:37:36.505: E/AndroidRuntime(32155): at com.mycompany.mylibrary.FunctionAndroidLibrary.buttonREGISTER(FunctionAndroidLibrary.java:94)
12-12 13:37:36.505: E/AndroidRuntime(32155): at com.mycompany.myUnityProjectAndroidLibraryTest$1.run(AndroidLibraryTest.java:78)
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.os.Handler.handleCallback(Handler.java:615)
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.os.Handler.dispatchMessage(Handler.java:92)
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.os.Looper.loop(Looper.java:137)
12-12 13:37:36.505: E/AndroidRuntime(32155): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-12 13:37:36.505: E/AndroidRuntime(32155): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 13:37:36.505: E/AndroidRuntime(32155): at java.lang.reflect.Method.invoke(Method.java:511)
12-12 13:37:36.505: E/AndroidRuntime(32155): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-12 13:37:36.505: E/AndroidRuntime(32155): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-12 13:37:36.505: E/AndroidRuntime(32155): at dalvik.system.NativeStart.main(Native Method)

  • These resources are fysically present in the library .jar file.
  • setContentView() is disabled from the Unity Android project

Anyone who can help out?
Thank you in advance!

Best regards,
Henri

I think I found the problem here:
http://tools.android.com/recent/dealingwithdependenciesinandroidprojects

Important change: We have changed the way Library Projects generate and package R classes:
The R class is not packaged in the jar output of Library Projects anymore.
Library Project do not generate the R class for Library Projects they depend on. Only main application projects generates the Library R classes alongside their own.

Does anyone know what is the best solution to solve this in combination with Unity3D?

Resource not found exception coming on launch in android build
I have an xyz android project and some android lib projects linked to it. I am using all these as plugins in my unity project. I have copied the lib projects whole in toAssets/plugins/Android/ folder. Copied res, assets and android manifest of the xyz android project along with the jar(containing src folder and InAppBillingService java file) in to there. When I am making a split binary through Unity and installing on the device, its giving me following error:-

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aquimo.collegebb/com.aquimo.collegebb.UnityPlayerNativeActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030015 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2088) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2113) at android.app.ActivityThread.access$700(ActivityThread.java:139)

PS: in Temp/StagingArea/res/ folder I could not find the layout folder after build was made. Neither the R.java in Temp/StagingArea/gen/ folder contains the ids for layouts missing.

Game view

Add this line to your strings.xml file

3 Likes