However, if I point the run configuration at the new build and launch the
application I get the error above.
If I rummage around in the Android code, the place where this message is
generated impllies that if the referrer was pre-verified, then the resolved
class must come from the same DEX.
When the library is built and the image put together, I see three related
files generated in "out/target/common/obj/JAVA_LIBRARIES/mylibrary/ - these
being classes.dex, classes.jar and javalib.jar.
I also get a jar file generated in
out/target/product/generic/system/framework/mylibrary.jar
The classes.jar file is the one I reference when developing using the
library as it contains the classes. The other files look like the contain
DEX code.
In therory, the classes.jar file i'm referring to should work with the java
stuff that gets built into the image..so what is it that I am not doing?
Nearly there!
Yes - all those bits are in place - and if I disable a check that happens
in the Android code (around about line 113 in dalvik/vm/oo/Resolve.c - the
line that starts:
if (!fromUnverifiedConstant..) then it all springs into life. With the
check in, the application fails.
The comment in the code implies that if the referrer were pre-verified,
then the resolved class must come from the same DEX code or bootstrap
class. This is causing me some confusion as I beleive that I'm using the
correct components. I'm referencing the generated 'classes.jar' file from
the Android project that is related to the jar file that gets incorporated
into the image (or so I beleive). It may be that I'm still missing a peice
of magic somewhere and perhaps it is down to some pre-processing when the
image is built.
I repeat, if my library is called mylib, and I build it (with its own
makefile) The following entities get created:
- Under out/target/common/obj/JAVA_LIBRARIES/mylib_intermediates
classes.dex
classes.jar
javalib.jar
- Under out/target/product/generic/system/framework/mylib.jar
Of the above files, the classes.jar file contains the '.class' components,
the javalib.jar contains the classes.dex components as does the javalib.jar
file. By pointing the eclipse project at the classes.jar file, the project
happily resolves the references. If I examine what's in the image (using
adb) I can confirm that mylib.jar is indeed under system/framework. All the
files appear to have the same
Thus I'm confused as to why the aforementioned run-time check has failed -
perhaps I'm missing a step that happens when the sdk is built and
android.jar produced?
"Dianne Hackborn"
<hackbod@android.
com> To
Sent by: android-...@googlegroups.com
android-platform@ cc
googlegroups.com
Subject
Re: Class resolved by unexpected
29/11/2008 02:38 DEX error
Please respond to
android-platform@
googlegroups.com
ForwardSourceID:NT00003E3E
Adding your .jar file as an external library means that the Android
plugin for Eclipse will treat this as a 3rd party library, which is to
be included with your application code.
Therefore you will get your library code inside your app, as well as
on the system. I'm not sure what will happen.
There is no support for optional system libraries in the plugin (yet),
and you should use Ant instead.
Just modify the "compile" target to add your library to the classpath.
Xav
Thanks for your input - I'm pretty sure that something like this is
happening. dalvik is 'unexpectedly resolving the class' - the error message
is 'Class resolved by unexpected DEX' (which is what happens) and this
results in an IllegalAccessError exception being thrown.
When a vanilla flavoured android is built (make), then an associated sdk
(make.sdk), the resultant android.jar file can be used in the SDK for
development purposes. Does this mean that both the jar file and the image
contain the android classes? Does the plugin reference android.jar in a
different way to an external library. My question is - why does it work for
android.jar, but not my library - what bit of post-processing am I not
doing?
I'd like to think that a developer could use Eclipse & the plug in to
develop something that used this extended library! t'would seem a shame if
he couldn't.
I don't know much about ant - seems a step backwards from using Eclipse
etc.
Xavier Ducrohet
<x...@google.com>
Sent by: To
android-platform@ android-...@googlegroups.com
googlegroups.com cc
Subject
02/12/2008 00:17 Re: Class resolved by unexpected
Xav
ForwardSourceID:NT00004092
The custom builders provided by the Eclipse plugin treat android.jar
differently. It's used to compile the Java classes, but not used in
the packaging because it's considered a system library.
However, external libraries must be packaged with the apk or the
application would not work, since their code is not already present in
the system image.
We are working on supporting optional system libraries at the plugin
level, but this is not ready yet (we'll add automated support for this
in Ant too.)
In the mean time, because Ant is a script that you can manually change
(as opposed to not being able to change the Eclipse builders), you can
use Ant to build your application the way you need it.
Xav
Thanks again for clarifying that. For now I'll skip the check dalvik makes
so I can use Eclipse (more convenient in the short-term).
Presumably your changes to accomodate this will be a change to the Eclipse
plugin and sounds weeks away rather than months?
Best Regards,
Phil.
Xavier Ducrohet
<x...@google.com>
Sent by: To
android-platform@ android-...@googlegroups.com
googlegroups.com cc
Subject
02/12/2008 19:06 Re: Class resolved by unexpected
Hi Phil,
Xav
ForwardSourceID:NT0000425E
And can you help with this :
>> Do you how to buildup the etc/permissions.xml? Anywhere should i input
>> under the platform?
Thanks!
On Thu, Aug 20, 2009 at 1:22 PM, Dianne Hackborn<hac...@android.com> wrote:
> Could you please post publicly? Thanks.
>
> On Wed, Aug 19, 2009 at 10:02 PM, Richard Meng <meng...@gmail.com> wrote:
>>
>> Hi Dianne,
>>
>> Do you how to buildup the etc/permissions.xml? Anywhere should i input
>> under the platform?
>>
>> Thanks
>> -Richard
>>
>> On Nov 29 2008, 10:38 am, "Dianne Hackborn" <hack...@android.com>
>> wrote:
>> > If you are making a separate shared library, then you need to have it
>> > put in
>> > the system image under its own name, put an entry in etc/permissions.xml
>> > mapping from your library's package name to the path to the .jar file,
>> > and
>> > then any applications using the library must have a <uses-library> tag
>> > in
>> > their manifest to have the library loaded into their class path.
>> >
>> >
>> >
>> > On Thu, Nov 27, 2008 at 9:07 AM, Phil HUXLEY <phil.hux...@3dlabs.com>
>> > hack...@android.com
>> >
>> > Note: please don't send private questions to me, as I don't have time to
>> > provide private support. All such questions should be posted on public
>> > forums, where I and others can see and answer them.
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hac...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails. All such
The proper way to fix this problem was reported by another reader:
- In the build path for LoaderProblem, click on "Order and Export".
- Check the box for LoaderCommon, to let LoaderProblem export the LoaderCommon classes as well as its own.
- In the build path for LoaderProblemTests, remove the dependency on the LoaderCommon project. The dependency is already now covered by the LoaderProblem dependency.
- Clean, build, rerun LoaderProblem, then rerun LoaderProblemTests.