Skip to content

dalvikvm: Could not find method ...  #479

@mstevens83

Description

@mstevens83

I have an APK project (lets call it "app") which depends on a plain non-Android JAR project (let's call it "lib"), which in turn depends on the Apache Commons Codec library (in addition to a bunch of other libraries).

Everything builds without errors but when I run the apk on my phone (a Nexus 4, running Android v4.4.4) I get this error on logcat:

10-13 16:22:39.361: I/dalvikvm(3776): Could not find method org.apache.commons.codec.binary.Hex.encodeHexString, referenced from method uk.ac.ucl.excites.sapelli.storage.db.sql.sqlite.types.SQLiteBlobColumn.sqlToLiteral

So clearly (some parts of) that Commons Codec library don't seem to be available in the final apk. What's weird though is that I don't seem to have such problems with any of the other dependencies of "lib" (i.e. the others are available in the apk).

Here are the relevant parts of the pom.xml files...
For "app":

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>sapelli-collector-android</artifactId>
    <name>Sapelli Collector for Android</name>
    <packaging>apk</packaging>
    <parent>
        <groupId>uk.ac.ucl.excites</groupId>
        <artifactId>sapelli</artifactId>
        <version>2.0.0-beta-7</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>4.4.2_r4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v4</artifactId>
            <version>20.0.0</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>uk.ac.ucl.excites</groupId>
            <artifactId>sapelli-library</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.japgolly.android</groupId>
            <artifactId>svg-android</artifactId>
            <version>2.0.6</version>
        </dependency>
    </dependencies>
...

And for "lib":

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>sapelli-library</artifactId>
    <name>Sapelli Library</name>
    <packaging>jar</packaging>
    <parent>
        <groupId>uk.ac.ucl.excites</groupId>
        <artifactId>sapelli</artifactId>
        <version>2.0.0-beta-7</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>[2.4,)</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>[3.3.2,)</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>[1.9,)</version>
        </dependency>
        <dependency>
            <groupId>org.tukaani</groupId>
            <artifactId>xz</artifactId>
            <version>[1.5,)</version>
        </dependency>
        <dependency>
            <groupId>com.github.jponge</groupId>
            <artifactId>lzma-java</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>1.8.1</version>
        </dependency>
    </dependencies>
...

I have tried to add <scope>compile</scope>to the dependencies but nothing helps.

This happens both with command line builds and eclipse builds (using m2e-android in the latter case).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions