Question

In short, I'd like to know if the "uses-library" tag is necessary in an app's android manifest to use another Eclipse project as a library.

My question is similar to the one found here, I was looking for some additional clarification. I am trying to use an Android project as a library (nothing to do with Google Maps). The app compiles and installs but crashes at runtime when it fails to find some files in its application data. I want to ensure the I'm adding the library correctly so I can focus on why the application data is missing.

I have selected the "Is Library" checkbox in its properties in Eclipse and added a reference to it in my application's properties menu. Do I need to modify my app's manifest in order to use the library project? I found the "uses-library" tag on Android Developers, but the previously mentioned post seems to indicate this is only for built-in libraries. Adding the tag results in an "INSTALL_FAILED_MISSING_SHARED_LIBRARY" error.

If the manifest is not a problem I can start a separate post for the app data questions, I just wanted a conclusive answer on whether "uses-library" is relevant to non-Google libraries. Thanks!

My Manifest:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="tadams.scTest"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <!-- <uses-library android:name="net.sf.supercollider.android" />-->
        <activity
            android:name=".HelloSuperColliderActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Error (without "uses-library"):

  03-24 00:20:43.057: D/dalvikvm(539): Not late-enabling CheckJNI 
    (already on) 
    03-24 00:20:43.557: W/dalvikvm(539): Exception Ljava/lang/ 
    UnsatisfiedLinkError; thrown while initializing Lnet/sf/supercollider/ 
    android/SCAudio; 
    03-24 00:20:43.566: D/AndroidRuntime(539): Shutting down VM 
    03-24 00:20:43.566: W/dalvikvm(539): threadid=1: thread exiting with 
    uncaught exception (group=0x409c01f8) 
    03-24 00:20:43.597: E/AndroidRuntime(539): FATAL EXCEPTION: main 
    03-24 00:20:43.597: E/AndroidRuntime(539): 
    java.lang.ExceptionInInitializerError 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    tadams.scTest.HelloSuperColliderActivity.onCreate(HelloSuperColliderActivit y.java: 
    27) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.app.Activity.performCreate(Activity.java:4465) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 
    1049) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 
    1920) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 
    1981) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.app.ActivityThread.access$600(ActivityThread.java:123) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.os.Handler.dispatchMessage(Handler.java:99) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.os.Looper.loop(Looper.java:137) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    android.app.ActivityThread.main(ActivityThread.java:4424) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    java.lang.reflect.Method.invokeNative(Native Method) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    java.lang.reflect.Method.invoke(Method.java:511) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    com.android.internal.os.ZygoteInit 
    $MethodAndArgsCaller.run(ZygoteInit.java:784) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    dalvik.system.NativeStart.main(Native Method) 
    03-24 00:20:43.597: E/AndroidRuntime(539): Caused by: 
    java.lang.UnsatisfiedLinkError: Couldn't load sndfile: findLibrary 
    returned null 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    java.lang.Runtime.loadLibrary(Runtime.java:365) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    java.lang.System.loadLibrary(System.java:535) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      at 
    net.sf.supercollider.android.SCAudio.<clinit>(SCAudio.java:56) 
    03-24 00:20:43.597: E/AndroidRuntime(539):      ... 15 more 
Was it helpful?

Solution

I'd like to know if the "uses-library" tag is necessary in an app's android manifest to use another Eclipse project as a library.

Absolutely not. <uses-library> is only for libraries that might be a part of firmware, or might not, such as the Google Maps add-on for Android.

Do I need to modify my app's manifest in order to use the library project?

Not really. You might need to modify the manifest to use things in the library (e.g., make activities or services available). But you do not need to modify the manifest just to add a library project in general.

OTHER TIPS

I didn't have to add uses library when I was adding a library project to my application. You need to ensure that the library is also open in eclipse when trying to deploy the project though. The jar should also appear in the Library Projects folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top