简体   繁体   English

Maven找不到ActionBarDrawerToggle

[英]Maven cannot find ActionBarDrawerToggle

I have run into a curious case. 我遇到了一个奇怪的案例。 Implemented a sliding menu for a project using the Android support framework (ie. ActionBarDrawerToggle). 使用Android支持框架(即ActionBarDrawerToggle)为项目实现了滑动菜单。 Works fine in Eclipse, can deploy just fine to my tethered phone. 在Eclipse中可以正常工作,可以很好地部署到我的系留电话上。 However, if I compile using Maven, all of the classes that have an import of android.support.v4 fail with messages such "package android.support.v4.app does not exist" and "BaseActivity.java:89: cannot find symbol [ERROR] symbol : class ActionBarDrawerToggle". 但是,如果我使用Maven进行编译,则所有导入了android.support.v4的类都会失败,并显示诸如“程序包android.support.v4.app不存在”和“ BaseActivity.java:89:找不到符号”的消息[错误]符号:ActionBarDrawerToggle类”。

I have tried attempted to place a support-v4 dependency in my pom.xml (both r6 and r7) but with no luck. 我尝试尝试将support-v4依赖项放在我的pom.xml(r6和r7)中,但是没有运气。 The correct android-support-v4.jar is in the /libs directory (or Eclipse would have issues) so I am at of a bit of a loss on what Maven is looking for. 正确的android-support-v4.jar位于/ libs目录中(否则Eclipse会出现问题),所以我对Maven寻找的内容有些不知所措。 It is strange as I have a similar setup for another project on the same laptop and machine and can use Maven just fine for *.apk creation. 奇怪的是,我在同一台笔记本电脑和计算机上为另一个项目设置了类似的设置,并且可以将Maven很好地用于* .apk创建。

Thoughts on what issues Maven is having? 关于Maven有什么问题的思考?

The version in Maven Central is old. Maven Central中的版本较旧。 (You need a version newer than r6.) You can add the version that Eclipse is using as a system dependency (or install the jar into your local repository). (您需要一个比r6更高的版本。)您可以添加Eclipse用作系统依赖项的版本(或将jar安装到本地存储库中)。

As a system dependency: 作为系统依赖项:

<dependency>
    <groupId>com.google.android</groupId>
    <artifactId>support-v4</artifactId>
    <version>r6</version>
    <scope>system</scope>
    <systemPath>${basedir}/libs/android-support-v4.jar</systemPath>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android-无法解析ActionBarDrawerToggle - Android - ActionBarDrawerToggle cannot be resolved DrawerLayout和ActionBarDrawerToggle无法解析为一种类型 - DrawerLayout and ActionBarDrawerToggle cannot be resolved to a type DrawerLayout和ActionBarDrawerToggle无法解析为某种类型 - DrawerLayout and ActionBarDrawerToggle cannot be resolved to a type 错误:不兼容的类型:int 无法转换为工具栏 R.drawable.ic_drawer &amp; 找不到符号“mDrawerToggle = new ActionBarDrawerToggle(” - error: incompatible types: int cannot be converted to Toolbar R.drawable.ic_drawer & cannot find symbol “mDrawerToggle = new ActionBarDrawerToggle(” ActionBarDrawerToggle找不到其活动 - ActionBarDrawerToggle can't find its activity ActionBarDrawerToggle()图标无法设置为Android SDK 5中的ActionBar - ActionBarDrawerToggle() icon cannot be set to the ActionBar in Android SDK 5 Gradle无法在Maven上找到齐射 - Gradle cannot find volley on maven Maven和Android - 找不到符号 - Maven and Android - Cannot find symbol [Android][Maven] 找不到 androidx 工件 - [Android][Maven] Cannot find androidx artifacts 导入的android.support.v7.app.ActionBarDrawerToggle无法解析 - The import android.support.v7.app.ActionBarDrawerToggle cannot be resolved
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM