3

尝试使用 Maven 编译/运行我的应用程序时出现此错误。我已成功将 actionbarsherlock 作为库安装到我的本地 maven 存储库中,并将依赖项添加到我的应用程序中。但是仍然无法编译我的应用程序,我什至尝试在编译时强制使用 sdk-15。有任何想法吗?

Maven 日志

C:\repository\myapp>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myapp 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- android-maven-plugin:3.1.1:generate-sources (default-generate-sources) @ myapp ---
[DEBUG] Expanding: user\.m2\repository\com\actionbarsherlock\library\4.1.0\library-4.1.0.apklib into C:\repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0
[DEBUG] expand complete
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] C:\Program Files (x86)\Android-SDK\platform-tools\aapt.exe [package, -m, -J, C:\repository\myapp\target\generated-sources\r, -M, C:\repository\myapp\AndroidManifest.xml, -S, C:\repository\myapp\res, -S, C:\repository\myapp\target\unpack\apk
libs/com.actionbarsherlock_library_apklib_4.1.0/res, --auto-add-overlay, -I, C:\Program Files (x86)\Android-SDK\platforms\android-15\android.jar]
[INFO] C:\Program Files (x86)\Android-SDK\platform-tools\aapt.exe [package, -m, -J, C:\repository\myapp\target\generated-sources\r, --custom-package, com.actionbarsherlock, -M, C:\repository\myapp\AndroidManifest.xml, -S, C:\repository\myapp\res, -S, C
:\repository\myapp\target\unpack\apklibs/com.actionbarsherlock_library_apklib_4.1.0/res, --auto-add-overlay, -I, C:\Program Files (x86)\Android-SDK\platforms\android-15\android.jar]
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ myapp ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\repository\myapp\src\main\resources
[INFO] skip non existing resourceDirectory C:\repository\myapp\target\generated-sources\extracted-dependencies\src\main\resources
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ myapp ---
[INFO] Compiling 130 source files to C:\repository\myapp\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\widget\IcsAdapterView.java:[31,33] cannot find symbol
symbol  : class AccessibilityNodeInfo
location: package android.view.accessibility
.....
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\ActionBarSherlockNative.java:[232,55] cannot find symbol
symbol  : class ActionMode
location: package android.view
.....
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\nineoldandroids\widget\NineLinearLayout.java:[62,17] cannot find symbol
symbol  : method setTranslationX(float)
location: class android.widget.LinearLayout
......
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\widget\IcsAdapterView.java:[878,4] method does not override or implement a method from a supertype
[INFO] 100 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.225s
[INFO] Finished at: Thu Jun 14 22:00:04 CEST 2012
[INFO] Final Memory: 15M/175M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project myapp: Compilation failure: Compilation failure:
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\widget\IcsAdapterView.java:[31,33] cannot find symbol
[ERROR] symbol  : class AccessibilityNodeInfo
[ERROR] location: package android.view.accessibility
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\widget\IcsAdapterView.java:[893,50] cannot find symbol
[ERROR] symbol  : class AccessibilityNodeInfo
[ERROR] location: class com.actionbarsherlock.internal.widget.IcsAdapterView<T>
.....
[ERROR] symbol  : class FragmentTransaction
[ERROR] location: package android.app
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\widget\IcsAdapterView.java:[67,32] cannot find symbol
[ERROR] symbol  : variable HONEYCOMB
[ERROR] location: class android.os.Build.VERSION_CODES
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\widget\ActionBarView.java:[201,34] cannot find symbol
......
[ERROR] symbol  : variable ICE_CREAM_SANDWICH
[ERROR] location: class android.os.Build.VERSION_CODES
[ERROR] \repository\myapp\target\unpack\apklibs\com.actionbarsherlock_library_apklib_4.1.0\src\com\actionbarsherlock\internal\widget\ActionBarView.java:[1318,21] cannot find symbol

我的 pom.xml

<project>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.company.android</groupId>
    <artifactId>myapp</artifactId>
    <version>0.1-SNAPSHOT</version>
    <packaging>apk</packaging>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>2.2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>library</artifactId>
            <version>4.1.0</version>
            <type>apklib</type>
        </dependency>
    </dependencies>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.6</java.version>
        <android.home>C:\Program Files (x86)\Android-SDK</android.home>
        <android.version>4.0.3</android.version>
        <android.platform>15</android.platform>
        <android-support.version>r7</android-support.version>
        <android-maven.version>3.1.1</android-maven.version>
        <junit.version>4.10</junit.version>
    </properties>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.8</version>
            </plugin>

            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>${android-maven.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <sdk>
                        <path>${android.home}</path>
                        <platform>${android.platform}</platform>
                    </sdk>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
4

1 回答 1

11

您需要针对 ICS 进行编译。将您的 android 依赖版本更改为4.0.1.2.

于 2012-06-14T20:22:49.773 回答