I'm trying to add an external jar library to my Android project. It compiles and downloads to my device correctly but I'm getting the following logcat:
04-11 08:17:16.849: E/AndroidRuntime(16053): FATAL EXCEPTION: main
04-11 08:17:16.849: E/AndroidRuntime(16053): java.lang.NoClassDefFoundError: org.puredata.android.service.R$raw
04-11 08:17:16.849: E/AndroidRuntime(16053): at org.puredata.android.service.PdService.onCreate(PdService.java:184)
04-11 08:17:16.849: E/AndroidRuntime(16053): at android.app.ActivityThread.handleCreateService(ActivityThread.java:1951)
04-11 08:17:16.849: E/AndroidRuntime(16053): at android.app.ActivityThread.access$2500(ActivityThread.java:117)
04-11 08:17:16.849: E/AndroidRuntime(16053): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985)
04-11 08:17:16.849: E/AndroidRuntime(16053): at android.os.Handler.dispatchMessage(Handler.java:99)
04-11 08:17:16.849: E/AndroidRuntime(16053): at android.os.Looper.loop(Looper.java:130)
The problem seems to be that the R class isn't included in the library compilation. Through this question I arrived here where this confusing text states
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.
This means that library projects cannot import the R class from another library project they depend on. This is not necessary anyway, as their own R class includes all the necessary resources. Note that app projects can still import the R classes from referenced Library Projects, but again, this is not needed as their own R classes include all the resources
So, I'm kind of stuck. How do I/Can I force a library to include its needed resources? If not, how can I use the R class in a library which I want to make available without sharing my project code?