摇篮和Android V7 compat的问题 [英] Gradle and Android v7 compat issue

查看:141
本文介绍了摇篮和Android V7 compat的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的编译与摇篮Android应用程序的问题。我和摇篮一个新手,所以...

I have problems compiling my Android app with Gradle. I'm a newbie with Gradle, so...

看来摇篮无法解析正确V7 compat的图书馆。这是code,我使用它:

It seems that Gradle cannot resolve correctly v7 compat library. This is the code where I use it:

MenuItemCompat.setOnActionExpandListener(mSearchItem,
            new MenuItemCompat.OnActionExpandListener() {
                @Override
                public boolean onMenuItemActionCollapse(MenuItem item) { ...}

这是我从摇篮得到错误:

And this is the error I get from Gradle:

C:\>gradlew build

error: cannot find symbol
            new MenuItemCompat.OnActionExpandListener() {
                              ^
  symbol:   class OnActionExpandListener
  location: class MenuItemCompat

我可以从Android的工作室smoothlessly建立这个。

I can build this from Android Studio smoothlessly.

我已经试过手动添加compat的库JAR到我的lib目录下,并添加了gradle.build文件的依赖,但它不能正常工作。

I've tried adding the compat library jar manually to my lib directory and adding a dependency in the gradle.build file but it doesn't work.

推荐答案

最后,我发现这个问题,这要归功于for3st。

Finally, I found the issue, thanks to for3st.

嗯,我不知道Android SDK工作室Manager和SDK管理器,我下载我自己从Android网页没有提及以下内容。这是主要的问题在这里。其他的问题都涉及到这个问题:

Well, I didn't know that Android Studio SDK Manager and the SDK Manager that I downloaded on my own from the android web page did not refer to the following. That's the main issue here. Other issues were related to the problem:

  • 在我有这样一个老版本的Andr​​oid工作室(0.2),我不得不与ZIP安装该补丁手动升级。它似乎做工精细,但我没有绝对的把握,所以我卸载它,并从Android开发者网站安装Android的工作室3.2,则使用的IDE装置升级到3.6。从现在起,我会喜欢升级变得更加轻松。
  • 然后,我得到了很多的问题摇篮,相关的版本和所有这一切,所以我从摇篮网站1.8版本下载,在我的磁盘的某处放置,编辑机器人工作室,来实现和编着的gradle- wrapper.properties使用正确的版本。
  • 更多问题,我是由于下载所需要的API的版本,我的目标在我的项目,以及配套的minSdkVersion和targetSdkVersion在AndroidManifest.xml中和gradle.build文件。
  • 然后我检查了我的项目结构,并提出了正确的调整或在我的build.gradle文件中添加了sourceSets部分。
  • 最后,我复制我的第三方的依赖关系(joda.time,android.v4支持),以我的lib文件夹。

我不知道哪一个解决了这个问题,但是所有这一切都解决了肯定。我决定把这个所有这些都是为了帮助别人谁得到stucked。使用此作为一个清单。

I'm not sure which one solved the issue, but all of this solved it for sure. I decided to put all this in order to help someone who gets stucked. Use this as a checklist.

这篇关于摇篮和Android V7 compat的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆