【问题标题】:'Unresolved type' from APK dependencies in an Android project with Maven使用 Maven 的 Android 项目中来自 APK 依赖项的“未解析类型”
【发布时间】:2015-04-14 02:12:43
【问题描述】:

我在使用 Eclipse 开发的 Android 应用程序中使用 FFmpegMediaMetadataRetriever(以下简称 FMMR)。我正在尝试将其转换为 Maven 项目,这是导致问题的最后一个依赖项。

Maven 正确下载了 FMMR,但它没有链接到 Eclipse 中的“Maven 依赖项”,并且将其导入到一个类中会出现错误“无法解析导入 wseemann”。其他依赖项正常工作。

FMMR 作为 APK 分发;其他的是 JAR。

完整的 POM 是:

<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.pconley</groupId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<artifactId>TestApp</artifactId>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.github.wseemann</groupId>
        <artifactId>FFmpegMediaMetadataRetriever</artifactId>
        <version>1.0.0</version>
        <scope>runtime</scope>
        <type>apk</type>
    </dependency>
</dependencies>

<build>
    <finalName>${project.artifactId}</finalName>
    <sourceDirectory>src</sourceDirectory>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.9.0-rc.3</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
                <sdk>
                    <platform>21</platform>
                </sdk>
                <testCoverageFile>/data/data/com.github.pconley.TestApp/cache/test-coverage.ec</testCoverageFile>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

</project>

一些注意事项:

  • 完整的最小示例项目是on Github
  • 我正在使用 m2e 和 m2e-android。
  • 我将其导入 Android Studio 并在 gradle 中添加了依赖项:同样的问题。
  • 我尝试使用我下载的 jar 作为系统范围的依赖项:这解决了导入错误,但在编译的项目中不包含 FMMR。

是我做错了什么,还是 FMMR APK 构建不正确?

【问题讨论】:

    标签: android maven


    【解决方案1】:

    我今天早上修复了打包问题,只需将以下行添加到您的模块 build.gradle 文件中:

    compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.5

    【讨论】:

    • 在不支持 AAR 的 Maven/Eclipse 中不起作用。不过,我应该将我的项目转移到 Gradle。
    • 我在 build.gradle 文件中使用了上述行,但仍然显示 FFmpegMediaMetadataRetriever 的错误。无法解析“FFmpegMediaMetadataRetriever”。
    • 使用1.0.5版本:compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.5
    猜你喜欢
    • 1970-01-01
    • 2018-02-27
    • 2016-12-25
    • 1970-01-01
    • 2017-03-03
    • 1970-01-01
    • 2017-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多