Discussion:
Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]
jsdf
2009-09-04 12:27:57 UTC
Permalink
Yes, that did it. I was using an AVD that was not built with Google
libraries.
Thanks for the nudge.
jsdf
Apparently your app needs Google's maps library.  That library is not in the
emulator image you are using.  I am pretty sure there is an image included
in the SDK that contains that library; the documentation about the SDK and
ADTs should be of help.
Dianne,
Yes, the log tells me that my package "requires unavailable shared
library com.google.android.maps".
When I take out the <uses-library
android:name="com.google.android.maps" /> from my manifest, it loads
successfully.  On launch, I get an error: "Unable to resolve
superclass of Lcom/jsdf/app/map/MapViewActivity;"
And, clearly, that is not the right solution anyway.
Do you (or anyone else) have suggestions on how else to approach this?
"admob-sdk-android.jar"
"FlurryAgent.jar"
"Google APIs [Android 1.5]" <-- when expanded, this shows android.jar
and maps.jar.
My Eclipse > Project Properties > Android > Project Build Target is
"Google APIs"
My (disguised) manifest is below.  Note that if I change <uses-sdk
android:minSdkVersion> from 1 to 3, the result is the same.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.jsdf.app" android:versionName="1.0"
       android:versionCode="1">
       <uses-sdk android:minSdkVersion="1" />
       <uses-permission android:name="android.permission.VIBRATE"></uses-
permission>
       <uses-permission android:name="android.permission.INTERNET"></uses-
permission>
       <uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-
permission>
       <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"></uses-
permission>
app_name"
               android:debuggable="true"
               android:name="com.jsdf.app.App">
               <uses-library android:name="com.google.android.maps" />
               <activity android:name=".AppApplication">
                       <intent-filter>
                               <action
android:name="android.intent.action.MAIN" />
                               <category
android:name="android.intent.category.LAUNCHER" />
                       </intent-filter>
               </activity>
               <activity android:name="Activity"></activity>
               <meta-data android:value="xxxxxxxxxxxx"
android:name="ADMOB_PUBLISHER_ID" />
       </application>
</manifest>
Thanks,
jsdf
You have a <uses-library> line in your manifest for a shared library that
is
not built into the emulator.  The log will probably tell you more.
Hi all,
When I try to install one of my applications to the emulator with "adb
1134 KB/s (123414 bytes in 0.106s)
       pkg: /data/local/tmp/app-lite.apk
Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]
I have built with two external libraries, Flurry and AdMob.
I have also tried rebuilding my project from scratch, with the same
results.
The very odd thing is that this does not happen when I install the
release version to my phone via downloading an .apk file.
Does anyone have suggestions on how to proceed?
Thanks,
jsdf
--
Dianne Hackborn
Android framework engineer
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
questions should be posted on public forums, where I and others can see
and
answer them.
--
Dianne Hackborn
Android framework engineer
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
questions should be posted on public forums, where I and others can see and
answer them.
Marco Schmitz
2009-09-04 16:21:40 UTC
Permalink
maybe its just that simple: choose eclipse to export the library for
you. it can be found there where you can add exernal jars and stuff...

greetings
darolla
Lawrence
2009-10-02 05:57:12 UTC
Permalink
I could be wrong here but I think there is something that should be
pointed out about the "added libraries" situation. I also had this
problem: Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY] and the
threads in this email assisted in solving the problem.

The "situation" I want to point out is that when building a "standard"
java application in eclipse we include the libraries necessary for the
application to run. They in turn are added to the class path and/or
added to the jar file as part of the application. It seems that the
situation in android is slightly different. The "added" libraries are
not added to the .apk file but included in the environment, i.e., in
the AVD and the developer needs to construct/build it.

My question: Does this mean that any and every application that needs
a library like "maps.jar" file does not need to duplicate it in their
environment? If one application specifies a need for the maps.jar,
other application will have maps.jar available to them?

Where are the specification for how libraries and resources are shared
out of the "sandbox"?

Thank you for any help,
Lawrence
Post by Marco Schmitz
maybe its just that simple: choose eclipse to export the library for
you. it can be found there where you can add exernal jars and stuff...
greetings
darolla
jotobjects
2009-10-02 20:29:10 UTC
Permalink
This is an area that I am confused about also. The term "external
library" is perhaps overloaded with a different meaning in Android SDK
vs. in Eclipse build environment (which I don't use anyway).
Apparently this term in Android refers to a Linux platform shared
library?

I think Dianne in this thread is saying that the <uses-library> is
only for shared libraries that are built-in to the device (emulator
image)?

And an application can NOT install a shared library?

Also I think that if you have a jar in your project lib directory that
WILL be included in the apk package?

And finally, from a recent thread, note that the maps.jar included
with the SDK is a stub for compile time linking and is NOT the
complete maps API that has to be installed on the device as a shared
library outside the application's control as mentioned above.

Please correct me here if I am drawing any wrong conclusions.
Post by Lawrence
I could be wrong here but I think there is something that should be
pointed out about the "added libraries" situation. I also had this
problem: Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY] and the
threads in this email assisted in solving the problem.
The "situation" I want to point out is that when building a "standard"
java application in eclipse we include the libraries necessary for the
application to run. They in turn are added to the class path and/or
added to the jar file as part of the application.  It seems that the
situation in android is slightly different. The "added" libraries are
not added to the .apk file but included in the environment, i.e., in
the AVD and the developer needs to construct/build it.
My question: Does this mean that any and every application that needs
a library like "maps.jar" file does not need to duplicate it in their
environment? If one application specifies a need for the maps.jar,
other application will have maps.jar available to them?
Where are the specification for how libraries and resources are shared
out of the "sandbox"?
Thank you for any help,
Lawrence
Post by Marco Schmitz
maybe its just that simple: choose eclipse to export the library for
you. it can be found there where you can add exernal jars and stuff...
greetings
darolla
Xavier Ducrohet
2009-10-03 02:33:45 UTC
Permalink
This is an area that I am confused about also.  The term "external
library" is perhaps overloaded with a different meaning in Android SDK
vs. in Eclipse build environment (which I don't use anyway).
Apparently this term in Android refers to a Linux platform shared
library?
Correct they are optional system-level libraries.
I think Dianne in this thread is saying that the <uses-library> is
only for shared libraries that are built-in to the device (emulator
image)?
Yes. Since the maps library is Google proprietary, it's not part of
the default SDK system image, and we ship a Google add-on that not
only gives access to the API, but also includes a custom emulator
system image that does have this system library.
And an application can NOT install a shared library?
Correct.
Also I think that if you have a jar in your project lib directory that
WILL be included in the apk package?
Correct in Ant, in Eclipse you have to add it to the build path.
And finally, from a recent thread, note that the maps.jar included
with the SDK is a stub for compile time linking and is NOT the
complete maps API that has to be installed on the device as a shared
library outside the application's control as mentioned above.
That is correct. Like android.jar, maps.jar only contains the public
API. It does not include all classes the maps library present on the
system, and the included classes have no code (they all throw an
exception).

Xav
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
jotobjects
2009-10-05 23:46:05 UTC
Permalink
Thanks for those clarifications - this is very helpful. Two more
questions:

I created a jar file in my project lib directory and used some classes
in the jar file. It works when I install it, but when I look at the
apk file (with jar -t) I don't see the lib directory. When I look on
the device with adb shell I see an empty lib directory. So where does
my jar file wind up in the apk and on the device? I'm guessing it's
been bundled in the classes.dex file but I don't know how to examine
the contents of the dex file.

Regarding the Maps api. I see what might be the implementation jar
in /data/dalvik-cache named
***@framework@***@classes.dex
Is that the "shared library" aka "external library" (i.e., not a
native linux .so shared library)?
Post by Xavier Ducrohet
This is an area that I am confused about also.  The term "external
library" is perhaps overloaded with a different meaning in Android SDK
vs. in Eclipse build environment (which I don't use anyway).
Apparently this term in Android refers to a Linux platform shared
library?
Correct they are optional system-level libraries.
I think Dianne in this thread is saying that the <uses-library> is
only for shared libraries that are built-in to the device (emulator
image)?
Yes. Since the maps library is Google proprietary, it's not part of
the default SDK system image, and we ship a Google add-on that not
only gives access to the API, but also includes a custom emulator
system image that does have this system library.
And an application can NOT install a shared library?
Correct.
Also I think that if you have a jar in your project lib directory that
WILL be included in the apk package?
Correct in Ant, in Eclipse you have to add it to the build path.
And finally, from a recent thread, note that the maps.jar included
with the SDK is a stub for compile time linking and is NOT the
complete maps API that has to be installed on the device as a shared
library outside the application's control as mentioned above.
That is correct. Like android.jar, maps.jar only contains the public
API. It does not include all classes the maps library present on the
system, and the included classes have no code (they all throw an
exception).
Xav
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
jotobjects
2009-10-08 22:52:07 UTC
Permalink
Answering my own questions -

The dex file can be examined with dexdump.exe in the tools directory.

The classes from the jar are included with the rest of the application
classes in the classes.dex file.

The maps api implementation jar file is on the device in the /system/
framework directory.
Thanks for those clarifications - this is very helpful.  Two more
I created a jar file in my project lib directory and used some classes
in the jar file.  It works when I install it, but when I look at the
apk file (with jar -t) I don't see the lib directory.  When I look on
the device with adb shell I see an empty lib directory.  So where does
my jar file wind up in the apk and on the device?  I'm guessing it's
been bundled in the classes.dex file but I don't know how to examine
the contents of the dex file.
Regarding the Maps api.  I see what might be the implementation jar
in /data/dalvik-cache named
Is that the "shared library" aka "external library" (i.e., not a
native linux .so shared library)?
Post by Xavier Ducrohet
This is an area that I am confused about also.  The term "external
library" is perhaps overloaded with a different meaning in Android SDK
vs. in Eclipse build environment (which I don't use anyway).
Apparently this term in Android refers to a Linux platform shared
library?
Correct they are optional system-level libraries.
I think Dianne in this thread is saying that the <uses-library> is
only for shared libraries that are built-in to the device (emulator
image)?
Yes. Since the maps library is Google proprietary, it's not part of
the default SDK system image, and we ship a Google add-on that not
only gives access to the API, but also includes a custom emulator
system image that does have this system library.
And an application can NOT install a shared library?
Correct.
Also I think that if you have a jar in your project lib directory that
WILL be included in the apk package?
Correct in Ant, in Eclipse you have to add it to the build path.
And finally, from a recent thread, note that the maps.jar included
with the SDK is a stub for compile time linking and is NOT the
complete maps API that has to be installed on the device as a shared
library outside the application's control as mentioned above.
That is correct. Like android.jar, maps.jar only contains the public
API. It does not include all classes the maps library present on the
system, and the included classes have no code (they all throw an
exception).
Xav
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
Xavier Ducrohet
2009-10-08 23:49:03 UTC
Permalink
Just to confirm:

- yes all your jar files go into classes.dex. If those have resources,
they'll just be put in the apk as they were in the .jar file.

The /data/dalvik-cache files are/extracted/optimized version of the
classes.dex. When you install an app, it takes your classes.dex and optimize
it based on your device architecture. It also acts as extracting the
classes.dex from the apk zip archive for direct access.

The jar files in /system/framework/ do not contain .class files, instead
they just contain a single classes.dex (like any apk file).

Xav
Post by jotobjects
Answering my own questions -
The dex file can be examined with dexdump.exe in the tools directory.
The classes from the jar are included with the rest of the application
classes in the classes.dex file.
The maps api implementation jar file is on the device in the /system/
framework directory.
Post by jotobjects
Thanks for those clarifications - this is very helpful. Two more
I created a jar file in my project lib directory and used some classes
in the jar file. It works when I install it, but when I look at the
apk file (with jar -t) I don't see the lib directory. When I look on
the device with adb shell I see an empty lib directory. So where does
my jar file wind up in the apk and on the device? I'm guessing it's
been bundled in the classes.dex file but I don't know how to examine
the contents of the dex file.
Regarding the Maps api. I see what might be the implementation jar
in /data/dalvik-cache named
Is that the "shared library" aka "external library" (i.e., not a
native linux .so shared library)?
Post by Xavier Ducrohet
Post by jotobjects
This is an area that I am confused about also. The term "external
library" is perhaps overloaded with a different meaning in Android
SDK
Post by jotobjects
Post by Xavier Ducrohet
Post by jotobjects
vs. in Eclipse build environment (which I don't use anyway).
Apparently this term in Android refers to a Linux platform shared
library?
Correct they are optional system-level libraries.
Post by jotobjects
I think Dianne in this thread is saying that the <uses-library> is
only for shared libraries that are built-in to the device (emulator
image)?
Yes. Since the maps library is Google proprietary, it's not part of
the default SDK system image, and we ship a Google add-on that not
only gives access to the API, but also includes a custom emulator
system image that does have this system library.
Post by jotobjects
And an application can NOT install a shared library?
Correct.
Post by jotobjects
Also I think that if you have a jar in your project lib directory
that
Post by jotobjects
Post by Xavier Ducrohet
Post by jotobjects
WILL be included in the apk package?
Correct in Ant, in Eclipse you have to add it to the build path.
Post by jotobjects
And finally, from a recent thread, note that the maps.jar included
with the SDK is a stub for compile time linking and is NOT the
complete maps API that has to be installed on the device as a shared
library outside the application's control as mentioned above.
That is correct. Like android.jar, maps.jar only contains the public
API. It does not include all classes the maps library present on the
system, and the included classes have no code (they all throw an
exception).
Xav
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
Xavier Ducrohet
2009-10-03 02:30:17 UTC
Permalink
Post by Lawrence
I could be wrong here but I think there is something that should be
pointed out about the "added libraries" situation. I also had this
problem: Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY] and the
threads in this email assisted in solving the problem.
The "situation" I want to point out is that when building a "standard"
java application in eclipse we include the libraries necessary for the
application to run. They in turn are added to the class path and/or
added to the jar file as part of the application.  It seems that the
situation in android is slightly different. The "added" libraries are
not added to the .apk file but included in the environment, i.e., in
the AVD and the developer needs to construct/build it.
Right, you have to consider Maps has a system-level library that can
be present or not present on devices.

There are 2 parts to making a maps-enabled application:

- In ADT or in Ant, compile against the "Google APIs" target. This
target gives access to the maps API by adding maps.jar to the
classpath at compile time, but does NOT add any extra code in the
application APK.
- Declare in your manifest that your application requires maps: add
the <uses-library> node: <uses-library
android:name="com.google.android.maps" />

Now when your application is about to be installed on a device, the
package manager will check which library your app requires and will
fail to install the application if they are not present.

Note that Android Market does the same check pre-installation so that
users do not see applications that won't install.
Post by Lawrence
My question: Does this mean that any and every application that needs
a library like "maps.jar" file does not need to duplicate it in their
environment? If one application specifies a need for the maps.jar,
other application will have maps.jar available to them?
Maps.jar is never added to your apk.

For any other random library that you may add to your apk as 3rd
library (ie the code is added to your apk, and there's no need for
uses-library), no other applications can access that code.

To expose that library to other apps you would have to implement a
Service for other applications to talk to.

Xav
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
Continue reading on narkive:
Loading...