无法解析从外部依赖进口Android Studio中2.0 preVIEW 5 + preVIEW 6 [英] Unable to resolve imports from external dependencies in Android Studio 2.0 Preview 5 + Preview 6

查看:416
本文介绍了无法解析从外部依赖进口Android Studio中2.0 preVIEW 5 + preVIEW 6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是升级之后的最后的 Android的工作室2.0 preVIEW为 preVIEW 5 我在从 android.support.wearable 包。

After upgrading from the last Android Studio 2.0 preview to Preview 5 I'm having trouble with the imports from the android.support.wearable package.

这两个主要的应用程序和穿戴应用构建和运行得很好,但Android Studio中的编辑抱怨说,它不能解决这些进口

Both the main app and Wear app builds and run just fine, but the editor in Android Studio complains that it can't resolve the these imports

import android.support.wearable.activity.WearableActivity;
import android.support.wearable.view.CircledImageView;
import android.support.wearable.view.WearableListView;

在磨损模块的build.gradle我有以下的依存关系:

In the Wear module's build.gradle I have the following dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':common')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:support-v13:23.1.1'

    compile 'com.google.android.support:wearable:1.3.0'
    provided 'com.google.android.wearable:wearable:1.0.0'
    compile 'com.google.android.gms:play-services-wearable:8.4.0'
}

当我从 http://developer.android理解。 COM /培训/身打扮/应用/不间断on.html#EnableAmbient 这应该使用提供语句时工作。 ,它一直很好,直到Android的工作室升级。我缺少的东西吗?

As I understand from http://developer.android.com/training/wearables/apps/always-on.html#EnableAmbient this should work when using the provided statement. And it has worked well until the Android Studio upgrade. Am I missing something?

这不只是一个磨损库的问题,这是一般的什么似乎是任何外部的依赖。(主题原本是的无法解析包android.support.wearable在Android的工作室2.0 preVIEW 5 的。)

This isn't just a problem with the Wear library, it's general for what seems to be any external dependency. (Topic originally was Unable to resolve package android.support.wearable in Android Studio 2.0 Preview 5.)

这似乎是可以在任何时候出现问题,但在实践中发生的主要每当我在一类做lotsa变化(也许更改为进口?)。刚才突然无法解析播放服务和Facebook广告的进口量(同时还为其他依赖工作)。

It seems like the problem can occur at any time, but in practice it happens mostly whenever I do lotsa changes in a class (maybe changes to the imports?). Just now it suddenly was unable to resolve the imports of Play Services and Facebook ads (while still working for other dependencies).

我无意中发现这个问题的解决方法:如果我打开,并建立Android Studio中1.5,我也安装了该项目,所有进口都是固定的。让我们回到工作室的Andr​​oid 2.0,我可以继续编程而不进口成为无法解决的很长一段时间。

I accidentally found a workaround of the problem: If I open and build the project in Android Studio 1.5 which I also have installed, all the imports are fixed. Going back to Android Studio 2.0 I can continue programming without the imports becoming unresolvable for a long while.

对于任何谷歌搜索的问题,Android Studio中的错误信息是通常的无法解析符号'[包装]

For anyone googling the problem, the error message in Android Studio is the usual Cannot resolve symbol '[package]'.

推荐答案

我之前也有过这样的问题,因为1.5,为我解决它使用终端的Andr​​oid Studio中并执行最简单的方法:

I had this problem even before with AS 1.5, the easiest way for me to fix it was to use the Terminal inside Android Studio and execute:

./gradlew assembleDebug

这会,如果你不使用香精,如果不直接使用的香精的名称,例如工作:

This will work if you're not using flavors if not just use the name of the flavor, for e.g:

./gradlew assembleFlavorNameDebug

这应该也可以工作作为一种解决方法无需离开当前的AS的实例,然后编译器可以识别你的进口,如果一切都设置正确。

that should work too as a workaround without leaving your current instance of AS, and then the compiler recognizes your imports if everything is setup properly.

有关更多的参考资料请看: http://tool​​s.android.com/build/gradleplugin
http://stackoverflow.com/a/21307568/799162

For more references please look: http://tools.android.com/build/gradleplugin http://stackoverflow.com/a/21307568/799162

这篇关于无法解析从外部依赖进口Android Studio中2.0 preVIEW 5 + preVIEW 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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