Android deployment fails with third-party jars (IDEA X)

My environment is OS X 10.6.5 and IDEA X. We have a project defined with one android module, a web application module and two java modules. One of the java modules is a shared library of POJOs used by the android and web applications. The second Java module is a patched version of xstream. Everything was working fine until I tried to add the patched xstream code as a compile module dependency (export is not checked) to the Android module. I included the error reported in LOGCAT when I try to deploy and my manifest file. It deploys fine when I remove the module dependency and uses-library tag for XStream from the manifest file. I checked the build output and the classes.dex file is bigger (twice the size) when I include the xstream compile dependency but still no luck deploying the APK file to an emulator.

2-10 08:30:01.120: ERROR/PackageManager(52): Package com.icfi.trtp requires unavailable shared library com.thoughtworks.xstream; failing!

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.icfi.trtp">
    <application android:label="Nest Patrol" android:icon="@drawable/icon" android:debuggable="true">
        <activity android:name=".NestListActivity" android:label="Nest Patrol" android:screenOrientation="sensor">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name=".MainActivity" android:screenOrientation="portrait" android:launchMode="singleInstance"/>
        <activity android:name=".NestMapActivity" android:screenOrientation="portrait" android:launchMode="singleInstance"/>
        <activity android:name=".NestCameraActivity" android:screenOrientation="sensor" android:launchMode="singleTask"/>
        <uses-library android:name="com.google.android.maps" />
        <uses-library android:name="com.thoughtworks.xstream" />
    </application>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission>
    <uses-permission android:name="android.permission.CONTROL_LOCATION_UPDATES"></uses-permission>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
    <uses-permission android:name="android.permission.SET_WALLPAPER"></uses-permission>
    <uses-permission android:name="android.permission.CAMERA"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_SETTINGS"></uses-permission>
    <uses-permission android:name="android.permission.SET_DEBUG_APP"></uses-permission>
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
</manifest>



1

3 comments
Comment actions Permalink

I don't exactly understand your situation, but the

<uses-library>
element is for add-ons supplied as extensions to the firmware (i.e. google maps add-on). So, it seems, it is not usable for your scenario. If you have a simple external jar to include to "classes.dex", you just need to add a module dependency with COMPILE scope, you don't need to add "uses-library" tag.

BTW, if your library is provided by container (as google maps add-on), you need to add "uses-library" element to AndroidManifest.xml, and add a module dependency with PROVIDED scope.
0
Comment actions Permalink

That did it. It was a misunderstanding on my part. I thought you needed the uses-library for external module dependencies. We have it setup correctly, compile dependency for xstream and provided dependency for Google Maps API. When I removed the uses-library tag for xstream it worked. Thanks Eugene.

Grant

0
Comment actions Permalink

I've created an issue about appropriate warning: http://youtrack.jetbrains.net/issue/IDEA-62857
I think, it would be useful. Please, vote

0

Please sign in to leave a comment.