NoClassDefFoundError R$string

1,280 views
Skip to first unread message

Bill Wolfe

unread,
Apr 23, 2012, 3:47:46 PM4/23/12
to andro...@googlegroups.com
I have a project that uses a library (base) project. I am able to get it to compile in AIDE, but on runtime I get an exception:

java.lang.NoClassDefFoundError: com.me.android.MyBaseLibrary.R$string

at MyBaseLibrary .onCreate(SnapShotRoulette.java)
at MyApp.onCreate(SnapShotRouletteFree.java)
...

It would seem as if the R class is not being generated properly, to retrieve data that I store in my string.xml resource file of the library project. Anyone have any ideas why this might be happening? When I use the version compiled on my desktop, this error does not happen.

Hans Kratz

unread,
Apr 25, 2012, 9:50:01 AM4/25/12
to andro...@googlegroups.com
Can't reproduce this here. Can you send us
(ide4a...@googlemail.com) a testcase with which we can reproduce
this issue?

> --
> AIDE - Android Java IDE mailing list
> andro...@googlegroups.com
> http://groups.google.com/group/android-ide?hl=en

--
Hans Kratz
AIDE Team

alexa...@gmail.com

unread,
May 7, 2012, 11:06:55 AM5/7/12
to andro...@googlegroups.com
I am not the author but I have the same issue. Mine is with R.array.

I have a library project with a values/array file with arrays. In my "main" project that references the library project I do NOT have a values/array file.

Both projects compile but the "main" project gives a runtime exception with an error like OP:
java.lang.NoClassDefFoundError: [namespace].R$array 

In logcat right before I see some lines with:
"VFY: unable to resolve static field xxxx (name) in L[namespace]/R$array"

The (name) matches the R.array.name that is accessed where the runtime error points to.

Derf Shaya

unread,
Jun 6, 2012, 11:41:54 PM6/6/12
to andro...@googlegroups.com
Sorry to hop in, but I have what I believe to be the same issue. NoClassDefFoundError for [library project namespace].R&styleable
Let me try running aapt on the library projects again and see if this happens.

Nebojsa Cvetkovic

unread,
Aug 5, 2012, 5:05:22 PM8/5/12
to andro...@googlegroups.com
Exact same issue here with ActionBarSherlock, seems that some parts of the libs are not included in the final apk.

XWang

unread,
Aug 9, 2012, 1:06:42 AM8/9/12
to andro...@googlegroups.com
I have the same issue. Can't find resources in library project.

Xiaodong Wang

unread,
Sep 26, 2012, 10:27:44 AM9/26/12
to andro...@googlegroups.com

Wish this issue can be resolved soon, since most of my projects has a lib project. So they cannot run.
Thanks.

在 2012-9-26 下午3:00, <crypt...@gmail.com>写道:
I've been running into this issue myself when inheriting from styles defined within actionbarsherlock.

Any info on if this is being looked into or suggestions for a workaround?
--

Bill Wolfe

unread,
Jan 22, 2013, 5:05:22 PM1/22/13
to andro...@googlegroups.com
I'm still getting this issue with actionbarsherlock. I will try to create a base example of the issue tonight and send it on over.

Frederick Brier

unread,
Mar 5, 2015, 12:26:46 AM3/5/15
to andro...@googlegroups.com
I've recently been struggling with this problem.  I thought it was related to the .aar libraries, but these posts predate the .aar library format, no?  No one ever posted a solution to this error.  Could someone who has solved this problem, please post the solution?  Thank you.

Paul Bizannes

unread,
Apr 21, 2015, 7:58:54 PM4/21/15
to andro...@googlegroups.com
I had a similar problem, and I found a solution.

Include the multi-dex libraries as per this post:

Reply all
Reply to author
Forward
0 new messages