Moving app from ADT 20 to ADT 21 causes java.lang.NoSuchFieldError

Showing 1-5 of 5 messages
Moving app from ADT 20 to ADT 21 causes java.lang.NoSuchFieldError Henrique Sousa 12/6/12 4:36 AM
Good morning everyone,

While performing a installation of the ADT bundle (Eclipse ADT + SDK) on a new machine, I found out that my project started crashing with java.lang.NoSuchFieldError exception on a R resource.

On my previous machine with Motodev 4.1 + ADT 20, everything works just perfect. I cannot, for the love of God, figure out out the solve the issue, and due to IP I cannot paste here much code and logs:

12-06 12:02:09.590: E/ACRA(5785): ****APPNAME**** fatal error : com.other.package.R$string.srv_geo_areas_short_get
12-06 12:02:09.590: E/ACRA(5785): java.lang.NoSuchFieldError: com.other.package.R$string.srv_geo_areas_short_get

If I compile and run the apk generated with ADT 20, everything works just fine.

I thank you in advance for any help/pointers in solving this issue.
Thanks again.

Best regards,
Henrique Sousa
Re: Moving app from ADT 20 to ADT 21 causes java.lang.NoSuchFieldError Adam Vollmer 12/6/12 8:18 AM
This may be related to my problem, where a library resource depends on a library resource, and ends up with the resource moving which R file it belongs to in the application. The solution for me was to rename all of the affected library project package names to the application package name, but that may not be suitable for you.
Re: Moving app from ADT 20 to ADT 21 causes java.lang.NoSuchFieldError Xavier Ducrohet 12/6/12 10:03 AM
As Adam indicates in his reply, this may be due to shared package name
in different libraries.
We have a 21.0.1 going to through final testing that will fix this
issue (by supporting it when it can, and stopping the build when it
cannot).

In the mean time, check your library package names and change them if
this applies to you. If not we'll have to investigate further.

On Thu, Dec 6, 2012 at 4:36 AM, Henrique Sousa
<henrique.so...@gmail.com> wrote:
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!
Re: Moving app from ADT 20 to ADT 21 causes java.lang.NoSuchFieldError Henrique Sousa 12/7/12 5:14 AM
Turned out you were right, we had two libraries with the same package name in both of them.

However I renamed both packages to distinct names and cleaned all projects, but the problem remained.

We'll wait for a fix then. If you need more info, I'll gladly help in any way you'll need. I've attached a picture of the offending R.string.

Thanks again for your effort.
My best regards,
Henrique Sousa
Re: Moving app from ADT 20 to ADT 21 causes java.lang.NoSuchFieldError Harshad RJ 12/29/12 11:11 AM
This is affecting me as well. And I don't have common package names between library and app.

I have a library project in which I store common resources, and my apps depend on this library project to provide resources. This used to work fine until ADT 21, but now, because of the optimisation of R class I think, the app builds fail.

Is there a way to prevent ADT from optimising fields in the R class?